summaryrefslogtreecommitdiff
path: root/docs/GNUmakefile
diff options
context:
space:
mode:
authorAndreas Baumann <abaumann@yahoo.com>2008-12-21 12:13:55 +0100
committerAndreas Baumann <abaumann@yahoo.com>2008-12-21 12:13:55 +0100
commit738edc361f66cb8fc48a47563a2f12a60c087f76 (patch)
treeea53b47b7e6bcd7063bbc5cc02afbf7dcef0d28a /docs/GNUmakefile
parentcd63c8db79eb28f47bbdbfcc9bbf3118de2079fc (diff)
downloadwolfbones-738edc361f66cb8fc48a47563a2f12a60c087f76.tar.gz
wolfbones-738edc361f66cb8fc48a47563a2f12a60c087f76.tar.bz2
renamed doc to docs to avoid stupid makefiles to fail (even with .PHONY)
Diffstat (limited to 'docs/GNUmakefile')
-rw-r--r--docs/GNUmakefile68
1 files changed, 68 insertions, 0 deletions
diff --git a/docs/GNUmakefile b/docs/GNUmakefile
new file mode 100644
index 0000000..f1b80aa
--- /dev/null
+++ b/docs/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*