Makefile (2287B)
1 include ../util.mk 2 3 HOST_ENV := $(shell uname 2>/dev/null || echo Unknown) 4 HOST_ENV := $(patsubst MINGW%,MinGW,$(HOST_ENV)) 5 6 CC := gcc 7 CXX := g++ 8 CFLAGS := -I . -I sm64tools -Wall -Wextra -Wno-unused-parameter -pedantic -O2 -s 9 LDFLAGS := -lm 10 ALL_PROGRAMS := armips textconv patch_elf_32bit aifc_decode aiff_extract_codebook vadpcm_enc tabledesign extract_data_for_mio skyconv 11 LIBAUDIOFILE := audiofile/libaudiofile.a 12 13 # Only build armips from tools if it is not found on the system 14 ifeq ($(call find-command,armips),) 15 BUILD_PROGRAMS := $(ALL_PROGRAMS) 16 else 17 BUILD_PROGRAMS := $(filter-out armips,$(ALL_PROGRAMS)) 18 endif 19 20 default: all 21 22 textconv_SOURCES := textconv.c utf8.c hashtable.c 23 24 patch_elf_32bit_SOURCES := patch_elf_32bit.c 25 26 aifc_decode_SOURCES := aifc_decode.c 27 28 aiff_extract_codebook_SOURCES := aiff_extract_codebook.c 29 30 tabledesign: $(LIBAUDIOFILE) 31 tabledesign_SOURCES := sdk-tools/tabledesign/codebook.c sdk-tools/tabledesign/estimate.c sdk-tools/tabledesign/print.c sdk-tools/tabledesign/tabledesign.c 32 tabledesign_CFLAGS := -Iaudiofile -Wno-uninitialized 33 tabledesign_LDFLAGS := -Laudiofile -laudiofile -lstdc++ 34 35 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 36 vadpcm_enc_CFLAGS := -Wno-unused-result -Wno-uninitialized -Wno-sign-compare -Wno-absolute-value 37 38 extract_data_for_mio_SOURCES := extract_data_for_mio.c 39 40 skyconv_SOURCES := skyconv.c sm64tools/n64graphics.c sm64tools/utils.c 41 42 armips: CC := $(CXX) 43 armips_SOURCES := armips.cpp 44 armips_CFLAGS := -std=c++11 -fno-exceptions -fno-rtti -pipe 45 armips_LDFLAGS := -pthread 46 ifeq ($(HOST_ENV),MinGW) 47 armips_LDFLAGS += -municode 48 endif 49 50 all-except-recomp: $(LIBAUDIOFILE) $(BUILD_PROGRAMS) 51 52 all: all-except-recomp ido-static-recomp 53 54 clean: 55 $(RM) $(ALL_PROGRAMS) 56 $(MAKE) -C audiofile clean 57 $(MAKE) -C ido-static-recomp clean 58 59 define COMPILE 60 $(1): $($1_SOURCES) 61 $$(CC) $(CFLAGS) $($1_CFLAGS) $$^ -o $$@ $($1_LDFLAGS) $(LDFLAGS) 62 endef 63 64 ido-static-recomp: 65 @$(MAKE) -C ido-static-recomp setup 66 @$(MAKE) -C ido-static-recomp 67 68 $(foreach p,$(BUILD_PROGRAMS),$(eval $(call COMPILE,$(p)))) 69 70 $(LIBAUDIOFILE): 71 @$(MAKE) -C audiofile 72 73 .PHONY: all all-except-recomp clean default ido-static-recomp