simplification tentative for macos make

This commit is contained in:
Stefano D'Angelo 2024-02-01 18:10:53 +01:00
parent 5c4653546d
commit fee611ad81
3 changed files with 11 additions and 50 deletions

View File

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

View File

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

View File

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