Makefile 1006 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  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: .git/HEAD .git/index
  15. @echo " GEN $@"
  16. @echo "#define GITVERSION \"$(shell git rev-parse HEAD)\"" > $@
  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