diff --git a/templates/android-make/Makefile b/templates/android-make/Makefile index 17d0e7e..6228a16 100644 --- a/templates/android-make/Makefile +++ b/templates/android-make/Makefile @@ -50,6 +50,9 @@ ifeq (${HAS_MIDI_IN}, yes) endif LDFLAGS_ALL += ${LDFLAGS} ${LDFLAGS_EXTRA} +CXX_SRCS = ${COMMON_DIR}/src/jni.cpp +CXX_OBJS = $(addprefix build/obj/, $(notdir $(CXX_SRCS:.c=.o))) + all: build/${BUNDLE_NAME}.apk build/${BUNDLE_NAME}.apk: build/gen/${BUNDLE_NAME}.aligned.apk ${KEY_STORE} @@ -71,8 +74,14 @@ build/apk/my_classes.jar: $(foreach class,$(CLASSES),build/obj/$(CLASSES_PATH)/$ build/obj/${CLASSES_PATH}/MainActivity.class: ${DATA_DIR}/src/MainActivity.java | build/obj ${JC} ${JFLAGS_ALL} -classpath "$(subst $() $(),:,$(JARS))" -d build/obj $^ -build/apk/lib/armeabi-v7a/lib${BUNDLE_NAME}.so: ${COMMON_DIR}/src/jni.cpp ${DATA_DIR}/src/data.h ${PLUGIN_DIR}/plugin.h | build/apk/lib/armeabi-v7a - ${CXX} ${COMMON_DIR}/src/jni.cpp ${CXXFLAGS_ALL} ${LDFLAGS_ALL} -o $@ +build/apk/lib/armeabi-v7a/lib${BUNDLE_NAME}.so: ${CXX_OBJS} | build/apk/lib/armeabi-v7a + ${CXX} $^ -o $@ ${CXXFLAGS_ALL} ${LDFLAGS_ALL} + +.SECONDEXPANSION: + +PERCENT := % +$(C_OBJS): build/obj/%.o: $$(filter $$(PERCENT)/$$(basename $$(notdir $$@)).cpp,$$(CXX_SRCS)) | build/obj + ${CXX} $^ -o $@ -c ${CXXFLAGS_ALL} build/assets/index.html: ${DATA_DIR}/src/index.html | build/assets cp $^ $@ diff --git a/templates/cmd-make/Makefile b/templates/cmd-make/Makefile index fa66dc7..fb07d3e 100644 --- a/templates/cmd-make/Makefile +++ b/templates/cmd-make/Makefile @@ -40,7 +40,7 @@ build/${PROGRAM}: ${C_OBJS} | build PERCENT := % $(C_OBJS): build/obj/%.o: $$(filter $$(PERCENT)/$$(basename $$(notdir $$@)).c,$$(C_SRCS)) | build/obj - ${CC} $^ -o $@ -c ${CFLAGS_ALL} ${LDFLAGS_ALL} + ${CC} $^ -o $@ -c ${CFLAGS_ALL} build build/obj: mkdir -p $@ diff --git a/templates/lv2-make/Makefile b/templates/lv2-make/Makefile index d9d9462..5aed04d 100644 --- a/templates/lv2-make/Makefile +++ b/templates/lv2-make/Makefile @@ -40,15 +40,24 @@ BUNDLE_DIR = ${BUNDLE_NAME}.lv2 DLL_FILE = ${BUNDLE_NAME}${DLL_SUFFIX} +C_SRCS = ${COMMON_DIR}/src/lv2.c +C_OBJS = $(addprefix build/obj/, $(notdir $(C_SRCS:.c=.o))) + 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 > $@ -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} +build/${BUNDLE_DIR}/${DLL_FILE}: ${C_OBJS} | build/${BUNDLE_DIR} + ${CC} $^ -o $@ ${CFLAGS_ALL} ${LDFLAGS_ALL} -build/${BUNDLE_DIR}: +.SECONDEXPANSION: + +PERCENT := % +$(C_OBJS): build/obj/%.o: $$(filter $$(PERCENT)/$$(basename $$(notdir $$@)).c,$$(C_SRCS)) | build/obj + ${CC} $^ -o $@ -c ${CFLAGS_ALL} + +build/${BUNDLE_DIR} build/obj: mkdir -p $@ clean: diff --git a/templates/vst3-make/Makefile b/templates/vst3-make/Makefile index c7c624e..ffc828d 100644 --- a/templates/vst3-make/Makefile +++ b/templates/vst3-make/Makefile @@ -43,6 +43,9 @@ BUNDLE_DIR = ${BUNDLE_NAME}.vst3 DLL_DIR = Contents/${PLATFORM} DLL_FILE = ${DLL_DIR}/${BUNDLE_NAME}${DLL_SUFFIX} +C_SRCS = ${COMMON_DIR}/src/vst3.c +C_OBJS = $(addprefix build/obj/, $(notdir $(C_SRCS:.c=.o))) + ifeq ($(UNAME_S), Darwin) all: build/${BUNDLE_DIR}/${DLL_FILE} build/${BUNDLE_DIR}/Contents/Info.plist @@ -56,10 +59,16 @@ 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} +build/${BUNDLE_DIR}/${DLL_FILE}: ${C_OBJS} | build/${BUNDLE_DIR}/${DLL_DIR} + ${CC} $^ -o $@ ${CFLAGS_ALL} ${LDFLAGS_ALL} -build/${BUNDLE_DIR}/${DLL_DIR}: +.SECONDEXPANSION: + +PERCENT := % +$(C_OBJS): build/obj/%.o: $$(filter $$(PERCENT)/$$(basename $$(notdir $$@)).c,$$(C_SRCS)) | build/obj + ${CC} $^ -o $@ -c ${CFLAGS_ALL} + +build/${BUNDLE_DIR}/${DLL_DIR} build/obj: mkdir -p $@ clean: diff --git a/templates/web-make/Makefile b/templates/web-make/Makefile index 040f160..a8158d9 100644 --- a/templates/web-make/Makefile +++ b/templates/web-make/Makefile @@ -29,6 +29,9 @@ LDFLAGS_ALL += -Wl,--export=processor_midi_msg_in endif LDFLAGS_ALL += ${LDFLAGS} ${LDFLAGS_EXTRA} +C_SRCS = ${COMMON_DIR}/src/processor.c +C_OBJS = $(addprefix build/obj/, $(notdir $(C_SRCS:.c=.o))) + ALL = build/${BUNDLE_NAME}.wasm build/${BUNDLE_NAME}_processor.js build/${BUNDLE_NAME}.js default: all @@ -37,8 +40,14 @@ default: all all: ${ALL} -build/${BUNDLE_NAME}.wasm: ${COMMON_DIR}/src/memset.h ${COMMON_DIR}/src/walloc.h ${COMMON_DIR}/src/processor.c ${DATA_DIR}/src/data.h ${PLUGIN_DIR}/plugin.h | build - ${CC} ${COMMON_DIR}/src/processor.c -o $@ ${CFLAGS_ALL} ${LDFLAGS_ALL} +build/${BUNDLE_NAME}.wasm: ${C_OBJS} | build + ${CC} $^ -o $@ ${CFLAGS_ALL} ${LDFLAGS_ALL} + +.SECONDEXPANSION: + +PERCENT := % +$(C_OBJS): build/obj/%.o: $$(filter $$(PERCENT)/$$(basename $$(notdir $$@)).c,$$(C_SRCS)) | build/obj + ${CC} $^ -o $@ -c ${CFLAGS_ALL} build/${BUNDLE_NAME}_processor.js: ${DATA_DIR}/src/processor.js | build cp $^ $@ @@ -46,7 +55,7 @@ build/${BUNDLE_NAME}_processor.js: ${DATA_DIR}/src/processor.js | build build/${BUNDLE_NAME}.js: ${DATA_DIR}/src/module.js | build cp $^ $@ -build: +build build/obj: mkdir -p $@ clean: