sm64coopdx/tools/Makefile

75 lines
2.3 KiB
Makefile
Raw Normal View History

2020-05-16 19:30:27 +00:00
UNAME := $(shell uname)
2020-06-07 12:16:09 +00:00
DEBUG ?= 0
2020-05-16 19:30:27 +00:00
ifeq ($(UNAME),Darwin)
2020-06-07 12:16:09 +00:00
OSX_BUILD := -DOSX_BUILD
endif
ifeq ($(DEBUG),1)
OPT_FLAG := -g
else
OPT_FLAG := -O2
2020-05-16 19:30:27 +00:00
endif
2019-08-25 04:46:40 +00:00
CC := gcc
2020-06-07 12:16:09 +00:00
CXX := g++
CFLAGS := -Llib -Iinclude -I../include -I . -Wall -Wextra -Wno-unused-parameter $(OSX_BUILD) -pedantic -std=c99 $(OPT_FLAG) -s
2019-11-03 19:36:27 +00:00
PROGRAMS := n64graphics n64graphics_ci mio0 n64cksum textconv patch_libultra_math iplfontutil aifc_decode aiff_extract_codebook vadpcm_enc tabledesign extract_data_for_mio skyconv
2019-08-25 04:46:40 +00:00
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
2020-06-07 12:16:09 +00:00
n64graphics_ci_CFLAGS := $(OPT_FLAG)
2019-08-25 04:46:40 +00:00
mio0_SOURCES := libmio0.c
mio0_CFLAGS := -DMIO0_STANDALONE
n64cksum_SOURCES := n64cksum.c libmio0.c libsm64.c utils.c
textconv_SOURCES := textconv.c utf8.c hashtable.c
patch_libultra_math_SOURCES := patch_libultra_math.c
iplfontutil_SOURCES := iplfontutil.c
2020-06-07 12:16:09 +00:00
iplfontutil_CFLAGS := $(OPT_FLAG)
2019-08-25 04:46:40 +00:00
aifc_decode_SOURCES := aifc_decode.c
2020-06-07 12:16:09 +00:00
aifc_decode_CFLAGS := $(OPT_FLAG)
2019-08-25 04:46:40 +00:00
aiff_extract_codebook_SOURCES := aiff_extract_codebook.c
2019-09-01 19:50:50 +00:00
tabledesign_SOURCES := sdk-tools/tabledesign/codebook.c sdk-tools/tabledesign/estimate.c sdk-tools/tabledesign/print.c sdk-tools/tabledesign/tabledesign.c
2020-06-13 00:27:56 +00:00
tabledesign_CFLAGS := -Wno-uninitialized -Iaudiofile -Laudiofile -laudiofile -lstdc++ -lm
2019-08-25 04:46:40 +00:00
vadpcm_enc_SOURCES := sdk-tools/adpcm/vadpcm_enc.c sdk-tools/adpcm/vpredictor.c sdk-tools/adpcm/quant.c sdk-tools/adpcm/util.c sdk-tools/adpcm/vencode.c
vadpcm_enc_CFLAGS := -Wno-unused-result -Wno-uninitialized -Wno-sign-compare -Wno-absolute-value
2019-11-03 19:36:27 +00:00
extract_data_for_mio_SOURCES := extract_data_for_mio.c
2020-06-07 12:16:09 +00:00
extract_data_for_mio_CFLAGS := $(OPT_FLAG)
2019-11-03 19:36:27 +00:00
skyconv_SOURCES := skyconv.c n64graphics.c utils.c
2020-06-07 12:16:09 +00:00
skyconv_CFLAGS := $(OPT_FLAG) -lm
2019-11-03 19:36:27 +00:00
LIBAUDIOFILE := audiofile/libaudiofile.a
all: $(LIBAUDIOFILE) $(PROGRAMS)
$(LIBAUDIOFILE):
@$(MAKE) -C audiofile
2019-08-25 04:46:40 +00:00
clean:
$(RM) $(PROGRAMS)
2020-06-07 12:16:09 +00:00
$(RM) gen_asset_list
$(MAKE) -C audiofile clean
2019-08-25 04:46:40 +00:00
define COMPILE
$(1): $($1_SOURCES)
2020-05-16 19:30:27 +00:00
$(CC) $(CFLAGS) $(OSX_BUILD) $$^ -lm -o $$@ $($1_CFLAGS)
2019-08-25 04:46:40 +00:00
endef
2020-06-07 12:16:09 +00:00
# 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))))