# # Makefile # Ilja KartaĊĦov, 2019-03-02 17:32 # .POSIX: # Project directories SRC_DIR ?= src SDK_DIR ?= sdk CSTUFF_DIR ?= cStuff OUT_DIR ?= ./build # Project definition include project.mk # CFLAGS CFLAGS := \ $(PROJECT_INCLUDES) \ -std=c99 \ -pedantic \ -Wall \ -Wmissing-prototypes \ -Wstrict-prototypes \ -Wold-style-definition \ -O2 \ -s \ -fvisibility=hidden \ -DVERSION_MAJOR=$(PROJECT_VERSION_MAJOR) \ -DVERSION_MINOR=$(PROJECT_VERSION_MINOR) \ -DVERSION_TWEAK=$(PROJECT_VERSION_TWEAK) \ -DVERSION_LABEL=$(PROJECT_VERSION_LABEL) \ $(PROJECT_CFLAGS) \ $(CFLAGS) \ LDFLAGS := \ $(PROJECT_LIBRARIES) \ $(LDFLAGS) \ $(PROJECT_LDFLAGS) \ SOURCE_LIST := $(wildcard $(PROJECT_SOURCES)) OBJECT_FILES := $(addprefix $(OUT_DIR)/o_, ${SOURCE_LIST:.c=.o}) project: dirs $(OBJECT_FILES) $(info linking target: $@) @$(CC) -o $(OUT_DIR)/$(PROJECT_NAME) $(OBJECT_FILES) $(LDFLAGS) $(info done: $@) build/o_%.o: %.c $(info compiling file: $<) @$(CC) $(CFLAGS) -c $< -o $@ dirs: $(info preparing: build folders) @mkdir -p $(OUT_DIR)/o_$(SRC_DIR) @mkdir -p $(OUT_DIR)/o_$(CSTUFF_DIR) @mkdir -p $(OUT_DIR)/o_$(SDK_DIR)/components @mkdir -p $(OUT_DIR)/o_$(SDK_DIR)/mods clean: $(info cleaning: build files) @rm -Rf $(OUT_DIR) @rm -Rf ./vgcore.* all: project default: project .PHONY: all dirs clean # vim:ft=make #