# Brainstem2Example C CC = gcc ROOT = . TARGET = BrainStem2Example OUT := linux_$(TARGET) DBG_DST := $(OUT)/Debug REL_DST := $(OUT)/Release # We are looking for the BrainStem2 library in # a lib folder sibling to this makefile. Change # these defines to point somewhere else if this # is not the case. LIBRARIES := -Llib/ -lBrainStem2 -lBrainStem2_CCA INCLUDES := -Ilib # We add the current directory to the rpath expecting # that libBrainStem2.so will be copied into the build # folder. If this is not the case adjust the rpath # do match your needs. CFLAGS = -Wall -Werror -Wl,-rpath,. $(INCLUDES) all : dirs make app app : debug release .PHONY : debug debug: dirs $(CC) $(CFLAGS) BrainStem2Example/main.c $(LIBRARIES) -o $(DBG_DST)/BrainStem2Example cp lib/libBrainStem2.so $(DBG_DST) cp lib/libBrainStem2_CCA.so $(DBG_DST) .PHONY : release release: dirs $(CC) $(CFLAGS) -DNDEBUG BrainStem2Example/main.c $(LIBRARIES) -o $(REL_DST)/BrainStem2Example cp lib/libBrainStem2.so $(REL_DST) cp lib/libBrainStem2_CCA.so $(REL_DST) .PHONY : dirs dirs: mkdir -p $(DBG_DST) mkdir -p $(REL_DST) clean: rm -rf $(OUT)