# Standard housekeeping .PHONY: all debug release clean target install .SUFFIXES: all: targets debug: CC := clang debug: CFLAGS += -DDEBUG -g -fsanitize=address debug: INCS := -I $(INC_DIR) debug: ELIBS := -fsanitize=address debug: STATIC := debug: CINIT := debug: CFINI := debug: targets release: CFLAGS += -O3 -mtune=native -flto -ffast-math #-DNDEBUG release: targets # Targets & array of sources & intermediates SRCS := OBJS := DEPS := LIBS := BINS := UNTS := GENS := # Iterate through directory tree DIR := sys include $(DIR)/rules.mk # DIR := src # include $(DIR)/rules.mk # Generic rules %.a: %.o $(ARCHIVE) %: %.o $(LINK) $(OBJ_DIR)/%.o: %.c $(COMPILE) $(OBJ_DIR)/%.o: %.s $(ASSEMBLE) $(OBJ_DIR)/%: %.c $(COMPLNK) targets: $(LIBS) $(BINS) $(UNTS) clean: @echo removing object files @rm -f $(OBJS) @echo removing dependency files @rm -f $(DEPS) @echo removing generated source files @rm -f $(GENS) @echo removing libraries @rm -f $(LIBS) @echo removing binaries @rm -f $(BINS) @echo removing unit tests @rm -f $(UNTS) install: targets @echo installing executables @if [ -n $$BINS ]; then\ cp $(BINS) $(BIN_DIR); \ fi @echo installing libraries @if [ -n $$LIBS ]; then\ cp $(LIBS) $(LIB_DIR); \ fi database: compiledb make -j4