CC=gcc CFLAGS=-Wall -g -ggdb3 -I/usr/include/ClearSilver -I$(PWD)/evapporate.build -I$(PWD) SRC := $(wildcard *.c) HANDLER_SRC := $(wildcard handlers/*.c) SRC += $(HANDLER_SRC) GEN_SRC := $(wildcard evapporate.build/*.c) SRC += $(GEN_SRC) OBJ=$(patsubst %.c,%.o,$(SRC)) LIBS = -levapp -levapp_util -levapp_scaffold -levent -levent_extra -lc -lrt -ldb -lpthread -lneo_cgi -lneo_cs -lneo_utl # Explicit rule # all: generate make -C . appd generate: evapporate generate appd: $(OBJ) $(CC) $(CFLAGS) -o appd $(OBJ) $(LIBS) .SUFFIXES: .o .c .c.o: ifeq ($(strip $(GEN_SRC)),) @echo "Run make generate first!" 1>&2 kill $$$$ else $(CC) -c $(CFLAGS) $< -o $@ endif clean: rm -rf evapporate.build rm appd find ./ -name '*.o' -type f -exec rm \{\} \; .PHONY: generate clean all