From 47b03f1c7521675dacf6b856433cffa14d796db5 Mon Sep 17 00:00:00 2001 From: MysterD Date: Sun, 23 Apr 2023 13:54:27 -0700 Subject: [PATCH] Force windows defines on tools --- tools/Makefile | 14 ++++++++++++++ tools/audiofile/Makefile | 20 ++++++++++++++++++-- tools/sdk-tools/adpcm/Makefile | 14 ++++++++++++++ tools/sdk-tools/tabledesign/Makefile | 14 ++++++++++++++ 4 files changed, 60 insertions(+), 2 deletions(-) diff --git a/tools/Makefile b/tools/Makefile index 469a0191..1ac9c8cb 100644 --- a/tools/Makefile +++ b/tools/Makefile @@ -10,6 +10,20 @@ 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 +# 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) + CFLAGS += -DWIN32 -D_WIN32 -D__CYGWIN__ +endif + BUILD_PROGRAMS := $(ALL_PROGRAMS) default: all diff --git a/tools/audiofile/Makefile b/tools/audiofile/Makefile index 8a11925e..5e204324 100644 --- a/tools/audiofile/Makefile +++ b/tools/audiofile/Makefile @@ -1,11 +1,27 @@ CXX := g++ +CFLAGS := + +# 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) + CFLAGS += -DWIN32 -D_WIN32 -D__CYGWIN__ +endif + libaudiofile.a: audiofile.o $(AR) rcs $@ $^ audiofile.o: audiofile.cpp audiofile.h aupvlist.h - #$(CXX) -std=c++11 -DNDEBUG -fno-rtti -fno-exceptions -fvisibility-inlines-hidden -O2 -I. -c audiofile.cpp - $(CXX) -std=c++11 -O2 -I. -c $< -o $@ + #$(CXX) $(CFLAGS) -std=c++11 -DNDEBUG -fno-rtti -fno-exceptions -fvisibility-inlines-hidden -O2 -I. -c audiofile.cpp + $(CXX) $(CFLAGS) -std=c++11 -O2 -I. -c $< -o $@ clean: $(RM) audiofile.o libaudiofile.a diff --git a/tools/sdk-tools/adpcm/Makefile b/tools/sdk-tools/adpcm/Makefile index b97991be..9fee76d1 100644 --- a/tools/sdk-tools/adpcm/Makefile +++ b/tools/sdk-tools/adpcm/Makefile @@ -8,6 +8,20 @@ IRIX_CFLAGS := -fullwarn -woff 515,608,658,799 -Wab,-r4300_mul -g -Xcpluscomm -m NATIVE_CC := gcc NATIVE_CFLAGS := -g -Wall -O2 -Wno-unused-result -Wno-uninitialized +# 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) + NATIVE_CFLAGS += -DWIN32 -D_WIN32 -D__CYGWIN__ +endif + default: native all: irix native diff --git a/tools/sdk-tools/tabledesign/Makefile b/tools/sdk-tools/tabledesign/Makefile index a06d70af..afd0a92e 100644 --- a/tools/sdk-tools/tabledesign/Makefile +++ b/tools/sdk-tools/tabledesign/Makefile @@ -8,6 +8,20 @@ IRIX_CFLAGS := -fullwarn -Wab,-r4300_mul -Xcpluscomm -mips1 -O2 NATIVE_CC := gcc NATIVE_CFLAGS := -Wall -Wno-uninitialized -O2 +# 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) + NATIVE_CFLAGS += -DWIN32 -D_WIN32 -D__CYGWIN__ +endif + LDFLAGS := -lm -laudiofile default: native