hop-2012/experiments/cmsg/Makefile

46 lines
1.1 KiB
Makefile
Raw Normal View History

2010-12-27 21:56:42 +00:00
TARGET = cmsg
2011-01-02 22:56:11 +00:00
OBJECTS = main.o harness.o net.o util.o relay.o hashtable.o dataq.o sexp.o sexpio.o node.o \
2011-01-10 00:42:36 +00:00
queue.o direct.o fanout.o subscription.o meta.o messages.o
2010-12-27 21:56:42 +00:00
2011-01-02 02:30:03 +00:00
UUID_CFLAGS:=$(shell uuid-config --cflags)
UUID_LDFLAGS:=$(shell uuid-config --ldflags)
# grr
ifeq ($(shell uname -s),Darwin)
UUID_LIB=uuid
else
UUID_LIB=ossp-uuid
endif
2011-01-02 17:27:17 +00:00
#CFLAGS = -D_XOPEN_SOURCE=600 -Wall -O0 -g $(UUID_CFLAGS)
CFLAGS = -D_XOPEN_SOURCE=600 -Wall -O3 $(UUID_CFLAGS)
2011-01-02 02:30:03 +00:00
#CFLAGS = -D_XOPEN_SOURCE=600 -Wall -O3 -static $(UUID_CFLAGS)
2010-12-27 21:56:42 +00:00
all: $(TARGET)
$(TARGET): $(OBJECTS)
2011-01-02 02:30:03 +00:00
$(CC) $(CFLAGS) $(UUID_LDFLAGS) -o $@ $(OBJECTS) -l$(UUID_LIB) -levent
# $(CC) $(CFLAGS) $(UUID_LDFLAGS) -o $@ $(OBJECTS) -l$(UUID_LIB) -levent -lrt
2010-12-27 21:56:42 +00:00
%.o: %.c
$(CC) $(CFLAGS) -c $<
messages.c: ../../protocol/messages.json codegen.py
2011-01-10 00:42:36 +00:00
python codegen.py body > $@
messages.h: ../../protocol/messages.json codegen.py
2011-01-10 00:42:36 +00:00
python codegen.py header > $@
2010-12-27 21:56:42 +00:00
clean:
rm -f $(TARGET)
rm -f $(OBJECTS)
rm -rf *.dSYM
2011-01-10 00:42:36 +00:00
rm -f depend.mk messages.c messages.h
depend.mk:
2011-01-10 00:42:36 +00:00
touch messages.h
gcc $(CFLAGS) -M *.c > $@
2011-01-10 00:42:36 +00:00
rm messages.h
echo "depend.mk:" Makefile *.c >> $@
-include depend.mk