From fee611ad81dc64918a283511fa35ed112d052629 Mon Sep 17 00:00:00 2001 From: Stefano D'Angelo Date: Thu, 1 Feb 2024 18:10:53 +0100 Subject: [PATCH] simplification tentative for macos make --- templates/cmd-make/Makefile | 21 +++------------------ templates/lv2-make/Makefile | 21 +++------------------ templates/vst3-make/Makefile | 19 +++++-------------- 3 files changed, 11 insertions(+), 50 deletions(-) diff --git a/templates/cmd-make/Makefile b/templates/cmd-make/Makefile index e003f60..15ece9d 100644 --- a/templates/cmd-make/Makefile +++ b/templates/cmd-make/Makefile @@ -17,6 +17,9 @@ CC = gcc CFLAGS = -O3 -Wall -Wpedantic -Wextra CFLAGS_ALL = -I${DATA_DIR}/src -I${PLUGIN_DIR} -I${TINYWAV_DIR} -I${MIDI_PARSER_DIR}/include -fPIC ${CFLAGS} ${CFLAGS_EXTRA} +ifeq ($(UNAME_S), Darwin) +CFLAGS_ALL := ${CFLAGS_ALL} -arch arm64 -arch x86_64 +endif LDFLAGS = LDFLAGS_ALL = ${LDFLAGS} ${LDFLAGS_EXTRA} @@ -25,27 +28,9 @@ PROGRAM = ${BUNDLE_NAME}${EXE_SUFFIX} all: build/${PROGRAM} -ifeq ($(UNAME_S), Darwin) - -build/${PROGRAM}: build/tmp/x86_64 build/tmp/arm64 - lipo -create -output $@ $^ - -build/tmp/x86_64: ${COMMON_DIR}/src/main.c ${DATA_DIR}/src/data.h ${PLUGIN_DIR}/plugin.h ${TINYWAV_DIR}/tinywav.c ${MIDI_PARSER_DIR}/src/midi-parser.c | build/tmp - ${CC} ${COMMON_DIR}/src/main.c ${TINYWAV_DIR}/tinywav.c ${MIDI_PARSER_DIR}/src/midi-parser.c -o $@ ${CFLAGS_ALL} ${LDFLAGS_ALL} -arch x86_64 - -build/tmp/arm64: ${COMMON_DIR}/main.c ${DATA_DIR}/data.h ${PLUGIN_DIR}/plugin.h ${TINYWAV_DIR}/tinywav.c ${MIDI_PARSER_DIR}/src/midi-parser.c | build/tmp - ${CC} ${COMMON_DIR}/src/main.c ${TINYWAV_DIR}/tinywav.c ${MIDI_PARSER_DIR}/src/midi-parser.c -o $@ ${CFLAGS_ALL} ${LDFLAGS_ALL} -arch arm64 - -build/tmp: - mkdir -p $@ - -else - build/${PROGRAM}: ${COMMON_DIR}/src/main.c ${DATA_DIR}/src/data.h ${PLUGIN_DIR}/plugin.h ${TINYWAV_DIR}/tinywav.c ${MIDI_PARSER_DIR}/src/midi-parser.c | build ${CC} ${COMMON_DIR}/src/main.c ${TINYWAV_DIR}/tinywav.c ${MIDI_PARSER_DIR}/src/midi-parser.c -o $@ ${CFLAGS_ALL} ${LDFLAGS_ALL} -endif - build: mkdir -p $@ diff --git a/templates/lv2-make/Makefile b/templates/lv2-make/Makefile index 3125e69..f3849a0 100644 --- a/templates/lv2-make/Makefile +++ b/templates/lv2-make/Makefile @@ -27,6 +27,9 @@ PLUGIN_DIR := $(or $(PLUGIN_DIR),src) CFLAGS = -O3 -Wall -Wpedantic -Wextra CFLAGS_ALL = -I${DATA_DIR}/src -I${PLUGIN_DIR} -fPIC ${CFLAGS} ${CFLAGS_EXTRA} +ifeq ($(UNAME_S), Darwin) +CFLAGS_ALL := ${CFLAGS_ALL} -arch arm64 -arch x86_64 +endif LDFLAGS = LDFLAGS_ALL = -shared ${LDFLAGS} ${LDFLAGS_EXTRA} @@ -40,27 +43,9 @@ all: build/${BUNDLE_DIR}/manifest.ttl build/${BUNDLE_DIR}/${DLL_FILE} build/${BUNDLE_DIR}/manifest.ttl: ${DATA_DIR}/data/manifest.ttl.in | build/${BUNDLE_DIR} cat $^ | sed s/@DLL_SUFFIX@/${DLL_SUFFIX}/g > $@ -ifeq ($(UNAME_S), Darwin) - -build/${BUNDLE_DIR}/${DLL_FILE}: build/tmp/x86_64 build/tmp/arm64 | build/${BUNDLE_DIR} - lipo -create -output $@ $^ - -build/tmp/x86_64: ${COMMON_DIR}/src/lv2.c ${DATA_DIR}/src/data.h ${PLUGIN_DIR}/plugin.h | build/tmp - ${CC} ${COMMON_DIR}/src/lv2.c -o $@ ${CFLAGS_ALL} ${LDFLAGS_ALL} -arch x86_64 - -build/tmp/arm64: ${COMMON_DIR}/src/lv2.c ${DATA_DIR}/src/data.h ${PLUGIN_DIR}/plugin.h | build/tmp - ${CC} ${COMMON_DIR}/src/lv2.c -o $@ ${CFLAGS_ALL} ${LDFLAGS_ALL} -arch arm64 - -build/tmp: - mkdir -p $@ - -else - build/${BUNDLE_DIR}/${DLL_FILE}: ${COMMON_DIR}/src/lv2.c ${DATA_DIR}/src/data.h ${PLUGIN_DIR}/plugin.h | build/${BUNDLE_DIR} ${CC} ${COMMON_DIR}/src/lv2.c -o $@ ${CFLAGS_ALL} ${LDFLAGS_ALL} -endif - build/${BUNDLE_DIR}: mkdir -p $@ diff --git a/templates/vst3-make/Makefile b/templates/vst3-make/Makefile index 284c916..d8b42be 100644 --- a/templates/vst3-make/Makefile +++ b/templates/vst3-make/Makefile @@ -29,6 +29,9 @@ PLUGIN_DIR := $(or $(PLUGIN_DIR),src) CFLAGS = -O3 -Wall -Wpedantic -Wextra CFLAGS_ALL = -I${DATA_DIR}/src -I${PLUGIN_DIR} -fPIC ${CFLAGS} ${CFLAGS_EXTRA} +ifeq ($(UNAME_S), Darwin) +CFLAGS_ALL := ${CFLAGS_ALL} -arch arm64 -arch x86_64 +endif LDFLAGS = LDFLAGS_ALL = -shared -lm ${LDFLAGS} ${LDFLAGS_EXTRA} @@ -45,27 +48,15 @@ all: build/${BUNDLE_DIR}/${DLL_FILE} build/${BUNDLE_DIR}/Contents/Info.plist build/${BUNDLE_DIR}/Contents/Info.plist: ${DATA_DIR}/data/Info.plist | build/${BUNDLE_DIR}/Contents cp $^ $@ -build/${BUNDLE_DIR}/${DLL_FILE}: build/tmp/x86_64 build/tmp/arm64 | build/${BUNDLE_DIR}/${DLL_DIR} - lipo -create -output $@ $^ - -build/tmp/x86_64: ${COMMON_DIR}/src/vst3.c ${DATA_DIR}/src/data.h ${PLUGIN_DIR}/plugin.h | build/tmp - ${CC} ${COMMON_DIR}/src/vst3.c -o $@ ${CFLAGS_ALL} ${LDFLAGS_ALL} -arch x86_64 - -build/tmp/arm64: ${COMMON_DIR}/src/vst3.c ${DATA_DIR}/src/data.h ${PLUGIN_DIR}/plugin.h | build/tmp - ${CC} ${COMMON_DIR}/src/vst3.c -o $@ ${CFLAGS_ALL} ${LDFLAGS_ALL} -arch arm64 - -build/tmp build/${BUILD_DIR}/Contents: - mkdir -p $@ - else all: build/${BUNDLE_DIR}/${DLL_FILE} +endif + build/${BUNDLE_DIR}/${DLL_FILE}: ${COMMON_DIR}/src/vst3.c ${DATA_DIR}/src/data.h ${PLUGIN_DIR}/plugin.h | build/${BUNDLE_DIR}/${DLL_DIR} ${CC} ${COMMON_DIR}/src/vst3.c -o $@ ${CFLAGS_ALL} ${LDFLAGS_ALL} -endif - build/${BUNDLE_DIR}/${DLL_DIR}: mkdir -p $@