install.sh: expand @cfg_name@ in processed scripts
[girocco.git] / src / GNUmakefile
blobf4714e955cdf4312f58a78c58ca603eaffe4c7bb
1 CC ?= cc
2 CFLAGS ?= -O
4 .PHONY : all clean install FORCE
6 all : can_user_push can_user_push_http getent get_sun_path_len get_user_uuid \
7 list_packs peek_packet rangecgi readlink strftime throttle ulimit512 ltsha256 ltsha1
9 clean :
10 rm -rf can_user_push.o* can_user_push.d* can_user_push
11 rm -rf can_user_push_http.o* can_user_push_http.d* can_user_push_http
12 rm -rf getent.o* getent.d* getent
13 rm -rf get_sun_path_len.o* get_sun_path_len.d* get_sun_path_len
14 rm -rf get_user_uuid.o* get_user_uuid.d* get_user_uuid
15 rm -rf list_packs.o* list_packs.d* list_packs.inc list_packs
16 rm -rf peek_packet.o* peek_packet.d* peek_packet
17 rm -rf rangecgi.o* rangecgi.d* rangecgi
18 rm -rf readlink.o* readlink.d* readlink
19 rm -rf strftime.o* strftime.d* strftime
20 rm -rf throttle.o* throttle.d* throttle
21 rm -rf ulimit512.o* ulimit512.d* ulimit512
22 rm -rf ltsha256.o* ltsha256.d* ltsha256
23 rm -rf ltsha1.o* ltsha1.d* ltsha1
24 rm -f config.h GROUP-FILE PASSWD-FILE SOCKET-FILE
26 install :
28 test : ltsha256 ltsha1
29 ./ltsha256-test.sh | awk 'BEGIN{c=0} {print} /^ok [0-9]/{++c} END{if(NR!=c+1)exit 1}'
30 ./ltsha1-test.sh | awk 'BEGIN{c=0} {print} /^ok [0-9]/{++c} END{if(NR!=c+1)exit 1}'
32 GET_CONFIG = cd .. && test ! -f config.sh || . ./config.sh && . ./shlib.sh
34 TRACK_GROUP_FILE := $(shell $(GET_CONFIG) && echo "$$cfg_chroot/etc/group")
35 export TRACK_GROUP_FILE
36 TRACK_PASSWD_FILE := $(shell $(GET_CONFIG) && echo "$$cfg_chroot/etc/passwd")
37 export TRACK_PASSWD_FILE
38 TRACK_SOCKET_FILE := $(shell $(GET_CONFIG) && echo "$$cfg_chroot/etc/taskd.socket")
39 export TRACK_SOCKET_FILE
41 GROUP-FILE: FORCE
42 @if test x"$$TRACK_GROUP_FILE" != x"`cat GROUP-FILE 2>/dev/null`"; then \
43 echo "* new group file location"; \
44 echo "$$TRACK_GROUP_FILE" >GROUP-FILE; \
47 PASSWD-FILE: FORCE
48 @if test x"$$TRACK_PASSWD_FILE" != x"`cat PASSWD-FILE 2>/dev/null`"; then \
49 echo "* new passwd file location"; \
50 echo "$$TRACK_PASSWD_FILE" >PASSWD-FILE; \
53 SOCKET-FILE: FORCE
54 @if test x"$$TRACK_SOCKET_FILE" != x"`cat SOCKET-FILE 2>/dev/null`"; then \
55 echo "* new taskd.pl socket file location"; \
56 echo "$$TRACK_SOCKET_FILE" >SOCKET-FILE; \
59 config.h : make-config-h.sh
60 V="$(V)" ./make-config-h.sh "$(CC)" >$@
62 can_user_push : can_user_push.c
63 $(CC) -o $@ $(CFLAGS) $?
65 can_user_push_http : can_user_push_http.c GROUP-FILE
66 $(CC) -o $@ $(CFLAGS) -D"GROUP_FILE=\"$(TRACK_GROUP_FILE)\"" can_user_push_http.c
68 getent : getent.c
69 $(CC) -o $@ $(CFLAGS) $?
71 get_sun_path_len : get_sun_path_len.c
72 $(CC) -o $@ $(CFLAGS) get_sun_path_len.c
74 get_user_uuid : get_user_uuid.c PASSWD-FILE
75 $(CC) -o $@ $(CFLAGS) -D"PASSWD_FILE=\"$(TRACK_PASSWD_FILE)\"" get_user_uuid.c
77 list_packs.inc : list_packs.txt
78 sed -e 's/\([\\"]\)/\\\1/g;s/^/"/;s/$$/\\n"/' $< >$@
80 list_packs : list_packs.c list_packs.inc
81 $(CC) -o $@ $(CFLAGS) list_packs.c
83 peek_packet : config.h peek_packet.c
84 $(CC) -o $@ $(CFLAGS) -DCONFIG_H='"config.h"' peek_packet.c
86 rangecgi : rangecgi.c
87 $(CC) -o $@ $(CFLAGS) rangecgi.c
89 readlink : readlink.c
90 $(CC) -o $@ $(CFLAGS) readlink.c
92 strftime : strftime.c
93 $(CC) -o $@ $(CFLAGS) strftime.c
95 throttle : throttle.c SOCKET-FILE
96 $(CC) -o $@ $(CFLAGS) -D"SOCKET_FILE=\"$(TRACK_SOCKET_FILE)\"" throttle.c
98 ulimit512 : config.h ulimit512.c
99 $(CC) -o $@ $(CFLAGS) -DCONFIG_H='"config.h"' ulimit512.c
101 ltsha256 : ltsha256.c lt256.h lt256.c
102 $(CC) -o $@ $(CFLAGS) ltsha256.c
104 ltsha1 : ltsha1.c lt1.h lt1.c
105 $(CC) -o $@ $(CFLAGS) ltsha1.c