diff options
Diffstat (limited to 'Makefile')
-rw-r--r-- | Makefile | 18 |
1 files changed, 10 insertions, 8 deletions
@@ -8,18 +8,20 @@ CLINKS += -lc -lpthread # Where to build stuff BLDDIR ?= build TSTDIR ?= $(BLDDIR)/tests +# Library files +LIBFS = include/c_headers/include/container.h include/c_headers/include/rstypes.h -# This variable's value is NOT checked, only it's existence is checked. -# If you define it as `DEBUG = Off`, it will still build in debug mode -DEBUG = On +# TODO: remove in production build +DEBUG ?= 1 -ifdef $(DEBUG) - CFLAGS += -DDBG -ggdb -g +ifeq ($(DEBUG), 1) + CFLAGS += -DDBG -DLOG_DEBUG -ggdb -g endif .PHONY: clean all tests run_tests all: $(BLDDIR) $(BLDDIR)/server $(BLDDIR)/client tests + @echo DEBUG=$(DEBUG), CFLAGS=$(CFLAGS) $(BLDDIR): mkdir -p $(BLDDIR) @@ -32,15 +34,15 @@ $(BLDDIR)/packet.o: include/packet.c $(CC) -c $< $(CFLAGS) $(CLIBS) -o $@ # Server object files -$(BLDDIR)/s_%.o: server/%.c +$(BLDDIR)/s_%.o: server/%.c $(LIBFS) $(CC) -c $< $(CFLAGS) $(CLIBS) -o $@ # client object files -$(BLDDIR)/c_%.o: client/%.c +$(BLDDIR)/c_%.o: client/%.c $(LIBFS) $(CC) -c $< $(CFLAGS) $(CLIBS) -o $@ # test object files -$(TSTDIR)/%.o: test/%.c +$(TSTDIR)/%.o: test/%.c $(LIBFS) $(CC) -c $< $(CFLAGS) $(CLIBS) -o $@ # server executable |