makefile.mk (1356B)
1 .PHONY: libriot libriot-build libriot-test 2 3 LIBRIOT_MAJOR := 0 4 LIBRIOT_MINOR := 1 5 LIBRIOT_PATCH := 0 6 LIBRIOT_VERSION := $(LIBRIOT_MAJOR).$(LIBRIOT_MINOR).$(LIBRIOT_PATCH) 7 8 LIBRIOT_CFLAGS := \ 9 $(CFLAGS) \ 10 $(CPPFLAGS) \ 11 -DLIBRIOT_VERSION_MAJOR="\"$(LIBRIOT_MAJOR)"\" \ 12 -DLIBRIOT_VERSION_MINOR="\"$(LIBRIOT_MINOR)"\" \ 13 -DLIBRIOT_VERSION_PATCH="\"$(LIBRIOT_PATCH)"\" \ 14 -DLIBRIOT_VERSION="\"$(LIBRIOT_VERSION)"\" \ 15 -Ilibriot/include 16 17 LIBRIOT_FLAGS := \ 18 $(LIBRIOT_CFLAGS) \ 19 $(LDFLAGS) 20 21 LIBRIOT_SOURCES := libriot/src/libriot.c \ 22 libriot/src/utils.c \ 23 libriot/src/wad.c \ 24 libriot/src/wad_reader.c \ 25 libriot/src/wad_writer.c \ 26 libriot/src/wad_printer.c \ 27 libriot/src/inibin.c \ 28 libriot/src/inibin_reader.c \ 29 libriot/src/inibin_writer.c \ 30 libriot/src/inibin_printer.c 31 32 LIBRIOT_OBJECTS := $(LIBRIOT_SOURCES:%.c=$(OBJ)/%.c.o) 33 LIBRIOT_OBJDEPS := $(LIBRIOT_OBJECTS:%.o=%.d) 34 35 -include $(LIBRIOT_OBJDEPS) 36 37 $(LIBRIOT_OBJECTS): $(OBJ)/%.c.o: %.c | $(OBJ) 38 @mkdir -p $(shell dirname $@) 39 $(CC) -MMD -o $@ -c $< $(LIBRIOT_CFLAGS) 40 41 $(LIB)/libriot.a: libriot-deps $(LIBRIOT_OBJECTS) | $(LIB) 42 @mkdir -p $(shell dirname $@) 43 $(AR) -rcs $@ $(wordlist 2,$(words $^),$^) 44 45 libriot-deps: 46 47 libriot-build: $(LIB)/libriot.a 48 49 libriot-test-deps: 50 51 libriot-test: 52 53 libriot: libriot-build libriot-test