Makefile 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. CC = gcc
  2. CC_FLAGS = -Wall -O3 -std=c99 -I../elfclib/include
  3. LN_FLAGS = -lm -L../elfclib/bin -lelfc
  4. # ----------------------------------------------------------------------------
  5. # Testing
  6. ifneq "$(findstring test, $(MAKECMDGOALS))" ""
  7. SRC_FILES = $(wildcard test/test.c)
  8. else
  9. SRC_FILES = $(wildcard src/*.c)
  10. endif
  11. ifeq ($(BOUNDS_CHECK), 1)
  12. CC_FLAGS += -DBOUNDS_CHECK
  13. endif
  14. VERSION = undefined
  15. CC_FLAGS += -DVERSION='"$(VERSION)"'
  16. # ----------------------------------------------------------------------------
  17. INCLUDES = -I src/
  18. SRC_FILES += $(wildcard src/group/*.c) \
  19. $(wildcard src/application/*.c)
  20. OBJ_FILES = $(addprefix bin/,$(notdir $(SRC_FILES:.c=.o)))
  21. DEP_FILES = $(OBJ_FILES:.o=.d)
  22. BIN = ./bin/asoc
  23. TEST = ./bin/testasoc
  24. all: $(BIN)
  25. test: $(TEST)
  26. $(BIN): $(OBJ_FILES)
  27. $(CC) $^ $(LN_FLAGS) -o $@
  28. $(TEST): $(OBJ_FILES)
  29. $(CC) $^ $(LN_FLAGS) -o $@
  30. -include $(DEP_FILES)
  31. # ----------------------------------------------------------------------------
  32. bin/%.o: test/%.c
  33. $(CC) $(CC_FLAGS) $(INCLUDES) -MMD -c $< -o $@
  34. bin/%.o: src/%.c
  35. $(CC) $(CC_FLAGS) $(INCLUDES) -MMD -c $< -o $@
  36. bin/%.o: src/group/%.c
  37. $(CC) $(CC_FLAGS) $(INCLUDES) -MMD -c $< -o $@
  38. bin/%.o: src/application/%.c
  39. $(CC) $(CC_FLAGS) $(INCLUDES) -MMD -c $< -o $@
  40. clean:
  41. -rm ./bin/*