mirror of
https://github.com/Polprzewodnikowy/SummerCart64.git
synced 2024-11-23 14:29:14 +01:00
38 lines
844 B
Makefile
38 lines
844 B
Makefile
SRC_DIRS = src
|
|
INC_DIRS = inc
|
|
OUTPUT_DIR = lib
|
|
BUILD_DIR = output/$(LIB_BUILD_DIR)
|
|
|
|
SRC_FILES = boot.c control.c gpio.c helpers.c init.c io_dma.c save.c sd.c usb.c
|
|
|
|
CFLAGS += -ffunction-sections -fdata-sections -Os -Wall -MMD -MP $(patsubst %, -I%, $(INC_DIRS))
|
|
|
|
OBJS = $(addprefix $(BUILD_DIR)/, $(notdir $(SRC_FILES:.c=.o)))
|
|
DEPS = $(OBJS:.o=.d)
|
|
|
|
VPATH = $(SRC_DIRS)
|
|
|
|
all: create_build_dirs $(OUTPUT_DIR)/$(LIB_NAME).a
|
|
|
|
create_build_dirs: $(OUTPUT_DIR) $(BUILD_DIR)
|
|
|
|
$(OUTPUT_DIR):
|
|
mkdir -p ./$(OUTPUT_DIR)
|
|
|
|
$(BUILD_DIR):
|
|
mkdir -p ./$(BUILD_DIR)
|
|
|
|
$(BUILD_DIR)/%.o: %.c
|
|
$(COMPILE.c) $(OUTPUT_OPTION) $<
|
|
|
|
$(OUTPUT_DIR)/$(LIB_NAME).a: $(OBJS)
|
|
$(AR) -rcs -o $@ $(OBJS)
|
|
|
|
clean:
|
|
rm -rf ./$(BUILD_DIR) 2> /dev/null
|
|
rm -rf ./$(OUTPUT_DIR) 2> /dev/null
|
|
|
|
.PHONY: all clean create_build_dirs
|
|
|
|
-include $(DEPS)
|