This commit is contained in:
John Chadwick 2021-02-18 19:22:19 +11:00 committed by GitHub
commit 3ce0eecc2e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 63 additions and 14 deletions

1
.gitignore vendored
View File

@ -1 +1,2 @@
hiro/qt/qt.moc
.DS_store

View File

@ -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/*)

View File

@ -1,2 +1,2 @@
*.o
*.d
*
!.gitignore

View File

@ -1,2 +1,2 @@
bsnes
bsnes.exe
*
!.gitignore

View File

@ -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/

View File

@ -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 $< ...)

View File

@ -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 = \

View File

@ -91,9 +91,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:)