Merge pull request #302 from Zerocker/patch-debug

Fix VERSION OPT_FLAGS for debugging
This commit is contained in:
Zerocker 2020-06-07 22:33:37 +09:00 committed by GitHub
commit 9d171452b0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 32 additions and 30 deletions

View file

@ -10,6 +10,8 @@ default: all
# These options can either be changed by modifying the makefile, or
# by building with 'make SETTING=value'. 'make clean' may be required.
# Build debug version (default)
DEBUG ?= 1
# Version of the game to build
VERSION ?= us
# Graphics microcode used
@ -73,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
@ -94,8 +96,6 @@ endif
ifneq ($(TARGET_BITS),0)
BITS := -m$(TARGET_BITS)
else
BITS :=
endif
# Release (version) flag defs
@ -280,15 +280,11 @@ GODDARD_SRC_DIRS := src/goddard src/goddard/dynlists
MIPSISET := -mips2
MIPSBIT := -32
ifeq ($(VERSION),eu)
OPT_FLAGS := -O2
else
ifeq ($(VERSION),sh)
OPT_FLAGS := -O2
ifeq ($(DEBUG),1)
OPT_FLAGS := -g
else
OPT_FLAGS := -O2
endif
endif
# Set BITS (32/64) to compile for
OPT_FLAGS += $(BITS)
@ -297,10 +293,6 @@ ifeq ($(TARGET_WEB),1)
OPT_FLAGS := -O2 -g4 --source-map-base http://localhost:8080/
endif
# Use a default opt flag for gcc, then override if RPi
# OPT_FLAGS := -O2 # "Whole-compile optimization flag" Breaks sound on x86.
ifeq ($(TARGET_RPI),1)
machine = $(shell sh -c 'uname -m 2>/dev/null || echo unknown')
# Raspberry Pi B+, Zero, etc
@ -346,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

View file

@ -7,8 +7,8 @@ LIBAFLA=libaudiofile.la
AUDDIR=./tools/audiofile-0.3.6
# Command line options
OPTIONS=("Analog Camera" "No Draw Distance" "Text-saves" "Smoke Texture Fix" "Clean build")
EXTRA=("BETTERCAMERA=1" "NODRAWINGDISTANCE=1" "TEXTSAVES=1" "TEXTURE_FIX=1" "clean")
OPTIONS=("Analog Camera" "No Draw Distance" "Text-saves" "Smoke Texture Fix" "Release build" "Clean build")
EXTRA=("BETTERCAMERA=1" "NODRAWINGDISTANCE=1" "TEXTSAVES=1" "TEXTURE_FIX=1" "DEBUG=0" "clean")
# Colors
RED=$(tput setaf 1)

View file

@ -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))))

View file

@ -222,7 +222,7 @@ tuple<string, string, vector<string>> 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<string, string> assets;
map<string, vector<pair<string, int>>> soundAssets;