diff --git a/.gitignore b/.gitignore index 8052edb32..646d8828e 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ hiro/qt/qt.moc +.DS_store diff --git a/bsnes/GNUmakefile b/bsnes/GNUmakefile index 9450f39ce..2b365bc9e 100644 --- a/bsnes/GNUmakefile +++ b/bsnes/GNUmakefile @@ -60,5 +60,8 @@ include $(ui)/GNUmakefile -include obj/*.d clean: +ifeq ($(platform),macos) + rm -rf out/$(name).app +endif $(call delete,obj/*) $(call delete,out/*) diff --git a/bsnes/obj/.gitignore b/bsnes/obj/.gitignore index 6142305dc..d6b7ef32c 100644 --- a/bsnes/obj/.gitignore +++ b/bsnes/obj/.gitignore @@ -1,2 +1,2 @@ -*.o -*.d +* +!.gitignore diff --git a/bsnes/out/.gitignore b/bsnes/out/.gitignore index 1aeaff24b..d6b7ef32c 100644 --- a/bsnes/out/.gitignore +++ b/bsnes/out/.gitignore @@ -1,2 +1,2 @@ -bsnes -bsnes.exe +* +!.gitignore diff --git a/bsnes/target-bsnes/GNUmakefile b/bsnes/target-bsnes/GNUmakefile index c693a2ed9..fe303d13c 100644 --- a/bsnes/target-bsnes/GNUmakefile +++ b/bsnes/target-bsnes/GNUmakefile @@ -21,7 +21,13 @@ obj/ui-resource.o: $(ui)/resource/resource.cpp all: $(hiro.objects) $(ruby.objects) $(objects) $(info Linking out/$(name) ...) +ifeq ($(universal),true) + +@$(compiler) -o obj/$(name).arm64 $(hiro.objects) $(ruby.objects) $(objects) $(hiro.options) $(ruby.options) $(options) $(flags.arm64) + +@$(compiler) -o obj/$(name).amd64 $(hiro.objects) $(ruby.objects) $(objects) $(hiro.options) $(ruby.options) $(options) $(flags.amd64) + lipo -create -output out/$(name) obj/$(name).arm64 obj/$(name).amd64 +else +@$(compiler) -o out/$(name) $(hiro.objects) $(ruby.objects) $(objects) $(hiro.options) $(ruby.options) $(options) +endif ifeq ($(platform),macos) rm -rf out/$(name).app mkdir -p out/$(name).app/Contents/MacOS/ diff --git a/hiro/GNUmakefile b/hiro/GNUmakefile index 04837b274..918598e34 100755 --- a/hiro/GNUmakefile +++ b/hiro/GNUmakefile @@ -66,11 +66,22 @@ hiro.objects := \ $(object.path)/hiro-$(hiro).o \ $(if $(filter windows,$(hiro)),$(object.path)/hiro-resource.o) +ifeq ($(universal),true) + compile.hiro = \ + $(strip \ + $(compiler) $(hiro.flags) $(flags.arm64) $(flags) $(flags.deps) -c $< -o $@.arm64 && \ + $(compiler) $(hiro.flags) $(flags.amd64) $(flags) $(flags.deps) -c $< -o $@.amd64 && \ + lipo -create -output $@ $@.arm64 $@.amd64 \ + ) +else + compile.hiro = $(strip $(compiler) $(hiro.flags) $(flags) $(flags.deps) -c $< -o $@) +endif + $(object.path)/hiro-$(hiro).o: $(hiro.path)/hiro.cpp $(if $(filter qt%,$(hiro)),$(info Compiling $(hiro.path)/qt/qt.moc ...)) $(if $(filter qt%,$(hiro)),@$(moc) -i -o $(hiro.path)/qt/qt.moc $(hiro.path)/qt/qt.hpp) $(info Compiling $< ...) - @$(compiler) $(hiro.flags) $(flags) $(flags.deps) -c $< -o $@ + @$(call compile.hiro) $(object.path)/hiro-resource.o: $(hiro.resource) $(info Compiling $< ...) diff --git a/nall/GNUmakefile b/nall/GNUmakefile index f064ae772..2bbc3176b 100755 --- a/nall/GNUmakefile +++ b/nall/GNUmakefile @@ -124,6 +124,9 @@ endif ifeq ($(platform),macos) flags += -stdlib=libc++ options += -lc++ -lobjc + flags.arm64 += -target x86_64-apple-macos10.12 + flags.amd64 += -target arm64-apple-macos11 + universal := true endif # linux settings @@ -166,14 +169,28 @@ nall.verbose: @$(call compile) # function compile([arguments]) -compile = \ - $(strip \ - $(if $(filter %.c,$<), \ - $(compiler.c) $(flags.deps) $(flags) $1 -c $< -o $@ \ - ,$(if $(filter %.cpp,$<), \ - $(compiler.cpp) $(flags.deps) $(flags) $1 -c $< -o $@ \ - )) \ - ) +ifeq ($(universal),true) + compile = \ + $(strip \ + $(if $(filter %.c,$<), \ + $(compiler.c) $(flags.arm64) $(flags.deps) $(flags) $1 -c $< -o $@.arm64 && \ + $(compiler.c) $(flags.amd64) $(flags.deps) $(flags) $1 -c $< -o $@.amd64 && \ + ,$(if $(filter %.cpp,$<), \ + $(compiler.cpp) $(flags.arm64) $(flags.deps) $(flags) $1 -c $< -o $@.arm64 && \ + $(compiler.cpp) $(flags.amd64) $(flags.deps) $(flags) $1 -c $< -o $@.amd64 && \ + )) \ + lipo -create -output $@ $@.arm64 $@.amd64 \ + ) +else + compile = \ + $(strip \ + $(if $(filter %.c,$<), \ + $(compiler.c) $(flags.deps) $(flags) $1 -c $< -o $@ \ + ,$(if $(filter %.cpp,$<), \ + $(compiler.cpp) $(flags.deps) $(flags) $1 -c $< -o $@ \ + )) \ + ) +endif # function rwildcard(directory, pattern) rwildcard = \ diff --git a/ruby/GNUmakefile b/ruby/GNUmakefile index f27418b2f..406d275de 100755 --- a/ruby/GNUmakefile +++ b/ruby/GNUmakefile @@ -71,9 +71,20 @@ endif ruby.objects := $(object.path)/ruby.o +ifeq ($(universal),true) + compile.ruby = \ + $(strip \ + $(compiler) $(ruby.flags) $(flags.arm64) $(flags) $(flags.deps) -c $< -o $@.arm64 && \ + $(compiler) $(ruby.flags) $(flags.amd64) $(flags) $(flags.deps) -c $< -o $@.amd64 && \ + lipo -create -output $@ $@.arm64 $@.amd64 \ + ) +else + compile.ruby = $(strip $(compiler) $(ruby.flags) $(flags) $(flags.deps) -c $< -o $@) +endif + $(object.path)/ruby.o: $(ruby.path)/ruby.cpp $(call rwildcard,$(ruby.path)) $(info Compiling $< ...) - @$(compiler) $(ruby.flags) $(flags) $(flags.deps) -c $< -o $@ + @$(call compile.ruby) ruby.verbose: $(info ruby Drivers:)