# Standard housekeeping .PHONY: all debug release clean target install .SUFFIXES: all: targets debug: CFLAGS += -DDEBUG debug: targets release: CFLAGS += -O3 -flto #-DNDEBUG release: targets # Targets & array of sources & intermediates SRCS := OBJS := DEPS := LIBS := BINS := TSTS := # Iterate through directory tree DIR := sys include $(DIR)/rules.mk # Generic rules %.a: %.o $(ARCHIVE) $(OBJ_DIR)/%.o: $(SRC_DIR)/%.c $(COMPILE) $(OBJ_DIR)/%.o: $(SRC_DIR)/%.s $(ASSEMBLE) %: %.o $(LINK) $(OBJ_DIR)/%: $(SRC_DIR)/%.c $(COMPLNK) targets: $(LIBS) $(BINS) $(TSTS) clean: rm -f $(OBJS) rm -f $(DEPS) rm -f $(LIBS) rm -f $(BINS) rm -f $(TSTS) install: targets @echo installing executables @if [ -n "$$BINS" ]; then\ mv $(BINS) $(BIN_DIR); \ fi @echo installing libraries @if [ -n "$$LIBS" ]; then\ cp $(LIBS) $(LIB_DIR); \ fi