diff options
Diffstat (limited to 'doc/GNUmakefile')
-rw-r--r-- | doc/GNUmakefile | 68 |
1 files changed, 68 insertions, 0 deletions
diff --git a/doc/GNUmakefile b/doc/GNUmakefile new file mode 100644 index 0000000..f1b80aa --- /dev/null +++ b/doc/GNUmakefile @@ -0,0 +1,68 @@ +.PHONY: all clean + +BINS = \ + testd + +all: $(BINS) + +PLATFORM = $(shell makefiles/guess_env --platform) +OS_MAJOR_VERSION = $(shell makefiles/guess_env --os-major-version) +OS_MINOR_VERSION = $(shell makefiles/guess_env --os-minor-version) + +COMPILE_FLAGS = -g -O2 -D_REENTRANT -Wall -W -Werror -std=c99 -pedantic -I. +LDFLAGS = +LIBS = + +CFLAGS = $(COMPILE_FLAGS) -D$(PLATFORM) -DOS_MAJOR_VERSION=$(OS_MAJOR_VERSION) -DOS_MINOR_VERSION=$(OS_MINOR_VERSION) +CC = gcc +MAKEDEPEND = $(CC) -MM + +OBJS = \ + port/snprintf.o \ + port/lockf.o \ + cmdline.o \ + log.o \ + signals.o \ + pidfile.o \ + daemon.o \ + testd.o + +# ABa: currently a special rule for cmdline.c as gengetopt is not +# completly fixed yet +cmdline.c : daemon.ggo + gengetopt --include-getopt -i $< + +cmdline.o : cmdline.c + $(CC) -c -o $@ $< + +%.o : %.c + $(CC) -c -o $@ $(CFLAGS) $< + +testd : $(OBJS) + $(CC) -o $@ $(LDFLAGS) $(LIBS) $^ + +clean: + -@rm *.bak port/*.bak 2>/dev/null + -@rm *~ port/*~ 2>/dev/null + -@rm *.d port/*.d 2>/dev/null + -@rm $(BINS) *.exe 2>/dev/null + -@rm $(OBJS) 2>/dev/null + +distclean: clean + -@rm cmdline.c cmdline.h + +%.d : %.c + @$(MAKEDEPEND) $(CFLAGS) $< 2>/dev/null | \ + sed "s,\($*\.o\)[ :]*\(.*\),$@ : $$\(wildcard \2\)___\1 : \2,g" | tr -s "_" "\n" > $@ + +-include $(OBJS:.o=.d) + +test: all + @fakeroot ./testd -d --pidfile /tmp/testd.pid && \ + sleep 3 && \ + ls -altr /tmp/testd* && \ + cat /tmp/testd.pid + -@ps -alef | grep test | grep -v grep + @sleep 1 + @pkill testd + -@ls -altr /tmp/testd* |