From e7218f043b1032ef5003c1fce39cf0399f3beb4e Mon Sep 17 00:00:00 2001 From: Zerocker Date: Sun, 7 Jun 2020 21:16:09 +0900 Subject: [PATCH] Add separate DEBUG flag for tools --- Makefile | 12 +++--------- tools/Makefile | 30 ++++++++++++++++++++++-------- tools/gen_asset_list.cpp | 2 +- 3 files changed, 26 insertions(+), 18 deletions(-) diff --git a/Makefile b/Makefile index b2154dda..a111fe56 100644 --- a/Makefile +++ b/Makefile @@ -75,9 +75,9 @@ else endif ifeq ($(TARGET_WEB),0) -ifeq ($(HOST_OS),Windows) -WINDOWS_BUILD := 1 -endif + ifeq ($(HOST_OS),Windows) + WINDOWS_BUILD := 1 + endif endif # MXE overrides @@ -96,8 +96,6 @@ endif ifneq ($(TARGET_BITS),0) BITS := -m$(TARGET_BITS) -else - BITS := endif # Release (version) flag defs @@ -340,10 +338,6 @@ GODDARD_C_FILES := $(foreach dir,$(GODDARD_SRC_DIRS),$(wildcard $(dir)/*.c)) GENERATED_C_FILES := $(BUILD_DIR)/assets/mario_anim_data.c $(BUILD_DIR)/assets/demo_data.c \ $(addprefix $(BUILD_DIR)/bin/,$(addsuffix _skybox.c,$(notdir $(basename $(wildcard textures/skyboxes/*.png))))) -ifeq ($(WINDOWS_BUILD),0) - CXX_FILES := -endif - # We need to keep this for now # If we're not N64 use below diff --git a/tools/Makefile b/tools/Makefile index 28ff49bf..d143bb46 100644 --- a/tools/Makefile +++ b/tools/Makefile @@ -1,17 +1,26 @@ UNAME := $(shell uname) +DEBUG ?= 0 + ifeq ($(UNAME),Darwin) - OSX_BUILD := -DOSX_BUILD + OSX_BUILD := -DOSX_BUILD +endif + +ifeq ($(DEBUG),1) + OPT_FLAG := -g +else + OPT_FLAG := -O2 endif CC := gcc -CFLAGS := -Llib -Iinclude -I../include -I . -Wall -Wextra -Wno-unused-parameter $(OSX_BUILD) -pedantic -std=c99 -O3 -s +CXX := g++ +CFLAGS := -Llib -Iinclude -I../include -I . -Wall -Wextra -Wno-unused-parameter $(OSX_BUILD) -pedantic -std=c99 $(OPT_FLAG) -s PROGRAMS := n64graphics n64graphics_ci mio0 n64cksum textconv patch_libultra_math iplfontutil aifc_decode aiff_extract_codebook vadpcm_enc tabledesign extract_data_for_mio skyconv n64graphics_SOURCES := n64graphics.c utils.c n64graphics_CFLAGS := -DN64GRAPHICS_STANDALONE n64graphics_ci_SOURCES := n64graphics_ci_dir/n64graphics_ci.c n64graphics_ci_dir/exoquant/exoquant.c n64graphics_ci_dir/utils.c -n64graphics_ci_CFLAGS := -O2 # 3s faster compile time +n64graphics_ci_CFLAGS := $(OPT_FLAG) mio0_SOURCES := libmio0.c mio0_CFLAGS := -DMIO0_STANDALONE @@ -22,10 +31,10 @@ textconv_SOURCES := textconv.c utf8.c hashtable.c patch_libultra_math_SOURCES := patch_libultra_math.c iplfontutil_SOURCES := iplfontutil.c -iplfontutil_CFLAGS := -O2 # faster compile time +iplfontutil_CFLAGS := $(OPT_FLAG) aifc_decode_SOURCES := aifc_decode.c -aifc_decode_CFLAGS := -O2 # both runs and compiles faster than -O3 +aifc_decode_CFLAGS := $(OPT_FLAG) aiff_extract_codebook_SOURCES := aiff_extract_codebook.c @@ -36,19 +45,24 @@ vadpcm_enc_SOURCES := sdk-tools/adpcm/vadpcm_enc.c sdk-tools/adpcm/vpredictor.c vadpcm_enc_CFLAGS := -Wno-unused-result -Wno-uninitialized -Wno-sign-compare -Wno-absolute-value extract_data_for_mio_SOURCES := extract_data_for_mio.c -extract_data_for_mio_CFLAGS := -O2 +extract_data_for_mio_CFLAGS := $(OPT_FLAG) skyconv_SOURCES := skyconv.c n64graphics.c utils.c -skyconv_CFLAGS := -O2 -lm +skyconv_CFLAGS := $(OPT_FLAG) -lm all: $(PROGRAMS) clean: $(RM) $(PROGRAMS) + $(RM) gen_asset_list define COMPILE $(1): $($1_SOURCES) $(CC) $(CFLAGS) $(OSX_BUILD) $$^ -lm -o $$@ $($1_CFLAGS) endef -$(foreach p,$(PROGRAMS),$(eval $(call COMPILE,$(p)))) +# Separate build for debugging gen_asset_list.cpp +gen_asset_list: + $(CXX) -std=c++17 gen_asset_list.cpp -lstdc++fs $(OPT_FLAG) -Wall -o gen_asset_list + +$(foreach p,$(PROGRAMS),$(eval $(call COMPILE,$(p)))) \ No newline at end of file diff --git a/tools/gen_asset_list.cpp b/tools/gen_asset_list.cpp index 050bd118..3096293e 100644 --- a/tools/gen_asset_list.cpp +++ b/tools/gen_asset_list.cpp @@ -222,7 +222,7 @@ tuple> compileSoundData(const string& lang) { } int main() { - intentional syntax error; // (see comment at top of file) + //intentional syntax error; // (see comment at top of file) map assets; map>> soundAssets;