buildtools/make_base

457 lines
14 KiB
Text
Raw Normal View History

2016-01-29 23:59:57 +00:00
# PROLOGUE #
2016-05-04 03:31:38 +00:00
ifeq ($(TARGET),$(filter $(TARGET),3DS WIIU))
ifeq ($(strip $(DEVKITPRO)),)
$(error "Please set DEVKITPRO in your environment. export DEVKITPRO=<path to>devkitPro")
endif
2016-05-04 03:31:38 +00:00
endif
2016-01-27 03:05:18 +00:00
2016-05-04 03:31:38 +00:00
ifeq ($(TARGET),3DS)
ifeq ($(strip $(DEVKITARM)),)
$(error "Please set DEVKITARM in your environment. export DEVKITARM=<path to>devkitARM")
endif
2016-01-27 03:05:18 +00:00
endif
2016-05-04 03:31:38 +00:00
ifeq ($(TARGET),WIIU)
ifeq ($(strip $(DEVKITPPC)),)
$(error "Please set DEVKITPPC in your environment. export DEVKITPPC=<path to>devkitPPC")
endif
endif
2016-01-27 03:05:18 +00:00
# TOOLS #
BUILDTOOLS_DIR := $(dir $(lastword $(MAKEFILE_LIST)))
define createdirrule
$(1): | $(dir $(1))
ifndef $(dir $(1))_DIRECTORY_RULE_IS_DEFINED
$(dir $(1)):
@mkdir -p $$@
$(dir $(1))_DIRECTORY_RULE_IS_DEFINED := 1
endif
endef
rwildcard=$(wildcard $1/$2) $(foreach d,$(wildcard $1/*),$(call rwildcard,$d,$2))
2016-01-29 23:59:57 +00:00
# INITIAL COMMON SETUP #
2016-01-27 03:05:18 +00:00
2016-01-27 04:35:52 +00:00
EMPTY :=
SPACE := $(EMPTY) $(EMPTY)
STRIPPED_NAME := $(subst $(SPACE),,$(NAME))
2016-04-13 02:41:47 +00:00
BUILT_FILTER := $(patsubst %.bin,$(BUILD_DIR)/%.bin.o,$(BUILD_FILTER)) \
$(patsubst %.c,$(BUILD_DIR)/%.o,$(BUILD_FILTER)) \
$(patsubst %.cpp,$(BUILD_DIR)/%.o,$(BUILD_FILTER)) \
$(patsubst %.s,$(BUILD_DIR)/%.o,$(BUILD_FILTER))
2016-01-27 03:05:18 +00:00
OBJECT_FILES := $(foreach dir,$(SOURCE_DIRS), \
$(patsubst %.bin,$(BUILD_DIR)/%.bin.o,$(call rwildcard,$(dir),*.bin)) \
$(patsubst %.c,$(BUILD_DIR)/%.o,$(call rwildcard,$(dir),*.c)) \
$(patsubst %.cpp,$(BUILD_DIR)/%.o,$(call rwildcard,$(dir),*.cpp)) \
$(patsubst %.s,$(BUILD_DIR)/%.o,$(call rwildcard,$(dir),*.s)) \
2016-01-27 03:05:18 +00:00
)
2016-04-13 02:41:47 +00:00
OBJECT_FILES := $(filter-out $(BUILT_FILTER),$(OBJECT_FILES))
OUTPUT_ZIP_FILE ?= $(OUTPUT_DIR)/$(STRIPPED_NAME).zip
2016-01-27 03:05:18 +00:00
LD_FLAGS := $(patsubst %,-L%/lib,$(LIBRARY_DIRS)) $(patsubst %,-l%,$(LIBRARIES))
COMMON_CC_FLAGS := $(sort $(foreach dir,$(SOURCE_DIRS),$(patsubst %,-I$(BUILD_DIR)/%,$(dir $(call rwildcard,$(dir),*))))) $(patsubst %,-I%,$(INCLUDE_DIRS)) $(patsubst %,-I%/include,$(LIBRARY_DIRS)) -g -Wall $(BUILD_FLAGS)
ifeq ($(findstring -O,$(BUILD_FLAGS)),)
COMMON_CC_FLAGS += -O2
endif
2016-01-29 23:59:57 +00:00
# COMMON LIBRARY SETUP #
ifeq ($(LIBRARY),1)
2016-05-04 23:09:15 +00:00
STRIPPED_NAME := lib$(STRIPPED_NAME)
EXTRA_OUTPUT_FILES += $(INCLUDE_DIRS)
2016-01-27 03:05:18 +00:00
endif
2016-01-29 23:59:57 +00:00
# TARGET SETUP #
2016-01-27 03:05:18 +00:00
ifeq ($(TARGET),3DS)
2016-04-13 02:41:47 +00:00
BUILT_FILTER := $(patsubst %.v.pica,$(BUILD_DIR)/%.shbin.o,$(BUILD_FILTER)) \
$(patsubst %.shlist,$(BUILD_DIR)/%.shbin.o,$(BUILD_FILTER)) \
OBJECT_FILES := $(foreach dir,$(SOURCE_DIRS), \
$(patsubst %.v.pica,$(BUILD_DIR)/%.shbin.o,$(call rwildcard,$(dir),*.v.pica)) \
$(patsubst %.shlist,$(BUILD_DIR)/%.shbin.o,$(call rwildcard,$(dir),*.shlist)) \
) $(OBJECT_FILES)
2016-04-13 02:41:47 +00:00
OBJECT_FILES := $(filter-out $(BUILT_FILTER),$(OBJECT_FILES))
ifeq ($(strip $(TITLE)),)
TITLE := $(NAME)
endif
REMOTE_IP ?= 127.0.0.1 # User-defined
AR := $(DEVKITARM)/bin/arm-none-eabi-ar
AS := $(DEVKITARM)/bin/arm-none-eabi-as
CC := $(DEVKITARM)/bin/arm-none-eabi-gcc
CXX := $(DEVKITARM)/bin/arm-none-eabi-g++
2016-02-15 05:44:09 +00:00
PICASSO := $(DEVKITARM)/bin/picasso
SMDHTOOL := $(DEVKITARM)/bin/smdhtool
_3DSXTOOL := $(DEVKITARM)/bin/3dsxtool
_3DSLINK := $(DEVKITARM)/bin/3dslink
ifeq ($(OS),Windows_NT)
MAKEROM := $(BUILDTOOLS_DIR)/3ds/makerom.exe
BANNERTOOL := $(BUILDTOOLS_DIR)/3ds/bannertool.exe
CITRA := $(BUILDTOOLS_DIR)/3ds/citra/citra.exe
else
UNAME_S := $(shell uname -s)
ifeq ($(UNAME_S),Linux)
MAKEROM := $(BUILDTOOLS_DIR)/3ds/makerom-linux
BANNERTOOL := $(BUILDTOOLS_DIR)/3ds/bannertool-linux
CITRA := $(BUILDTOOLS_DIR)/3ds/citra/citra-linux
endif
ifeq ($(UNAME_S),Darwin)
MAKEROM := $(BUILDTOOLS_DIR)/3ds/makerom-mac
BANNERTOOL := $(BUILDTOOLS_DIR)/3ds/bannertool-mac
CITRA := $(BUILDTOOLS_DIR)/3ds/citra/citra-mac
endif
endif
ifeq ($(LIBRARY),1)
2016-05-04 23:09:15 +00:00
OUTPUT_FILES := $(OUTPUT_DIR)/lib/$(STRIPPED_NAME).a
else
OUTPUT_FILES := $(OUTPUT_DIR)/$(STRIPPED_NAME).elf $(OUTPUT_DIR)/3ds/$(STRIPPED_NAME)/$(STRIPPED_NAME).smdh $(OUTPUT_DIR)/3ds/$(STRIPPED_NAME)/$(STRIPPED_NAME).3dsx $(OUTPUT_DIR)/$(STRIPPED_NAME).3ds $(OUTPUT_DIR)/$(STRIPPED_NAME).cia
endif
LD_FLAGS += -specs=3dsx.specs
COMMON_CC_FLAGS += -mword-relocations -fomit-frame-pointer -ffast-math -march=armv6k -mtune=mpcore -mfloat-abi=hard -mtp=soft -DARM11 -D_3DS
_3DSXTOOL_FLAGS :=
COMMON_MAKEROM_FLAGS := -rsf $(BUILDTOOLS_DIR)/3ds/template.rsf -target t -exefslogo -icon $(BUILD_DIR)/icon.icn -banner $(BUILD_DIR)/banner.bnr -DAPP_TITLE="$(TITLE)" -DAPP_PRODUCT_CODE="$(PRODUCT_CODE)" -DAPP_UNIQUE_ID="$(UNIQUE_ID)" -DAPP_SYSTEM_MODE="$(SYSTEM_MODE)" -DAPP_SYSTEM_MODE_EXT="$(SYSTEM_MODE_EXT)"
ifneq ("$(wildcard $(ROMFS_DIR))","")
_3DSXTOOL_FLAGS += --romfs=$(ROMFS_DIR)
2016-02-15 05:16:26 +00:00
COMMON_MAKEROM_FLAGS += -DAPP_ROMFS="$(ROMFS_DIR)"
endif
ifeq ($(suffix $(BANNER_IMAGE)),.cgfx)
BANNER_IMAGE_ARG := -ci
else
BANNER_IMAGE_ARG := -i
endif
ifeq ($(suffix $(BANNER_AUDIO)),.cwav)
BANNER_AUDIO_ARG := -ca
else
BANNER_AUDIO_ARG := -a
endif
2016-05-04 03:31:38 +00:00
else ifeq ($(TARGET),WIIU)
2016-05-09 23:51:08 +00:00
REMOTE_IP ?= 127.0.0.1 # User-defined
2016-05-04 03:31:38 +00:00
AR := $(DEVKITPPC)/bin/powerpc-eabi-ar
AS := $(DEVKITPPC)/bin/powerpc-eabi-as
CC := $(DEVKITPPC)/bin/powerpc-eabi-gcc
CXX := $(DEVKITPPC)/bin/powerpc-eabi-g++
2016-05-09 23:51:08 +00:00
WIILOAD_BIN := $(DEVKITPPC)/bin/wiiload
2016-05-04 03:31:38 +00:00
ifeq ($(LIBRARY),1)
2016-05-04 23:09:15 +00:00
OUTPUT_FILES := $(OUTPUT_DIR)/lib/$(STRIPPED_NAME).a
2016-05-04 03:31:38 +00:00
else
OUTPUT_FILES := $(OUTPUT_DIR)/wiiu/apps/$(STRIPPED_NAME)/$(STRIPPED_NAME).elf $(OUTPUT_DIR)/wiiu/apps/$(STRIPPED_NAME)/meta.xml $(OUTPUT_DIR)/wiiu/apps/$(STRIPPED_NAME)/icon.png
endif
LD_FLAGS += -T $(BUILDTOOLS_DIR)/wiiu/wiiu.ld -Wl,-d,--gc-sections
COMMON_CC_FLAGS += -mrvl -mcpu=750 -meabi -mhard-float -ffast-math -DPPC -DWIIU
2016-01-29 23:59:57 +00:00
else
2016-05-08 18:58:52 +00:00
ifeq ($(OS),Windows_NT)
AR := ar
AS := as
CC := gcc
CXX := g++
ifeq ($(LIBRARY),1)
OUTPUT_FILES := $(OUTPUT_DIR)/lib/$(STRIPPED_NAME).a $(OUTPUT_DIR)/lib/$(STRIPPED_NAME).dll
COMMON_CC_FLAGS += -fPIC
else
OUTPUT_FILES := $(OUTPUT_DIR)/$(STRIPPED_NAME).exe
endif
else
2016-05-08 18:58:52 +00:00
ifeq ($(TARGET),WIN32)
AR := i686-w64-mingw32-ar
AS := i686-w64-mingw32-as
CC := i686-w64-mingw32-gcc
CXX := i686-w64-mingw32-g++
LD_FLAGS += -static-libstdc++ -static-libgcc -static
ifeq ($(LIBRARY),1)
OUTPUT_FILES := $(OUTPUT_DIR)/lib/$(STRIPPED_NAME).a $(OUTPUT_DIR)/lib/$(STRIPPED_NAME).dll
COMMON_CC_FLAGS += -fPIC
else
OUTPUT_FILES := $(OUTPUT_DIR)/$(STRIPPED_NAME).exe
endif
else ifeq ($(TARGET),WIN64)
AR := x86_64-w64-mingw32-ar
AS := x86_64-w64-mingw32-as
CC := x86_64-w64-mingw32-gcc
CXX := x86_64-w64-mingw32-g++
LD_FLAGS += -static-libstdc++ -static-libgcc -static
ifeq ($(LIBRARY),1)
OUTPUT_FILES := $(OUTPUT_DIR)/lib/$(STRIPPED_NAME).a $(OUTPUT_DIR)/lib/$(STRIPPED_NAME).dll
COMMON_CC_FLAGS += -fPIC
else
OUTPUT_FILES := $(OUTPUT_DIR)/$(STRIPPED_NAME).exe
endif
else
AR := ar
AS := as
CC := gcc
CXX := g++
ifeq ($(LIBRARY),1)
OUTPUT_FILES := $(OUTPUT_DIR)/lib/$(STRIPPED_NAME).a $(OUTPUT_DIR)/lib/$(STRIPPED_NAME).so
COMMON_CC_FLAGS += -fPIC
else
OUTPUT_FILES := $(OUTPUT_DIR)/$(STRIPPED_NAME)
endif
endif
endif
2016-01-27 03:05:18 +00:00
endif
2016-01-29 23:59:57 +00:00
# FINAL COMMON SETUP #
CC_FLAGS := $(COMMON_CC_FLAGS) -std=gnu99
CXX_FLAGS := $(COMMON_CC_FLAGS) -std=gnu++11
ifneq ($(EXTRA_OUTPUT_FILES),)
EXTRA_OUTPUT_COPY_CMD := cp -r $(EXTRA_OUTPUT_FILES) $(OUTPUT_DIR)
endif
2016-01-29 23:59:57 +00:00
# MAIN RULES #
2016-01-27 03:05:18 +00:00
.PHONY: all run install clean
2016-01-27 03:05:18 +00:00
.PRECIOUS: %.bnr %.icn
all: $(OUTPUT_ZIP_FILE)
2016-01-29 23:59:57 +00:00
clean:
@rm -rf $(BUILD_DIR) $(OUTPUT_DIR)
@echo "Cleaned."
# TARGET RULES #
ifeq ($(TARGET),3DS)
2016-01-29 23:59:57 +00:00
ifeq ($(LIBRARY),1)
install: $(OUTPUT_FILES) $(OUTPUT_ZIP_FILE)
2016-01-27 04:35:52 +00:00
@mkdir -p $(DEVKITPRO)/$(STRIPPED_NAME)
@unzip -o $(OUTPUT_ZIP_FILE) -d $(DEVKITPRO)/$(STRIPPED_NAME) > /dev/null
@echo "Installed."
else
run: $(OUTPUT_FILES) $(OUTPUT_ZIP_FILE)
@echo "Running..."
2016-01-27 04:35:52 +00:00
@$(CITRA) $(RUN_FLAGS) $(OUTPUT_DIR)/$(STRIPPED_NAME).elf
runhw: $(OUTPUT_FILES) $(OUTPUT_ZIP_FILE)
@echo "Running..."
@$(_3DSLINK) --address $(REMOTE_IP) $(OUTPUT_DIR)/3ds/$(STRIPPED_NAME)/$(STRIPPED_NAME).3dsx
2016-01-29 23:59:57 +00:00
endif
$(BUILD_DIR)/%.shbin.o: $(BUILD_DIR)/%.shbin.c
2016-01-29 23:59:57 +00:00
@echo $@
@$(CC) -c $(CC_FLAGS) -MMD -MP -MF $(BUILD_DIR)/$*.d $< -o $@
2016-01-29 23:59:57 +00:00
define shader-as
$(eval CURBIN := $(patsubst %.shbin.c,%.shbin,$@))
2016-02-15 05:44:09 +00:00
$(PICASSO) -o $(CURBIN) $1
@cd $(dir $(CURBIN)); \
xxd -i $(notdir $(CURBIN)) $(CURDIR)/$@
2016-01-29 23:59:57 +00:00
echo "extern const u8" `(echo $(notdir $(CURBIN)) | sed -e 's/^\([0-9]\)/_\1/' | tr . _)`"[];" >> `(echo $(CURBIN) | tr . _)`.h
echo "extern const u32" `(echo $(notdir $(CURBIN)) | sed -e 's/^\([0-9]\)/_\1/' | tr . _)`_len";" >> `(echo $(CURBIN) | tr . _)`.h
2016-01-29 23:59:57 +00:00
endef
$(BUILD_DIR)/%.shbin.c: %.v.pica %.g.pica
2016-01-29 23:59:57 +00:00
@echo $@
@$(call shader-as,$^)
$(BUILD_DIR)/%.shbin.c: %.v.pica
2016-01-29 23:59:57 +00:00
@echo $@
@$(call shader-as,$<)
$(BUILD_DIR)/%.shbin.c: %.shlist
2016-01-29 23:59:57 +00:00
@echo $@
@$(call shader-as,$(foreach file,$(shell cat $<),$(dir $<)/$(file)))
%.bnr: $(BANNER_IMAGE) $(BANNER_AUDIO)
@echo $@
@$(BANNERTOOL) makebanner $(BANNER_IMAGE_ARG) $(BANNER_IMAGE) $(BANNER_AUDIO_ARG) $(BANNER_AUDIO) -o $@ > /dev/null
%.icn: $(ICON)
@echo $@
@$(BANNERTOOL) makesmdh -s "$(TITLE)" -l "$(TITLE)" -p "$(AUTHOR)" -i $(ICON) $(ICON_FLAGS) -o $@ > /dev/null
2016-01-29 23:59:57 +00:00
%.smdh: $(ICON)
@echo $@
@$(SMDHTOOL) --create "$(TITLE)" "$(DESCRIPTION)" "$(AUTHOR)" $(ICON) $@
$(OUTPUT_DIR)/3ds/$(STRIPPED_NAME)/%.3dsx: $(OUTPUT_DIR)/%.elf $(OUTPUT_DIR)/3ds/$(STRIPPED_NAME)/%.smdh
@echo $@
@$(_3DSXTOOL) $< $@ --smdh=$(word 2,$^) $(_3DSXTOOL_FLAGS)
%.3ds: %.elf $(BUILD_DIR)/banner.bnr $(BUILD_DIR)/icon.icn
@echo $@
@$(MAKEROM) -f cci -o $@ -elf $< -DAPP_ENCRYPTED=true $(COMMON_MAKEROM_FLAGS)
%.cia: %.elf $(BUILD_DIR)/banner.bnr $(BUILD_DIR)/icon.icn
@echo $@
@$(MAKEROM) -f cia -o $@ -elf $< -DAPP_ENCRYPTED=false $(COMMON_MAKEROM_FLAGS)
2016-05-04 03:31:38 +00:00
else ifeq ($(TARGET),WIIU)
ifeq ($(LIBRARY),1)
install: $(OUTPUT_FILES) $(OUTPUT_ZIP_FILE)
@mkdir -p $(DEVKITPRO)/$(STRIPPED_NAME)
@unzip -o $(OUTPUT_ZIP_FILE) -d $(DEVKITPRO)/$(STRIPPED_NAME) > /dev/null
@echo "Installed."
2016-05-09 23:51:08 +00:00
else
runhw: $(OUTPUT_FILES) $(OUTPUT_ZIP_FILE)
@echo "Running..."
@WIILOAD=tcp:$(REMOTE_IP) $(WIILOAD_BIN) $(OUTPUT_DIR)/wiiu/apps/$(STRIPPED_NAME)/$(STRIPPED_NAME).elf $(RUN_FLAGS)
2016-05-04 03:31:38 +00:00
endif
$(OUTPUT_DIR)/wiiu/apps/$(STRIPPED_NAME)/meta.xml:
@echo $@
@cp $(BUILDTOOLS_DIR)/wiiu/meta_template.xml $(OUTPUT_DIR)/wiiu/apps/$(STRIPPED_NAME)/meta.xml
@sed -i -- 's/$$(TITLE)/$(subst /,\/,$(TITLE))/g' $(OUTPUT_DIR)/wiiu/apps/$(STRIPPED_NAME)/meta.xml
@sed -i -- 's/$$(AUTHOR)/$(subst /,\/,$(AUTHOR))/g' $(OUTPUT_DIR)/wiiu/apps/$(STRIPPED_NAME)/meta.xml
@sed -i -- 's/$$(VERSION)/$(subst /,\/,$(VERSION))/g' $(OUTPUT_DIR)/wiiu/apps/$(STRIPPED_NAME)/meta.xml
@sed -i -- 's/$$(RELEASE_DATE)/$(subst /,\/,$(shell date +'%Y%m%d%H%M%S'))/g' $(OUTPUT_DIR)/wiiu/apps/$(STRIPPED_NAME)/meta.xml
@sed -i -- 's/$$(SHORT_DESCRIPTION)/$(subst /,\/,$(DESCRIPTION))/g' $(OUTPUT_DIR)/wiiu/apps/$(STRIPPED_NAME)/meta.xml
@sed -i -- 's/$$(LONG_DESCRIPTION)/$(subst /,\/,$(LONG_DESCRIPTION))/g' $(OUTPUT_DIR)/wiiu/apps/$(STRIPPED_NAME)/meta.xml
$(OUTPUT_DIR)/wiiu/apps/$(STRIPPED_NAME)/icon.png:
@echo $@
@cp $(ICON) $(OUTPUT_DIR)/wiiu/apps/$(STRIPPED_NAME)/icon.png
2016-01-29 23:59:57 +00:00
else
2016-05-08 18:58:52 +00:00
ifeq ($(OS),Windows_NT)
ifneq ($(LIBRARY),1)
run: $(OUTPUT_FILES) $(OUTPUT_ZIP_FILE)
@echo "Running..."
@./$< $(RUN_FLAGS)
endif
else
ifeq ($(TARGET),WIN32)
ifneq ($(LIBRARY),1)
run: $(OUTPUT_FILES) $(OUTPUT_ZIP_FILE)
@echo "Running..."
@wine ./$< $(RUN_FLAGS)
endif
else ifeq ($(TARGET),WIN64)
ifneq ($(LIBRARY),1)
run: $(OUTPUT_FILES) $(OUTPUT_ZIP_FILE)
@echo "Running..."
@wine ./$< $(RUN_FLAGS)
endif
else
2016-01-29 23:59:57 +00:00
ifeq ($(LIBRARY),1)
install: $(OUTPUT_FILES) $(OUTPUT_ZIP_FILE)
@install -m 0755 $(OUTPUT_FILES) /usr/local/lib
@install -m 0755 $(foreach dir,$(INCLUDE_DIRS),$(wildcard $(dir)/*)) /usr/local/include
@echo "Installed."
else
run: $(OUTPUT_FILES) $(OUTPUT_ZIP_FILE)
@echo "Running..."
@./$< $(RUN_FLAGS)
install: $(OUTPUT_FILES) $(OUTPUT_ZIP_FILE)
@install -m 0755 $(OUTPUT_FILES) /usr/local/bin
@echo "Installed."
2016-05-08 18:58:52 +00:00
endif
endif
2016-05-04 03:31:38 +00:00
endif
2016-01-29 23:59:57 +00:00
2016-01-27 03:05:18 +00:00
endif
2016-01-29 23:59:57 +00:00
# COMMON RULES #
2016-01-27 03:05:18 +00:00
$(OUTPUT_ZIP_FILE): $(OUTPUT_FILES) $(EXTRA_OUTPUT_FILES)
2016-01-27 03:05:18 +00:00
@echo $@
@$(EXTRA_OUTPUT_COPY_CMD)
2016-01-27 03:05:18 +00:00
@cd $(OUTPUT_DIR); \
zip -r $(patsubst $(OUTPUT_DIR)/%,%,$@ $^) > /dev/null
2016-01-27 04:35:52 +00:00
$(OUTPUT_DIR)/$(STRIPPED_NAME): $(OBJECT_FILES)
2016-01-27 03:05:18 +00:00
@echo $@
@$(CXX) $(CXX_FLAGS) $^ -o $@ $(LD_FLAGS)
%.elf: $(OBJECT_FILES)
@echo $@
@$(CXX) $(CXX_FLAGS) $^ -o $@ $(LD_FLAGS)
%.a: $(OBJECT_FILES)
@echo $@
@$(AR) -rc $@ $^
%.so: $(OBJECT_FILES)
@echo $@
@$(CXX) $(CXX_FLAGS) -shared $^ -o $@ $(LD_FLAGS)
2016-05-08 18:58:52 +00:00
%.exe: $(OBJECT_FILES)
@echo $@
@$(CXX) $(CXX_FLAGS) $^ -o $@ $(LD_FLAGS)
%.dll: $(OBJECT_FILES)
@echo $@
@$(CXX) $(CXX_FLAGS) -shared $^ -o $@ $(LD_FLAGS)
2016-01-27 03:05:18 +00:00
$(BUILD_DIR)/%.o: %.c
@echo $@
@$(CC) -c $(CC_FLAGS) -MMD -MP -MF $(BUILD_DIR)/$*.d $< -o $@
$(BUILD_DIR)/%.o: %.cpp
@echo $@
@$(CXX) -c $(CXX_FLAGS) -MMD -MP -MF $(BUILD_DIR)/$*.d $< -o $@
$(BUILD_DIR)/%.o: %.s
@echo $@
2016-04-04 13:35:54 +00:00
@$(CC) -c $(CC_FLAGS) -MMD -MP -MF $(BUILD_DIR)/$*.d -x assembler-with-cpp $< -o $@
2016-01-27 03:05:18 +00:00
$(BUILD_DIR)/%.o: %.S
@echo $@
2016-04-04 13:35:54 +00:00
@$(CC) -c $(CC_FLAGS) -MMD -MP -MF $(BUILD_DIR)/$*.d -x assembler-with-cpp $< -o $@
2016-01-27 03:05:18 +00:00
$(BUILD_DIR)/%.bin.o: $(BUILD_DIR)/%.bin.c
@echo $@
@$(CC) -c $(CC_FLAGS) -MMD -MP -MF $(BUILD_DIR)/$*.d $< -o $@
$(BUILD_DIR)/%.bin.c: %.bin
@echo $@
@cd $(<D); \
xxd -i $(<F) $(CURDIR)/$@
@echo "extern const u8" `(echo $(<F) | sed -e 's/^\([0-9]\)/_\1/' | tr . _)`"[];" >> `(echo $(BUILD_DIR)/$< | tr . _)`.h
@echo "extern const u32" `(echo $(<F) | sed -e 's/^\([0-9]\)/_\1/' | tr . _)`_len";" >> `(echo $(BUILD_DIR)/$< | tr . _)`.h
2016-01-29 23:59:57 +00:00
$(foreach file,$(OBJECT_FILES),$(eval $(call createdirrule,$(file))))
$(foreach file,$(OUTPUT_FILES),$(eval $(call createdirrule,$(file))))
2016-01-27 03:05:18 +00:00
# DEPENDS #
DEPENDS := $(OBJECT_FILES:.o=.d)
-include $(DEPENDS)