Files
Diddy-Kong-Racing/tools/Makefile
T

65 lines
2.0 KiB
Makefile
Raw Normal View History

2024-04-03 19:16:44 -04:00
OPT := -O2
2020-05-27 19:14:56 -05:00
CC := gcc
CXX := g++
2024-04-03 19:16:44 -04:00
CFLAGS := -I . -Wall -Wextra -Wno-unused-parameter -pedantic -std=c99 $(OPT) -s
# List of specific errors to ignore
IGNORE_W_ERRORS := -Wno-unused-parameter -Wno-misleading-indentation -Wno-extra
CXXFLAGS := -I . -I dkr_assets_tool_src/ -Werror -Wall $(IGNORE_W_ERRORS) -std=c++17 $(OPT) -lpcre2-8
2020-05-27 19:14:56 -05:00
LDFLAGS := -lm
2022-10-30 00:33:21 +00:00
PROGRAMS := n64crc dkr_assets_tool
2022-03-18 18:35:32 -04:00
2024-04-03 19:16:44 -04:00
BUILD_DIR := dkr_assets_tool_src/_build
2022-03-18 18:35:32 -04:00
ENUMS_HEADER := ../include/enums.h
# From: https://stackoverflow.com/questions/2483182/recursive-wildcards-in-gnu-make/18258352#18258352
rwildcard=$(foreach d,$(wildcard $(1:=/*)),$(call rwildcard,$d,$2) $(filter $(subst *,%,$2),$d))
2020-05-27 19:14:56 -05:00
default: all
n64crc_SOURCES := n64crc.c
all: $(PROGRAMS) recomp flips
2020-05-27 19:14:56 -05:00
# make clean for flips doesn't work, so just manually delete it on a clean.
2020-05-27 19:14:56 -05:00
clean:
2022-10-30 00:33:21 +00:00
rm -Rf $(PROGRAMS) $(BUILD_DIR)
@make -C ido-static-recomp clean VERSION=5.3
rm -f Flips/flips
2020-05-27 19:14:56 -05:00
2022-03-26 17:20:19 -04:00
distclean: clean
2022-03-18 18:35:32 -04:00
n64crc: n64crc.c
$(CC) $(CFLAGS) -o $@ $< $(LDFLAGS)
2020-05-27 19:14:56 -05:00
2024-04-03 19:16:44 -04:00
dkr_assets_tool_CPP_FILES := $(call rwildcard,dkr_assets_tool_src,*.cpp)
2024-04-03 19:16:44 -04:00
dkr_assets_tool_C_FILES := $(call rwildcard,dkr_assets_tool_src,*.c)
2022-10-30 00:33:21 +00:00
2022-03-18 18:35:32 -04:00
dkr_assets_tool_OBJ_FILES := $(foreach file,$(dkr_assets_tool_C_FILES),$(BUILD_DIR)/$(file:.c=.o)) \
$(foreach file,$(dkr_assets_tool_CPP_FILES),$(BUILD_DIR)/$(file:.cpp=.o))
DUMMY != mkdir -p $(sort $(dir $(dkr_assets_tool_OBJ_FILES)))
$(BUILD_DIR)/%.o: %.c
2022-10-30 00:33:21 +00:00
$(CC) -c $^ -o $@ $(CFLAGS)
2022-03-18 18:35:32 -04:00
$(BUILD_DIR)/%.o: %.cpp
2022-10-30 00:33:21 +00:00
$(CXX) -c $< -o $@ $(CXXFLAGS)
2022-03-18 18:35:32 -04:00
dkr_assets_tool: $(dkr_assets_tool_OBJ_FILES)
2022-10-30 03:32:57 +00:00
$(CXX) $^ -o $@ $(CXXFLAGS) $(LDFLAGS) -lpthread
2020-05-27 19:14:56 -05:00
#recomp likes to echo some strings on all calls to make, the >/dev/null will silence them.
recomp:
@make -C ido-static-recomp VERSION=5.3 RELEASE=1 setup >/dev/null
@make -C ido-static-recomp VERSION=5.3 RELEASE=1 >/dev/null
#Builds the CLI only version of flips. It will complain about it being debug, but this makes it much faster compile.
flips:
@make -s -C Flips TARGET=cli
2022-03-26 17:20:19 -04:00
.PHONY: all clean distclean default
2022-03-18 18:35:32 -04:00