diff options
| -rw-r--r-- | Makefile | 34 | ||||
| -rw-r--r-- | trayfreq.c | 2 | ||||
| -rw-r--r-- | trayfreq_set.c | 11 | ||||
| -rw-r--r-- | trayfreq_set_interface.c | 8 | 
4 files changed, 29 insertions, 26 deletions
| @@ -3,11 +3,22 @@  MAKE = make  CC = gcc  INSTALL_PATH=/ +PREFIX=/usr +BINDIR=$(PREFIX)/bin +SUDO=/usr/bin/sudo +TRAYFREQ_SET=$(BINDIR)/trayfreq-set +LOCALE_DIR=$(PREFIX)/share/locale/  ifdef DEBUG   EXTRA_CFLAGS+=-DDEBUG  endif +EXTRA_CFLAGS+=	-DPREFIX=\"$(PREFIX)\" \ +				-DBINDIR=\"$(BINDIR)\" \ +				-DSUDO=\"$(SUDO)\" \ +				-DTRAYFREQ_SET=\"$(TRAYFREQ_SET)\" \ +				-DLOCALE_DIR=\"$(LOCALE_DIR)\" +  DEPS = 	bat_tray.h \  		bool.h \ @@ -119,18 +130,19 @@ clean:  ########################################################################  # Install entire suite  install: -	mkdir -p $(INSTALL_PATH)/usr/share/trayfreq/ -	mkdir -p $(INSTALL_PATH)/usr/share/locale/fr/LC_MESSAGES/ -	mkdir -p $(INSTALL_PATH)/etc/ +	mkdir -p $(PREFIX)/share/trayfreq/ +	mkdir -p $(LOCALE_DIR)/fr/LC_MESSAGES/ +	mkdir -p $(PREFIX)/etc/ + +	cp data/*.png $(PREFIX)/share/trayfreq/ +	cp lc/fr.mo $(LOCALE_DIR)/fr/LC_MESSAGES/trayfreq.mo -	cp data/*.png $(INSTALL_PATH)/usr/share/trayfreq/ -	cp lc/fr.mo $(INSTALL_PATH)/usr/share/locale/fr/LC_MESSAGES/trayfreq.mo +	install -Dm 644 data/trayfreq.conf $(PREFIX)/etc/trayfreq.conf +	install -Dm 644 data/trayfreq.desktop $(PREFIX)/etc/xdg/autostart/trayfreq.desktop -	install -Dm 644 data/trayfreq.conf $(INSTALL_PATH)/etc/trayfreq.conf -	install -Dm 644 data/trayfreq.desktop $(INSTALL_PATH)/etc/xdg/autostart/trayfreq.desktop -	install -Dm 755 trayfreq $(INSTALL_PATH)/usr/bin/trayfreq -	install -Dm 755 trayfreq-set $(INSTALL_PATH)/usr/bin/trayfreq-set +	install -Dm 755 trayfreq $(BINDIR)/trayfreq +	install -Dm 755 trayfreq-set $(BINDIR)/trayfreq-set -	ln -s /usr/share/licenses/common/GLPv3/license.txt $(INSTALL_PATH)/usr/share/trayfreq/LICENCE -	ln -s ../../../etc/trayfreq.conf $(INSTALL_PATH)/usr/share/trayfreq/trayfreq.conf +	ln -s ../licenses/common/GLPv3/license.txt $(PREFIX)/share/trayfreq/LICENCE +	ln -s ../../../etc/trayfreq.conf $(PREFIX)/share/trayfreq/trayfreq.conf  ######################################################################## @@ -37,7 +37,7 @@  int main(int argc, char** argv)  {  	setlocale(LC_ALL, ""); -	bindtextdomain("trayfreq","/usr/share/locale"); +	bindtextdomain("trayfreq",LOCALE_DIR);  	textdomain("trayfreq");  	debug("Set gettext up\n"); diff --git a/trayfreq_set.c b/trayfreq_set.c index 785b93b..2b8f1d2 100644 --- a/trayfreq_set.c +++ b/trayfreq_set.c @@ -17,8 +17,6 @@   ************************************************************************/ -// <TO DO> : move a lot of this to a .h -  #include <stdio.h>  #include <stdlib.h>  #include <string.h> @@ -41,8 +39,6 @@ typedef struct  {  	char *frequency;  } argument_summary; -// </TO DO> -  char write_str_to_file(const char *file, const char *data, const char *core)  {  	FILE *fd; @@ -115,12 +111,7 @@ void get_argument_summary(int argc, char **argv, argument_summary *argsum)  int main(int argc, char *argv[])  {  	setlocale(LC_ALL,""); - - -	// TO DO: Not portable -	bindtextdomain("trayfreq","/usr/share/locale"); - -	// TO DO: Needs to be #defined +	bindtextdomain("trayfreq",LOCALE_DIR);  	textdomain("trayfreq");  	debug("Set gettext up\n"); diff --git a/trayfreq_set_interface.c b/trayfreq_set_interface.c index fc847e6..d16c160 100644 --- a/trayfreq_set_interface.c +++ b/trayfreq_set_interface.c @@ -28,9 +28,9 @@ void si_gov(char* gov, int core)  	char cmd[256];  	if (_DEFAULT_USE_SUDO)  	{ -		sprintf(cmd, "sudo trayfreq-set -g %s -c %i",gov,core); +		sprintf(cmd, SUDO" "TRAYFREQ_SET" -g %s -c %i",gov,core);  	} else { -		sprintf(cmd, "trayfreq-set -g %s -c %i",gov,core); +		sprintf(cmd, TRAYFREQ_SET" -g %s -c %i",gov,core);  	}  	debug("Running '%s'\n",cmd);  	system(cmd); @@ -41,9 +41,9 @@ void si_freq(int freq, int core)  	char cmd[256];  	if (_DEFAULT_USE_SUDO)  	{ -		sprintf(cmd, "sudo trayfreq-set -f %i -c %i",freq,core); +		sprintf(cmd, SUDO" "TRAYFREQ_SET" -f %i -c %i",freq,core);  	} else { -		sprintf(cmd, "trayfreq-set -f %i -c %i",freq,core); +		sprintf(cmd, TRAYFREQ_SET" -f %i -c %i",freq,core);  	}  	debug("Running '%s'\n",cmd);  	system(cmd); | 
