diff --git a/.gitignore b/.gitignore index 46c83c0..5f58b6a 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ ## Ignore the output binary dexedrine +dexedrine.service diff --git a/Makefile b/Makefile index dd1e0bd..adf787a 100644 --- a/Makefile +++ b/Makefile @@ -13,17 +13,21 @@ dexpath = $(bindir)/dexedrine .PHONY: all clean install # Define the default rule to build the program -all: dexedrine +all: dexedrine dexedrine.service # Define the rule to compile the source file dexedrine: dexedrine.c dexedrine.h $(CC) $(CFLAGS) dexedrine.c -o dexedrine $(LIBS) +dexedrine.service: dexedrine.service.template + sed --posix "s@%DEXPATH%@$(dexpath)@" dexedrine.service.template > dexedrine.service + # Define the rule to clean the generated files clean: rm dexedrine # Define how to install -install: +install: all install dexedrine $(DESTDIR)$(dexpath) + install dexedrine.service /usr/lib/systemd/user/dexedrine.service diff --git a/dexedrine.service.template b/dexedrine.service.template new file mode 100644 index 0000000..d90c9e6 --- /dev/null +++ b/dexedrine.service.template @@ -0,0 +1,7 @@ +[Unit] +Description=Dexedrine + +[Service] +Type=simple +ExecStart=%DEXPATH% +KillSignal=SIGINT