Files
mk64/tools/Makefile
T
MegaMech 3da5a4f343 Add ymls for Torch code generator (#497)
* Add torch

* update jenkinsfile
2024-04-09 21:29:57 -06:00

66 lines
1.8 KiB
Makefile

# Makefile to build tools and recomp
# Compilation flags
CC := gcc
MAKE = make
CFLAGS := -I . -Wall -Wextra -Wno-unused-parameter -pedantic -std=c99 -O2 -s
# Tools to compile
PROGRAMS := mio0 n64graphics displaylist_packer n64cksum tkmk00 extract_data_for_mio
#==============================================================================#
# Source Files and Flags for Each Tool #
#==============================================================================#
n64graphics_SOURCES := n64graphics.c utils.c
n64graphics_CFLAGS := -DN64GRAPHICS_STANDALONE
displaylist_packer_SOURCES := displaylist_packer.c
displaylist_packer_CFLAGS := -Wno-unused-result
mio0_SOURCES := libmio0.c
mio0_CFLAGS := -DMIO0_STANDALONE
tkmk00_SOURCES := libtkmk00.c utils.c
tkmk00_CFLAGS := -DTKMK00_STANDALONE
n64cksum_SOURCES := n64cksum.c utils.c
n64cksum_CFLAGS := -DN64CKSUM_STANDALONE
extract_data_for_mio_SOURCES := extract_data_for_mio.c
ifeq ($(OS),Windows_NT)
DETECTED_OS=windows
# Set Windows temporary directory to its environment variable
export TMPDIR=$(TEMP)
else
UNAME_S := $(shell uname -s)
ifeq ($(UNAME_S),Linux)
DETECTED_OS=linux
else ifeq ($(UNAME_S),Darwin)
DETECTED_OS=macos
endif
endif
# Build tools and recomp
all: $(PROGRAMS)
# Remove generated files
clean:
$(RM) $(PROGRAMS)
#==============================================================================#
# Compile Tools #
#==============================================================================#
# Compile tools based on the foreach loop
define COMPILE =
$(1): $($1_SOURCES)
$(CC) $(CFLAGS) $($1_CFLAGS) $$^ -o $$@
endef
$(foreach p,$(PROGRAMS),$(eval $(call COMPILE,$(p))))
.PHONY: all clean default