Mac aware make file

This commit is contained in:
Matty Wright 2025-03-04 10:10:04 -05:00
parent d95f7a794a
commit 5f4d088804
2 changed files with 20 additions and 4 deletions

View File

@ -1,4 +1,3 @@
.PHONY : default debug clean .PHONY : default debug clean
make = make make = make
@ -10,10 +9,20 @@ else ifeq ($(plt), OpenBSD)
endif endif
default: default:
ifeq ($(plt), Darwin)
@$(make) -C src -f Mac.mk
@$(make) -C src -f Makefile predixy
else
@$(make) -C src -f Makefile @$(make) -C src -f Makefile
endif
debug: debug:
@$(make) -C src -f Makefile debug ifeq ($(plt), Darwin)
@$(make) -C src -f Mac.mk
@$(make) -C src -f Makefile LVL=-g predixy
else
@$(make) -C src -f Makefile LVL=-g
endif
clean: clean:
@$(make) -C src -f Makefile clean @$(make) -C src -f Makefile clean

View File

@ -22,7 +22,10 @@ ifeq ($(EV), auto)
else ifeq ($(plt), Darwin) else ifeq ($(plt), Darwin)
EV = kqueue EV = kqueue
Opts += -D_PREDIXY_BACKTRACE_ Opts += -D_PREDIXY_BACKTRACE_
LDLIBCPP = -static-libstdc++ CXX = c++
CFLAGS += -stdlib=libc++
LDLIBCPP =
INCFLAGS += -I/Library/Developer/CommandLineTools/SDKs/MacOSX15.2.sdk/usr/include/c++/v1 -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk
else ifeq ($(plt), FreeBSD) else ifeq ($(plt), FreeBSD)
EV = kqueue EV = kqueue
Opts += -D_PREDIXY_BACKTRACE_ Opts += -D_PREDIXY_BACKTRACE_
@ -102,6 +105,10 @@ default: $(target)
$(target): $(objs) $(target): $(objs)
$(CXX) $(CFLAGS) -o $@ $^ $(LDFLAGS) $(CXX) $(CFLAGS) -o $@ $^ $(LDFLAGS)
# Special target for macOS to use pre-compiled objects
predixy:
$(CXX) $(CFLAGS) -o $(target) *.o $(LDFLAGS)
debug: debug:
@make LVL=-g @make LVL=-g
@ -110,5 +117,5 @@ clean:
@echo Done. @echo Done.
%.o : %.cpp %.o : %.cpp
$(CXX) $(CFLAGS) -c $^ $(INCFLAGS) $(CXX) $(CFLAGS) $(INCFLAGS) -c $^