Skip to content

Commit

Permalink
fix: make opendolboot compilable on macos
Browse files Browse the repository at this point in the history
  • Loading branch information
DacoTaco committed Mar 31, 2024
1 parent dc1465a commit dc3bdcc
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions tools/OpenDolBoot/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -20,21 +20,29 @@ INCLUDE := $(foreach dir,$(INCLUDES), -iquote $(CURDIR)/$(dir)) \
#default commands/settings
SILENTMSG = @echo
BIN2S = bin2s
CFLAGS = -Os -s -static -static-libstdc++ -static-libgcc
CXXFLAGS = $(CFLAGS)
CFLAGS = -Os -s
CXXFLAGS = -std=c++14
CC = $(PREFIX)gcc
CXX = $(PREFIX)g++
LD = $(PREFIX)ld
ifeq ($(OUTPUT),)
OUTPUT := $(TARGET)
endif

#for everything except mac, we will try and build a single, statically linked exe
#macos doesn't support it : https://stackoverflow.com/questions/5259249/creating-static-mac-os-x-c-build
ifneq ($(HOST),Darwin)
CFLAGS += -static -static-libstdc++ -static-libgcc
else
BIN2S_FLAGS := --apple-llvm
endif

#windows, msys, mingw,...
ifeq ($(HOST), WIN32)
OUTPUT := $(TARGET).exe
ifneq ($(MINGW_AVAIL),)
PREFIX := x86_64-w64-mingw32-
CFLAGS += -lws2_32
PREFIX := x86_64-w64-mingw32-
CFLAGS += -lws2_32
endif
endif

Expand All @@ -53,4 +61,4 @@ $(NANDLDR_SSRC): $(NANDLDR_PATH)
@$(BIN2S) $(BIN2S_FLAGS) -H $(NANDLDR_HSRC) $< > $@

$(OUTPUT): $(CPPFILES) $(CFILES) $(SFILES) $(NANDLDR_SSRC)
@$(CXX) $(INCLUDE) $^ -o $@ $(CFLAGS)
@$(CXX) $(INCLUDE) $^ -o $@ $(CFLAGS) $(CXXFLAGS)

0 comments on commit dc3bdcc

Please sign in to comment.