add cookie to self
[fillybot.git] / Makefile
blobfea9afea7ae28bc9a75cf8a592770ac8a088110b
1 all: fillybot mod.so
3 CFLAGS ?= -Wall -Wno-pointer-sign -g -O0 `pkg-config libxml-2.0 --cflags` -Werror -std=gnu99 -fstack-protector-all
4 LDFLAGS ?= -lssl -lbfd -ldl -Wl,-rpath=`pwd` -liberty -pie -fPIE
5 OBJS := main.o crash.o backtrace-symbols.o
6 MODS := mod.O entities.O
7 MOD_LDFLAGS ?= -lcurl `pkg-config libxml-2.0 --libs` -lmagic -ltdb
8 LIBRARY_DEFINES =
10 -include local.mk
12 SHARED_HEADERS = shared.h owner.h
13 MOD_HEADERS = $(SHARED_HEADERS) entities.h mod.h
14 CORE_HEADERS = $(SHARED_HEADERS) mod.h core.h
16 owner.h: Makefile
17 @echo "static char owner[] = \"`whoami`\";" > owner.h
19 local.c:
20 touch local.c
22 %.o: %.c $(CORE_HEADERS)
23 @echo CC $<
24 @$(CC) -c $(INCLUDES) $(CFLAGS) -fPIE $(LIBRARY_DEFINES) $< -o $@
26 %.o: %.cpp $(CORE_HEADERS)
27 @echo CXX $<
28 @$(CXX) -c $(INCLUDES) $(CXXFLAGS) -fPIE $(LIBRARY_DEFINES) $< -o $@
30 %.O: %.c $(MOD_HEADERS)
31 @echo CC $<
32 @$(CC) -c $(INCLUDES) $(CFLAGS) -Wno-unused-result -fPIC $(LIBRARY_DEFINES) $< -o $@
34 mod.O:: local.c
36 fillybot: $(OBJS)
37 @echo LD $@
38 @$(CC) $(CFLAGS) $(OBJS) $(LDFLAGS) -o $@
40 mod.so: $(MODS)
41 @echo LD $@
42 @$(CC) $(CFLAGS) -fPIC -shared $(MODS) $(MOD_LDFLAGS) -o $@
44 clean:
45 rm -f fillybot mod.so *.o *.O *~ owner.h