Makefile 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. SOURCES = $(wildcard *.c)
  2. DEPS=libtoxcore libsodium libevent_pthreads
  3. CC=gcc
  4. CFLAGS=-g -Wall #-std=c99
  5. CFLAGS += $(shell pkg-config --cflags $(DEPS))
  6. LDFLAGS=-g -pthread -lm -static -lrt
  7. LDFLAGS += $(shell pkg-config --static --libs $(DEPS))
  8. DSO_LDFLAGS=-g -pthread -lm -lrt
  9. DSO_LDFLAGS += $(shell pkg-config --libs $(DEPS))
  10. OBJECTS=$(SOURCES:.c=.o)
  11. INCLUDES = $(wildcard *.h)
  12. # Targets
  13. all: tuntox
  14. gitversion.h: FORCE
  15. @if [ -f .git/HEAD ] ; then echo " GEN $@"; echo "#define GITVERSION \"$(shell git rev-parse HEAD)\"" > $@; fi
  16. FORCE:
  17. tox_bootstrap.h:
  18. python generate_tox_bootstrap.py
  19. %.o: %.c $(INCLUDES) gitversion.h tox_bootstrap.h
  20. @echo " CC $@"
  21. @$(CC) -c $(CFLAGS) $< -o $@
  22. tuntox: $(OBJECTS) $(INCLUDES)
  23. $(CC) -o $@ $(OBJECTS) -lpthread $(LDFLAGS)
  24. tuntox_nostatic: $(OBJECTS) $(INCLUDES)
  25. $(CC) -o $@ $(OBJECTS) -lpthread $(DSO_LDFLAGS)
  26. cscope.out:
  27. @echo " GEN $@"
  28. @cscope -bv ./*.[ch] &> /dev/null
  29. clean:
  30. rm -f *.o tuntox cscope.out gitversion.h tox_bootstrap.h
  31. .PHONY: all clean tuntox