2022-03-13 09:17:10 +01:00
|
|
|
include ../util.mk
|
|
|
|
|
|
|
|
HOST_ENV := $(shell uname 2>/dev/null || echo Unknown)
|
|
|
|
HOST_ENV := $(patsubst MINGW%,MinGW,$(HOST_ENV))
|
|
|
|
|
|
|
|
CC := gcc
|
|
|
|
CXX := g++
|
|
|
|
CFLAGS := -I../include -I. -Wall -Wextra -Wno-unused-parameter -Wno-error=implicit-function-declaration -pedantic -std=c99 -O2 -s
|
|
|
|
LDFLAGS := -lm
|
|
|
|
ALL_PROGRAMS := n64graphics n64graphics_ci mio0 n64cksum textconv patch_libultra_math aifc_decode aiff_extract_codebook vadpcm_enc tabledesign extract_data_for_mio skyconv
|
|
|
|
LIBAUDIOFILE := audiofile/libaudiofile.a
|
|
|
|
|
2023-04-23 22:54:27 +02:00
|
|
|
# Attempt to detect OS
|
|
|
|
ifeq ($(OS),Windows_NT)
|
|
|
|
HOST_OS ?= Windows
|
|
|
|
else
|
|
|
|
HOST_OS ?= $(shell uname -s 2>/dev/null || echo Unknown)
|
|
|
|
# some weird MINGW/Cygwin env that doesn't define $OS
|
|
|
|
ifneq (,$(findstring MINGW,HOST_OS))
|
|
|
|
HOST_OS := Windows
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
ifeq ($(HOST_OS),Windows)
|
2023-04-23 22:58:16 +02:00
|
|
|
CFLAGS += -DWIN32 -D_WIN32
|
2023-04-23 22:54:27 +02:00
|
|
|
endif
|
|
|
|
|
2022-03-13 09:17:10 +01:00
|
|
|
BUILD_PROGRAMS := $(ALL_PROGRAMS)
|
2020-06-02 18:44:34 +02:00
|
|
|
|
|
|
|
default: all
|
2019-08-25 06:46:40 +02: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
|
|
|
|
|
|
|
|
mio0_SOURCES := libmio0.c
|
2022-03-13 09:17:10 +01:00
|
|
|
mio0_CFLAGS := -DMIO0_STANDALONE
|
2019-08-25 06:46:40 +02:00
|
|
|
|
2020-06-02 18:44:34 +02:00
|
|
|
n64cksum_SOURCES := n64cksum.c utils.c
|
2022-03-13 09:17:10 +01:00
|
|
|
n64cksum_CFLAGS := -DN64CKSUM_STANDALONE
|
2019-08-25 06:46:40 +02:00
|
|
|
|
|
|
|
textconv_SOURCES := textconv.c utf8.c hashtable.c
|
2022-03-13 09:17:10 +01:00
|
|
|
|
2019-08-25 06:46:40 +02:00
|
|
|
patch_libultra_math_SOURCES := patch_libultra_math.c
|
|
|
|
|
|
|
|
aifc_decode_SOURCES := aifc_decode.c
|
|
|
|
|
|
|
|
aiff_extract_codebook_SOURCES := aiff_extract_codebook.c
|
|
|
|
|
2022-03-13 09:17:10 +01:00
|
|
|
tabledesign: $(LIBAUDIOFILE)
|
2019-09-01 21:50:50 +02:00
|
|
|
tabledesign_SOURCES := sdk-tools/tabledesign/codebook.c sdk-tools/tabledesign/estimate.c sdk-tools/tabledesign/print.c sdk-tools/tabledesign/tabledesign.c
|
2022-03-13 09:17:10 +01:00
|
|
|
tabledesign_CFLAGS := -Iaudiofile -Wno-uninitialized
|
|
|
|
tabledesign_LDFLAGS := -Laudiofile -laudiofile -lstdc++
|
2019-08-25 06:46:40 +02: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
|
2022-03-13 09:17:10 +01:00
|
|
|
vadpcm_enc_CFLAGS := -Wno-unused-result -Wno-uninitialized -Wno-sign-compare -Wno-absolute-value
|
2019-08-25 06:46:40 +02:00
|
|
|
|
2019-11-03 20:36:27 +01:00
|
|
|
extract_data_for_mio_SOURCES := extract_data_for_mio.c
|
|
|
|
|
|
|
|
skyconv_SOURCES := skyconv.c n64graphics.c utils.c
|
|
|
|
|
2022-03-13 09:17:10 +01:00
|
|
|
all-except-recomp: $(LIBAUDIOFILE) $(BUILD_PROGRAMS)
|
2019-08-25 06:46:40 +02:00
|
|
|
|
2022-03-13 09:17:10 +01:00
|
|
|
all: all-except-recomp
|
2020-06-02 18:44:34 +02:00
|
|
|
|
2019-08-25 06:46:40 +02:00
|
|
|
clean:
|
2022-03-13 09:17:10 +01:00
|
|
|
$(RM) $(ALL_PROGRAMS)
|
2020-06-12 22:43:45 +02:00
|
|
|
$(MAKE) -C audiofile clean
|
2019-08-25 06:46:40 +02:00
|
|
|
|
|
|
|
define COMPILE
|
|
|
|
$(1): $($1_SOURCES)
|
2022-03-13 09:17:10 +01:00
|
|
|
$$(CC) $(CFLAGS) $($1_CFLAGS) $$^ -o $$@ $($1_LDFLAGS) $(LDFLAGS)
|
2019-08-25 06:46:40 +02:00
|
|
|
endef
|
|
|
|
|
2022-03-13 09:17:10 +01:00
|
|
|
$(foreach p,$(BUILD_PROGRAMS),$(eval $(call COMPILE,$(p))))
|
|
|
|
|
|
|
|
$(LIBAUDIOFILE):
|
|
|
|
@$(MAKE) -C audiofile
|
2020-06-02 18:44:34 +02:00
|
|
|
|
2022-03-13 09:17:10 +01:00
|
|
|
.PHONY: all all-except-recomp clean default
|