ORIG_SOURCES := $(shell sed -n 's@^/@@;s@/.*@@p' CVS/Entries)
GEN_DAEMON := daemon-opts.c daemon-opts.h
DAEMON_SRC := daemon.c daemon-opts.c
DAEMON_OBJ := $(DAEMON_SRC:.c=.o)
GEN_EDIT := edit-daemon-conf.c edit-daemon-conf.h
EDIT_SRC := edit-daemon-conf.c
EDIT_OBJ := $(EDIT_SRC:.c=.o)
GEN_SOURCE := $(GEN_DAEMON) $(GEN_EDIT)
GEN_C := edit-daemon-conf.c daemon-opts.c
AOLIB := $(shell autoopts-config ldflags)
AOINC := $(shell autoopts-config cflags)
EXE := daemon edit-daemon-conf
OBJECTS := $(DAEMON_OBJ) $(EDIT_OBJ)
default : $(GEN_C)
all : $(EXE)
daemon : $(DAEMON_SRC:.c=.o)
cc -g -o $@ $(DAEMON_SRC:.c=.o) $(AOLIB)
edit-daemon-conf : $(EDIT_SRC:.c=.o)
cc -g -o $@ $(EDIT_SRC:.c=.o) $(AOLIB)
clean :
rm -f *~
clobber :
@-list=$$(allbut * - $(ORIG_SOURCES) CVS) ; \
test $${#list} -gt 0 && rm -rf $${list}
source-list : clobber
echo [a-z]* Makefile
$(GEN_EDIT) : config_edit.stamp
config_edit.stamp : editor.def editor.tpl daemon-opts.def
( echo 'autogen definitions options;' ; \
echo 'prog-name = edit-daemon-conf;' ; \
echo '#include editor.def' ; \
echo '#include daemon-opts.def' ; \
) | autogen -L `pwd` -b edit-daemon-conf
touch $@
$(GEN_DAEMON) : daemon-opts.def
autogen $<
$(OBJECTS) : %.o : %.c $(GEN_SOURCE)
cc -g -c $(AOINC) -o $@ $<
.c.o:
cc -g -c $(AOINC) -o $@ $<