mirror of https://github.com/zeldaret/tmc.git
modify main Makefile to build tools using cmake
This commit is contained in:
parent
496ebc9a1b
commit
5f41468ba8
50
Makefile
50
Makefile
|
@ -82,14 +82,14 @@ LDFLAGS = -Map ../../$(MAP)
|
||||||
LIB := -L ../../tools/agbcc/lib -lc
|
LIB := -L ../../tools/agbcc/lib -lc
|
||||||
|
|
||||||
SHA1 := $(shell { command -v sha1sum || command -v shasum; } 2>/dev/null) -c
|
SHA1 := $(shell { command -v sha1sum || command -v shasum; } 2>/dev/null) -c
|
||||||
GFX := tools/gbagfx/gbagfx
|
GFX := tools/bin/gbagfx
|
||||||
AIF := tools/aif2pcm/aif2pcm
|
AIF := tools/bin/aif2pcm
|
||||||
MID := tools/mid2agb/mid2agb
|
MID := tools/bin/mid2agb
|
||||||
SCANINC := tools/scaninc/scaninc
|
SCANINC := tools/bin/scaninc
|
||||||
# TODO: use charmap?
|
# TODO: use charmap?
|
||||||
PREPROC := tools/preproc/preproc
|
PREPROC := tools/bin/preproc
|
||||||
FIX := tools/gbafix/gbafix
|
FIX := tools/bin/gbafix
|
||||||
ASSET_PROCESSOR := tools/asset_processor/asset_processor
|
ASSET_PROCESSOR := tools/bin/asset_processor
|
||||||
|
|
||||||
ASSET_CONFIGS = assets/assets.json assets/gfx.json assets/map.json assets/samples.json assets/sounds.json
|
ASSET_CONFIGS = assets/assets.json assets/gfx.json assets/map.json assets/samples.json assets/sounds.json
|
||||||
TRANSLATIONS = translations/USA.bin translations/English.bin translations/French.bin translations/German.bin translations/Spanish.bin translations/Italian.bin
|
TRANSLATIONS = translations/USA.bin translations/English.bin translations/French.bin translations/German.bin translations/Spanish.bin translations/Italian.bin
|
||||||
|
@ -149,11 +149,7 @@ SUBDIRS := $(sort $(dir $(OBJS)))
|
||||||
|
|
||||||
$(shell mkdir -p $(SUBDIRS))
|
$(shell mkdir -p $(SUBDIRS))
|
||||||
|
|
||||||
TOOLDIRS := $(filter-out tools/agbcc tools/binutils,$(wildcard tools/*))
|
.PHONY: all setup clean-tools mostlyclean clean tidy tools extractassets
|
||||||
TOOLBASE = $(TOOLDIRS:tools/%=%)
|
|
||||||
TOOLS = $(foreach tool,$(TOOLBASE),tools/$(tool)/$(tool)$(EXE))
|
|
||||||
|
|
||||||
.PHONY: all setup clean-tools mostlyclean clean tidy $(TOOLDIRS) extractassets
|
|
||||||
|
|
||||||
MAKEFLAGS += --no-print-directory
|
MAKEFLAGS += --no-print-directory
|
||||||
|
|
||||||
|
@ -170,8 +166,18 @@ target: $(ROM)
|
||||||
compare: $(ROM)
|
compare: $(ROM)
|
||||||
@$(SHA1) $(BUILD_NAME).sha1
|
@$(SHA1) $(BUILD_NAME).sha1
|
||||||
|
|
||||||
setup: $(TOOLDIRS)
|
setup: tools
|
||||||
|
|
||||||
|
# all tools are build at once
|
||||||
|
# FIXME figure out why make builds multiple times when specifying all tools here
|
||||||
|
tools: $(GFX)
|
||||||
|
|
||||||
|
$(GFX) $(AIF) $(MID) $(SCANINC) $(PREPROC) $(FIX) $(ASSET_PROCESSOR) tools/bin/agb2mid tools/bin/tmc_strings tools/bin/bin2c &:
|
||||||
|
mkdir tools/cmake-build
|
||||||
|
unset CC CXX AS LD && cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=tools -S tools -B tools/cmake-build
|
||||||
|
cmake --build tools/cmake-build -j
|
||||||
|
cmake --install tools/cmake-build
|
||||||
|
|
||||||
# Automatically extract binary data
|
# Automatically extract binary data
|
||||||
build/extracted_assets_%: $(ASSET_CONFIGS) $(TRANSLATIONS)
|
build/extracted_assets_%: $(ASSET_CONFIGS) $(TRANSLATIONS)
|
||||||
$(ASSET_PROCESSOR) extract $(GAME_VERSION) $(ASSET_BUILDDIR)
|
$(ASSET_PROCESSOR) extract $(GAME_VERSION) $(ASSET_BUILDDIR)
|
||||||
|
@ -181,9 +187,6 @@ build/extracted_assets_%: $(ASSET_CONFIGS) $(TRANSLATIONS)
|
||||||
extractassets:
|
extractassets:
|
||||||
$(ASSET_PROCESSOR) convert $(GAME_VERSION) $(ASSET_BUILDDIR)
|
$(ASSET_PROCESSOR) convert $(GAME_VERSION) $(ASSET_BUILDDIR)
|
||||||
|
|
||||||
$(TOOLDIRS):
|
|
||||||
@$(MAKE) -C $@
|
|
||||||
|
|
||||||
mostlyclean: tidy
|
mostlyclean: tidy
|
||||||
rm -f sound/direct_sound_samples/*.bin
|
rm -f sound/direct_sound_samples/*.bin
|
||||||
rm -f $(SONG_OBJS) $(MID_SUBDIR)/*.s
|
rm -f $(SONG_OBJS) $(MID_SUBDIR)/*.s
|
||||||
|
@ -191,7 +194,8 @@ mostlyclean: tidy
|
||||||
rm -f $(AUTO_GEN_TARGETS)
|
rm -f $(AUTO_GEN_TARGETS)
|
||||||
|
|
||||||
clean-tools:
|
clean-tools:
|
||||||
@$(foreach tooldir,$(TOOLDIRS),$(MAKE) clean -C $(tooldir);)
|
rm -rf tools/bin
|
||||||
|
rm -rf tools/cmake-build
|
||||||
|
|
||||||
clean: mostlyclean clean-tools
|
clean: mostlyclean clean-tools
|
||||||
|
|
||||||
|
@ -217,12 +221,12 @@ tidy:
|
||||||
%.lz: % ; $(GFX) $< $@
|
%.lz: % ; $(GFX) $< $@
|
||||||
%.rl: % ; $(GFX) $< $@
|
%.rl: % ; $(GFX) $< $@
|
||||||
cd $(@D) && ../../$(MID) $(<F)
|
cd $(@D) && ../../$(MID) $(<F)
|
||||||
translations/USA.bin: translations/USA.json ; tools/tmc_strings/tmc_strings -p --source $< --dest $@ --size 0x499E0
|
translations/USA.bin: translations/USA.json ; tools/bin/tmc_strings -p --source $< --dest $@ --size 0x499E0
|
||||||
translations/English.bin: translations/English.json ; tools/tmc_strings/tmc_strings -p --source $< --dest $@ --size 0x488C0
|
translations/English.bin: translations/English.json ; tools/bin/tmc_strings -p --source $< --dest $@ --size 0x488C0
|
||||||
translations/French.bin: translations/French.json ; tools/tmc_strings/tmc_strings -p --source $< --dest $@ --size 0x47A90
|
translations/French.bin: translations/French.json ; tools/bin/tmc_strings -p --source $< --dest $@ --size 0x47A90
|
||||||
translations/German.bin: translations/German.json ; tools/tmc_strings/tmc_strings -p --source $< --dest $@ --size 0x42FC0
|
translations/German.bin: translations/German.json ; tools/bin/tmc_strings -p --source $< --dest $@ --size 0x42FC0
|
||||||
translations/Spanish.bin: translations/Spanish.json ; tools/tmc_strings/tmc_strings -p --source $< --dest $@ --size 0x41930
|
translations/Spanish.bin: translations/Spanish.json ; tools/bin/tmc_strings -p --source $< --dest $@ --size 0x41930
|
||||||
translations/Italian.bin: translations/Italian.json ; tools/tmc_strings/tmc_strings -p --source $< --dest $@ --size 0x438E0
|
translations/Italian.bin: translations/Italian.json ; tools/bin/tmc_strings -p --source $< --dest $@ --size 0x438E0
|
||||||
|
|
||||||
ifeq ($(NODEP),1)
|
ifeq ($(NODEP),1)
|
||||||
$(C_BUILDDIR)/%.o: c_dep :=
|
$(C_BUILDDIR)/%.o: c_dep :=
|
||||||
|
|
|
@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 3.14)
|
||||||
project(tools)
|
project(tools)
|
||||||
include(FetchContent)
|
include(FetchContent)
|
||||||
|
|
||||||
set(CMAKE_CXX_STANDARD 20)
|
set(CMAKE_CXX_STANDARD 17)
|
||||||
set(CMAKE_CXX_EXTENSIONS OFF)
|
set(CMAKE_CXX_EXTENSIONS OFF)
|
||||||
|
|
||||||
add_library(project_settings INTERFACE)
|
add_library(project_settings INTERFACE)
|
||||||
|
|
Loading…
Reference in New Issue