From 166183d5ed73059922b9679b832b591dd6fa073b Mon Sep 17 00:00:00 2001 From: luckytyphlosion <10688458+luckytyphlosion@users.noreply.github.com> Date: Wed, 16 Dec 2020 20:31:56 -0500 Subject: [PATCH] [Round 2] Apply all source related changes for the new INSTALL.md in one commit. --- Makefile | 97 +++++++++++++++++++++++--------------- asmdiff.sh | 10 +++- berry_fix/Makefile | 37 +++++++-------- berry_fix/payload/Makefile | 37 +++++++-------- libagbsyscall/Makefile | 37 +++++++-------- map_data_rules.mk | 4 +- tools/aif2pcm/Makefile | 10 +++- tools/bin2c/Makefile | 10 +++- tools/gbafix/Makefile | 10 +++- tools/gbagfx/Makefile | 12 +++-- tools/jsonproc/Makefile | 10 +++- tools/mapjson/Makefile | 10 +++- tools/mid2agb/Makefile | 10 +++- tools/preproc/Makefile | 10 +++- tools/ramscrgen/Makefile | 10 +++- tools/rsfont/Makefile | 10 +++- tools/scaninc/Makefile | 10 +++- 17 files changed, 213 insertions(+), 121 deletions(-) diff --git a/Makefile b/Makefile index 78a2c2a4f..891cab480 100644 --- a/Makefile +++ b/Makefile @@ -1,29 +1,34 @@ TOOLCHAIN := $(DEVKITARM) COMPARE ?= 0 -ifeq ($(CC),) -HOSTCC := gcc -else -HOSTCC := $(CC) -endif +# don't use dkP's base_tools anymore +# because the redefinition of $(CC) conflicts +# with when we want to use $(CC) to preprocess files +# thus, manually create the variables for the bin +# files, or use arm-none-eabi binaries on the system +# if dkP is not installed on tihs system -ifeq ($(CXX),) -HOSTCXX := g++ -else -HOSTCXX := $(CXX) -endif - -ifneq (,$(wildcard $(TOOLCHAIN)/base_tools)) -include $(TOOLCHAIN)/base_tools -else +ifneq (,$(TOOLCHAIN)) +ifneq ($(wildcard $(TOOLCHAIN)/bin),) export PATH := $(TOOLCHAIN)/bin:$(PATH) +endif +endif + PREFIX := arm-none-eabi- OBJCOPY := $(PREFIX)objcopy -export CC := $(PREFIX)gcc -export AS := $(PREFIX)as +AS := $(PREFIX)as + +ifneq ($(MODERN),1) +CPP := $(CC) -E +else +CPP := $(PREFIX)cpp endif -export CPP := $(PREFIX)cpp -export LD := $(PREFIX)ld + +LD := $(PREFIX)ld + +# note: the makefile must be set up so MODERNCC is never called +# if MODERN=0 +MODERNCC := $(PREFIX)gcc ifeq ($(OS),Windows_NT) EXE := .exe @@ -37,6 +42,16 @@ MAKER_CODE := 01 REVISION := 0 MODERN ?= 0 +ROM_NAME := pokeemerald.gba +ELF_NAME := $(ROM_NAME:.gba=.elf) +MAP_NAME := $(ROM_NAME:.gba=.map) +OBJ_DIR_NAME := build/emerald + +MODERN_ROM_NAME := pokeemerald_modern.gba +MODERN_ELF_NAME := $(MODERN_ROM_NAME:.gba=.elf) +MODERN_MAP_NAME := $(MODERN_ROM_NAME:.gba=.map) +MODERN_OBJ_DIR_NAME := build/modern + SHELL := /bin/bash -o pipefail ELF = $(ROM:.gba=.elf) @@ -64,20 +79,20 @@ ASFLAGS := -mcpu=arm7tdmi --defsym MODERN=$(MODERN) ifeq ($(MODERN),0) CC1 := tools/agbcc/bin/agbcc$(EXE) override CFLAGS += -mthumb-interwork -Wimplicit -Wparentheses -Werror -O2 -fhex-asm -g -ROM := pokeemerald.gba -OBJ_DIR := build/emerald +ROM := $(ROM_NAME) +OBJ_DIR := $(OBJ_DIR_NAME) LIBPATH := -L ../../tools/agbcc/lib else -CC1 = $(shell $(CC) --print-prog-name=cc1) -quiet +CC1 = $(shell $(MODERNCC) --print-prog-name=cc1) -quiet override CFLAGS += -mthumb -mthumb-interwork -O2 -mabi=apcs-gnu -mtune=arm7tdmi -march=armv4t -fno-toplevel-reorder -Wno-pointer-to-int-cast -g -ROM := pokeemerald_modern.gba -OBJ_DIR := build/modern -LIBPATH := -L "$(dir $(shell $(CC) -mthumb -print-file-name=libgcc.a))" -L "$(dir $(shell $(CC) -mthumb -print-file-name=libc.a))" +ROM := $(MODERN_ROM_NAME) +OBJ_DIR := $(MODERN_OBJ_DIR_NAME) +LIBPATH := -L "$(dir $(shell $(MODERNCC) -mthumb -print-file-name=libgcc.a))" -L "$(dir $(shell $(MODERNCC) -mthumb -print-file-name=libc.a))" endif CPPFLAGS := -iquote include -iquote $(GFLIB_SUBDIR) -Wno-trigraphs -DMODERN=$(MODERN) -ifeq ($(MODERN),0) -CPPFLAGS += -I tools/agbcc/include -I tools/agbcc +ifneq ($(MODERN),1) +CPPFLAGS += -I tools/agbcc/include -I tools/agbcc -nostdinc -undef endif LDFLAGS = -Map ../../$(MAP) @@ -111,7 +126,7 @@ MAKEFLAGS += --no-print-directory # Secondary expansion is required for dependency variables in object rules. .SECONDEXPANSION: -.PHONY: all rom clean compare tidy tools mostlyclean clean-tools $(TOOLDIRS) berry_fix libagbsyscall modern +.PHONY: all rom clean compare tidy tools mostlyclean clean-tools $(TOOLDIRS) berry_fix libagbsyscall modern tidymodern tidynonmodern infoshell = $(foreach line, $(shell $1 | sed "s/ /__SPACE__/g"), $(info $(subst __SPACE__, ,$(line)))) @@ -162,7 +177,7 @@ all: rom tools: $(TOOLDIRS) $(TOOLDIRS): - @$(MAKE) -C $@ CC=$(HOSTCC) CXX=$(HOSTCXX) + @$(MAKE) -C $@ rom: $(ROM) ifeq ($(COMPARE),1) @@ -177,7 +192,7 @@ clean: mostlyclean clean-tools clean-tools: @$(foreach tooldir,$(TOOLDIRS),$(MAKE) clean -C $(tooldir);) -mostlyclean: tidy +mostlyclean: tidynonmodern tidymodern rm -f $(SAMPLE_SUBDIR)/*.bin rm -f $(CRY_SUBDIR)/*.bin rm -f $(MID_SUBDIR)/*.s @@ -192,10 +207,15 @@ mostlyclean: tidy tidy: rm -f $(ROM) $(ELF) $(MAP) rm -r $(OBJ_DIR) -ifeq ($(MODERN),0) - @$(MAKE) tidy MODERN=1 -endif +tidynonmodern: + rm -f $(ROM_NAME) $(ELF_NAME) $(MAP_NAME) + rm -rf $(OBJ_DIR_NAME) + +tidymodern: + rm -f $(MODERN_ROM_NAME) $(MODERN_ELF_NAME) $(MODERN_MAP_NAME) + rm -rf $(MODERN_OBJ_DIR_NAME) + ifneq ($(MODERN),0) $(C_BUILDDIR)/berry_crush.o: override CFLAGS += -Wno-address-of-packed-member endif @@ -223,7 +243,7 @@ sound/%.bin: sound/%.aif ; $(AIF) $< $@ ifeq ($(MODERN),0) -$(C_BUILDDIR)/libc.o: CC1 := tools/agbcc/bin/old_agbcc +$(C_BUILDDIR)/libc.o: CC1 := tools/agbcc/bin/old_agbcc$(EXE) $(C_BUILDDIR)/libc.o: CFLAGS := -O2 $(C_BUILDDIR)/siirtc.o: CFLAGS := -mthumb-interwork @@ -232,10 +252,10 @@ $(C_BUILDDIR)/agb_flash.o: CFLAGS := -O -mthumb-interwork $(C_BUILDDIR)/agb_flash_1m.o: CFLAGS := -O -mthumb-interwork $(C_BUILDDIR)/agb_flash_mx.o: CFLAGS := -O -mthumb-interwork -$(C_BUILDDIR)/m4a.o: CC1 := tools/agbcc/bin/old_agbcc +$(C_BUILDDIR)/m4a.o: CC1 := tools/agbcc/bin/old_agbcc$(EXE) $(C_BUILDDIR)/record_mixing.o: CFLAGS += -ffreestanding -$(C_BUILDDIR)/librfu_intr.o: CC1 := tools/agbcc/bin/agbcc_arm +$(C_BUILDDIR)/librfu_intr.o: CC1 := tools/agbcc/bin/agbcc_arm$(EXE) $(C_BUILDDIR)/librfu_intr.o: CFLAGS := -O2 -mthumb-interwork -quiet else $(C_BUILDDIR)/librfu_intr.o: CFLAGS := -mthumb-interwork -O2 -mabi=apcs-gnu -mtune=arm7tdmi -march=armv4t -fno-toplevel-reorder -Wno-pointer-to-int-cast @@ -296,11 +316,11 @@ endif ifeq ($(NODEP),1) $(DATA_ASM_BUILDDIR)/%.o: $(DATA_ASM_SUBDIR)/%.s - $(PREPROC) $< charmap.txt | $(CPP) -I include | $(AS) $(ASFLAGS) -o $@ + $(PREPROC) $< charmap.txt | $(CPP) -I include - | $(AS) $(ASFLAGS) -o $@ else define DATA_ASM_DEP $1: $2 $$(shell $(SCANINC) -I include -I "" $2) - $$(PREPROC) $$< charmap.txt | $$(CPP) -I include | $$(AS) $$(ASFLAGS) -o $$@ + $$(PREPROC) $$< charmap.txt | $$(CPP) -I include - | $$(AS) $$(ASFLAGS) -o $$@ endef $(foreach src, $(REGULAR_DATA_ASM_SRCS), $(eval $(call DATA_ASM_DEP,$(patsubst $(DATA_ASM_SUBDIR)/%.s,$(DATA_ASM_BUILDDIR)/%.o, $(src)),$(src)))) endif @@ -329,7 +349,8 @@ $(OBJ_DIR)/ld_script.ld: $(LD_SCRIPT) $(LD_SCRIPT_DEPS) cd $(OBJ_DIR) && sed "s#tools/#../../tools/#g" ../../$(LD_SCRIPT) > ld_script.ld $(ELF): $(OBJ_DIR)/ld_script.ld $(OBJS) berry_fix libagbsyscall - cd $(OBJ_DIR) && $(LD) $(LDFLAGS) -T ld_script.ld -o ../../$@ $(OBJS_REL) $(LIB) + @echo "cd $(OBJ_DIR) && $(LD) $(LDFLAGS) -T ld_script.ld -o ../../$@ " + @cd $(OBJ_DIR) && $(LD) $(LDFLAGS) -T ld_script.ld -o ../../$@ $(OBJS_REL) $(LIB) $(FIX) $@ -t"$(TITLE)" -c$(GAME_CODE) -m$(MAKER_CODE) -r$(REVISION) --silent $(ROM): $(ELF) diff --git a/asmdiff.sh b/asmdiff.sh index 6ea588131..f5a701074 100755 --- a/asmdiff.sh +++ b/asmdiff.sh @@ -1,11 +1,19 @@ #!/bin/bash -OBJDUMP="$DEVKITARM/bin/arm-none-eabi-objdump -D -bbinary -marmv4t -Mforce-thumb" +if [[ -d "$DEVKITARM/bin/" ]]; then + OBJDUMP_BIN="$DEVKITARM/bin/arm-none-eabi-objdump" +else + OBJDUMP_BIN="arm-none-eabi-objdump" +fi + +OBJDUMP="$OBJDUMP_BIN -D -bbinary -marmv4t -Mforce-thumb" + if [ $(($1)) -ge $((0x8000000)) ]; then OPTIONS="--adjust-vma=0x8000000 --start-address=$(($1)) --stop-address=$(($1 + $2))" else OPTIONS="--start-address=$(($1)) --stop-address=$(($1 + $2))" fi + $OBJDUMP $OPTIONS baserom.gba > baserom.dump $OBJDUMP $OPTIONS pokeemerald.gba > pokeemerald.dump diff -u baserom.dump pokeemerald.dump diff --git a/berry_fix/Makefile b/berry_fix/Makefile index 0ead3804f..8b8d07d42 100644 --- a/berry_fix/Makefile +++ b/berry_fix/Makefile @@ -1,29 +1,28 @@ TOOLCHAIN := $(DEVKITARM) COMPARE ?= 0 -ifeq ($(CC),) -HOSTCC := gcc -else -HOSTCC := $(CC) -endif +# don't use dkP's base_tools anymore +# because the redefinition of $(CC) conflicts +# with when we want to use $(CC) to preprocess files +# thus, manually create the variables for the bin +# files, or use arm-none-eabi binaries on the system +# if dkP is not installed on tihs system -ifeq ($(CXX),) -HOSTCXX := g++ -else -HOSTCXX := $(CXX) -endif - -ifneq (,$(wildcard $(TOOLCHAIN)/base_tools)) -include $(TOOLCHAIN)/base_tools -else +ifneq (,$(TOOLCHAIN)) +ifneq ($(wildcard $(TOOLCHAIN)/bin),) export PATH := $(TOOLCHAIN)/bin:$(PATH) +endif +endif + PREFIX := arm-none-eabi- OBJCOPY := $(PREFIX)objcopy -export CC := $(PREFIX)gcc -export AS := $(PREFIX)as -endif -export CPP := $(PREFIX)cpp -export LD := $(PREFIX)ld +AS := $(PREFIX)as +CPP := $(CC) -E +LD := $(PREFIX)ld + +# note: the makefile must be set up so MODERNCC is never called +# if MODERN=0 +MODERNCC := $(PREFIX)gcc ifeq ($(OS),Windows_NT) EXE := .exe diff --git a/berry_fix/payload/Makefile b/berry_fix/payload/Makefile index a121fda93..bae657c92 100644 --- a/berry_fix/payload/Makefile +++ b/berry_fix/payload/Makefile @@ -1,29 +1,28 @@ TOOLCHAIN := $(DEVKITARM) COMPARE ?= 0 -ifeq ($(CC),) -HOSTCC := gcc -else -HOSTCC := $(CC) -endif +# don't use dkP's base_tools anymore +# because the redefinition of $(CC) conflicts +# with when we want to use $(CC) to preprocess files +# thus, manually create the variables for the bin +# files, or use arm-none-eabi binaries on the system +# if dkP is not installed on tihs system -ifeq ($(CXX),) -HOSTCXX := g++ -else -HOSTCXX := $(CXX) -endif - -ifneq (,$(wildcard $(TOOLCHAIN)/base_tools)) -include $(TOOLCHAIN)/base_tools -else +ifneq (,$(TOOLCHAIN)) +ifneq ($(wildcard $(TOOLCHAIN)/bin),) export PATH := $(TOOLCHAIN)/bin:$(PATH) +endif +endif + PREFIX := arm-none-eabi- OBJCOPY := $(PREFIX)objcopy -export CC := $(PREFIX)gcc -export AS := $(PREFIX)as -endif -export CPP := $(PREFIX)cpp -export LD := $(PREFIX)ld +AS := $(PREFIX)as +CPP := $(CC) -E +LD := $(PREFIX)ld + +# note: the makefile must be set up so MODERNCC is never called +# if MODERN=0 +MODERNCC := $(PREFIX)gcc ifeq ($(OS),Windows_NT) EXE := .exe diff --git a/libagbsyscall/Makefile b/libagbsyscall/Makefile index 911cdb237..76368da86 100644 --- a/libagbsyscall/Makefile +++ b/libagbsyscall/Makefile @@ -1,29 +1,28 @@ TOOLCHAIN := $(DEVKITARM) COMPARE ?= 0 -ifeq ($(CC),) -HOSTCC := gcc -else -HOSTCC := $(CC) -endif +# don't use dkP's base_tools anymore +# because the redefinition of $(CC) conflicts +# with when we want to use $(CC) to preprocess files +# thus, manually create the variables for the bin +# files, or use arm-none-eabi binaries on the system +# if dkP is not installed on tihs system -ifeq ($(CXX),) -HOSTCXX := g++ -else -HOSTCXX := $(CXX) -endif - -ifneq (,$(wildcard $(TOOLCHAIN)/base_tools)) -include $(TOOLCHAIN)/base_tools -else +ifneq (,$(TOOLCHAIN)) +ifneq ($(wildcard $(TOOLCHAIN)/bin),) export PATH := $(TOOLCHAIN)/bin:$(PATH) +endif +endif + PREFIX := arm-none-eabi- OBJCOPY := $(PREFIX)objcopy -export CC := $(PREFIX)gcc -export AS := $(PREFIX)as -endif -export CPP := $(PREFIX)cpp -export LD := $(PREFIX)ld +AS := $(PREFIX)as +CPP := $(CC) -E +LD := $(PREFIX)ld + +# note: the makefile must be set up so MODERNCC is never called +# if MODERN=0 +MODERNCC := $(PREFIX)gcc ifeq ($(OS),Windows_NT) EXE := .exe diff --git a/map_data_rules.mk b/map_data_rules.mk index 0203b383d..626cd4724 100755 --- a/map_data_rules.mk +++ b/map_data_rules.mk @@ -9,9 +9,9 @@ MAP_EVENTS := $(patsubst $(MAPS_DIR)/%/,$(MAPS_DIR)/%/events.inc,$(MAP_DIRS)) MAP_HEADERS := $(patsubst $(MAPS_DIR)/%/,$(MAPS_DIR)/%/header.inc,$(MAP_DIRS)) $(DATA_ASM_BUILDDIR)/maps.o: $(DATA_ASM_SUBDIR)/maps.s $(LAYOUTS_DIR)/layouts.inc $(LAYOUTS_DIR)/layouts_table.inc $(MAPS_DIR)/headers.inc $(MAPS_DIR)/groups.inc $(MAPS_DIR)/connections.inc $(MAP_CONNECTIONS) $(MAP_HEADERS) - $(PREPROC) $< charmap.txt | $(CPP) -I include | $(AS) $(ASFLAGS) -o $@ + $(PREPROC) $< charmap.txt | $(CPP) -I include - | $(AS) $(ASFLAGS) -o $@ $(DATA_ASM_BUILDDIR)/map_events.o: $(DATA_ASM_SUBDIR)/map_events.s $(MAPS_DIR)/events.inc $(MAP_EVENTS) - $(PREPROC) $< charmap.txt | $(CPP) -I include | $(AS) $(ASFLAGS) -o $@ + $(PREPROC) $< charmap.txt | $(CPP) -I include - | $(AS) $(ASFLAGS) -o $@ $(MAPS_DIR)/%/header.inc: $(MAPS_DIR)/%/map.json $(MAPJSON) map emerald $< $(LAYOUTS_DIR)/layouts.json diff --git a/tools/aif2pcm/Makefile b/tools/aif2pcm/Makefile index 77df29152..dd48a8759 100644 --- a/tools/aif2pcm/Makefile +++ b/tools/aif2pcm/Makefile @@ -6,12 +6,18 @@ LIBS = -lm SRCS = main.c extended.c +ifeq ($(OS),Windows_NT) +EXE := .exe +else +EXE := +endif + .PHONY: all clean -all: aif2pcm +all: aif2pcm$(EXE) @: -aif2pcm: $(SRCS) +aif2pcm$(EXE): $(SRCS) $(CC) $(CFLAGS) $(SRCS) -o $@ $(LDFLAGS) $(LIBS) clean: diff --git a/tools/bin2c/Makefile b/tools/bin2c/Makefile index 52806e39c..4dbfab94f 100644 --- a/tools/bin2c/Makefile +++ b/tools/bin2c/Makefile @@ -6,10 +6,16 @@ CFLAGS = -Wall -Wextra -Werror -std=c11 -O2 SRCS = bin2c.c -all: bin2c +ifeq ($(OS),Windows_NT) +EXE := .exe +else +EXE := +endif + +all: bin2c$(EXE) @: -bin2c: $(SRCS) +bin2c$(EXE): $(SRCS) $(CC) $(CFLAGS) $(SRCS) -o $@ $(LDFLAGS) clean: diff --git a/tools/gbafix/Makefile b/tools/gbafix/Makefile index 91a60a9e4..efb016c97 100644 --- a/tools/gbafix/Makefile +++ b/tools/gbafix/Makefile @@ -3,10 +3,16 @@ CC ?= gcc SRCS = gbafix.c -all: gbafix +ifeq ($(OS),Windows_NT) +EXE := .exe +else +EXE := +endif + +all: gbafix$(EXE) @: -gbafix: $(SRCS) +gbafix$(EXE): $(SRCS) $(CC) $(SRCS) -o $@ $(LDFLAGS) clean: diff --git a/tools/gbagfx/Makefile b/tools/gbagfx/Makefile index f0638414d..b4244aa8d 100644 --- a/tools/gbagfx/Makefile +++ b/tools/gbagfx/Makefile @@ -6,15 +6,21 @@ LIBS = -lpng -lz SRCS = main.c convert_png.c gfx.c jasc_pal.c lz.c rl.c util.c font.c huff.c +ifeq ($(OS),Windows_NT) +EXE := .exe +else +EXE := +endif + .PHONY: all clean -all: gbagfx +all: gbagfx$(EXE) @: -gbagfx-debug: $(SRCS) convert_png.h gfx.h global.h jasc_pal.h lz.h rl.h util.h font.h +gbagfx-debug$(EXE): $(SRCS) convert_png.h gfx.h global.h jasc_pal.h lz.h rl.h util.h font.h $(CC) $(CFLAGS) -DDEBUG $(SRCS) -o $@ $(LDFLAGS) $(LIBS) -gbagfx: $(SRCS) convert_png.h gfx.h global.h jasc_pal.h lz.h rl.h util.h font.h +gbagfx$(EXE): $(SRCS) convert_png.h gfx.h global.h jasc_pal.h lz.h rl.h util.h font.h $(CC) $(CFLAGS) $(SRCS) -o $@ $(LDFLAGS) $(LIBS) clean: diff --git a/tools/jsonproc/Makefile b/tools/jsonproc/Makefile index 47198b171..eec73eb7b 100755 --- a/tools/jsonproc/Makefile +++ b/tools/jsonproc/Makefile @@ -8,12 +8,18 @@ SRCS := jsonproc.cpp HEADERS := jsonproc.h inja.hpp nlohmann/json.hpp +ifeq ($(OS),Windows_NT) +EXE := .exe +else +EXE := +endif + .PHONY: all clean -all: jsonproc +all: jsonproc$(EXE) @: -jsonproc: $(SRCS) $(HEADERS) +jsonproc$(EXE): $(SRCS) $(HEADERS) $(CXX) $(CXXFLAGS) $(INCLUDES) $(SRCS) -o $@ $(LDFLAGS) clean: diff --git a/tools/mapjson/Makefile b/tools/mapjson/Makefile index c1f703f9f..100e809c6 100644 --- a/tools/mapjson/Makefile +++ b/tools/mapjson/Makefile @@ -6,12 +6,18 @@ SRCS := json11.cpp mapjson.cpp HEADERS := mapjson.h +ifeq ($(OS),Windows_NT) +EXE := .exe +else +EXE := +endif + .PHONY: all clean -all: mapjson +all: mapjson$(EXE) @: -mapjson: $(SRCS) $(HEADERS) +mapjson$(EXE): $(SRCS) $(HEADERS) $(CXX) $(CXXFLAGS) $(SRCS) -o $@ $(LDFLAGS) clean: diff --git a/tools/mid2agb/Makefile b/tools/mid2agb/Makefile index 451d4b39f..553b7859e 100644 --- a/tools/mid2agb/Makefile +++ b/tools/mid2agb/Makefile @@ -6,12 +6,18 @@ SRCS := agb.cpp error.cpp main.cpp midi.cpp tables.cpp HEADERS := agb.h error.h main.h midi.h tables.h +ifeq ($(OS),Windows_NT) +EXE := .exe +else +EXE := +endif + .PHONY: all clean -all: mid2agb +all: mid2agb$(EXE) @: -mid2agb: $(SRCS) $(HEADERS) +mid2agb$(EXE): $(SRCS) $(HEADERS) $(CXX) $(CXXFLAGS) $(SRCS) -o $@ $(LDFLAGS) clean: diff --git a/tools/preproc/Makefile b/tools/preproc/Makefile index 8c48afea2..1507c973f 100644 --- a/tools/preproc/Makefile +++ b/tools/preproc/Makefile @@ -8,12 +8,18 @@ SRCS := asm_file.cpp c_file.cpp charmap.cpp preproc.cpp string_parser.cpp \ HEADERS := asm_file.h c_file.h char_util.h charmap.h preproc.h string_parser.h \ utf8.h +ifeq ($(OS),Windows_NT) +EXE := .exe +else +EXE := +endif + .PHONY: all clean -all: preproc +all: preproc$(EXE) @: -preproc: $(SRCS) $(HEADERS) +preproc$(EXE): $(SRCS) $(HEADERS) $(CXX) $(CXXFLAGS) $(SRCS) -o $@ $(LDFLAGS) clean: diff --git a/tools/ramscrgen/Makefile b/tools/ramscrgen/Makefile index 4e901a29c..a9375c87a 100644 --- a/tools/ramscrgen/Makefile +++ b/tools/ramscrgen/Makefile @@ -8,10 +8,16 @@ HEADERS := ramscrgen.h sym_file.h elf.h char_util.h .PHONY: all clean -all: ramscrgen +ifeq ($(OS),Windows_NT) +EXE := .exe +else +EXE := +endif + +all: ramscrgen$(EXE) @: -ramscrgen: $(SRCS) $(HEADERS) +ramscrgen$(EXE): $(SRCS) $(HEADERS) $(CXX) $(CXXFLAGS) $(SRCS) -o $@ $(LDFLAGS) clean: diff --git a/tools/rsfont/Makefile b/tools/rsfont/Makefile index 930a92b36..0bc88a42b 100644 --- a/tools/rsfont/Makefile +++ b/tools/rsfont/Makefile @@ -8,10 +8,16 @@ SRCS = main.c convert_png.c util.c font.c .PHONY: all clean -all: rsfont +ifeq ($(OS),Windows_NT) +EXE := .exe +else +EXE := +endif + +all: rsfont$(EXE) @: -rsfont: $(SRCS) convert_png.h gfx.h global.h util.h font.h +rsfont$(EXE): $(SRCS) convert_png.h gfx.h global.h util.h font.h $(CC) $(CFLAGS) $(SRCS) -o $@ $(LDFLAGS) $(LIBS) clean: diff --git a/tools/scaninc/Makefile b/tools/scaninc/Makefile index 52e663d8d..96d92f706 100644 --- a/tools/scaninc/Makefile +++ b/tools/scaninc/Makefile @@ -8,10 +8,16 @@ HEADERS := scaninc.h asm_file.h c_file.h source_file.h .PHONY: all clean -all: scaninc +ifeq ($(OS),Windows_NT) +EXE := .exe +else +EXE := +endif + +all: scaninc$(EXE) @: -scaninc: $(SRCS) $(HEADERS) +scaninc$(EXE): $(SRCS) $(HEADERS) $(CXX) $(CXXFLAGS) $(SRCS) -o $@ $(LDFLAGS) clean: