Mercurial > hg > beaglert
changeset 326:bd54819ccfa7 prerelease
Makefile: run does not re-link. Faster check for libpd
author | Giulio Moro <giuliomoro@yahoo.it> |
---|---|
date | Fri, 03 Jun 2016 17:01:36 +0100 |
parents | a9905703219d |
children | ccfcf1303f12 |
files | Makefile |
diffstat | 1 files changed, 14 insertions(+), 12 deletions(-) [+] |
line wrap: on
line diff
--- a/Makefile Fri Jun 03 14:43:58 2016 +0100 +++ b/Makefile Fri Jun 03 17:01:36 2016 +0100 @@ -26,6 +26,9 @@ $(shell rm -rf $(PROJECT_DIR)) $(shell cp -r examples/$(EXAMPLE) $(PROJECT_DIR)) endif +OUTPUT_FILE=$(PROJECT_DIR)/$(PROJECT) +COMMAND_LINE_OPTIONS=$(CL) +RUN_COMMAND=$(OUTPUT_FILE) $(COMMAND_LINE_OPTIONS) SCREEN_NAME?=BeagleRT @@ -36,9 +39,10 @@ LIBS := -lrt -lnative -lxenomai -lsndfile # refresh library cache and check if libpd is there -TEST_LIBPD := $(shell ldconfig; ldconfig -p | grep "libpd\.so") -ifeq ($(strip $(TEST_LIBPD)), ) -else +#TEST_LIBPD := $(shell ldconfig; ldconfig -p | grep "libpd\.so") # safest but slower way of checking +LIBPD_PATH = /usr/lib/libpd.so +TEST_LIBPD := $(shell which $(LIBPD_PATH)) +ifneq ($(strip $(TEST_LIBPD)), ) # if libpd is there, link it in LIBS += -lpd -lpthread_rt endif @@ -159,7 +163,7 @@ # function, and conditionally call one of two recursive make targets depending on whether # we want to link in the default main file or not. The kludge is the mess of a shell script # line below. Surely there's a better way to do this? -Bela: $(CORE_ASM_OBJS) $(CORE_OBJS) $(ASM_OBJS) $(C_OBJS) $(CPP_OBJS) $(STATIC_LIBS) $(DEFAULT_MAIN_OBJS) +$(OUTPUT_FILE): $(CORE_ASM_OBJS) $(CORE_OBJS) $(ASM_OBJS) $(C_OBJS) $(CPP_OBJS) $(STATIC_LIBS) $(DEFAULT_MAIN_OBJS) $(eval DEFAULT_MAIN_CONDITIONAL := $(shell bash -c 'if [ `nm $(PROJECT_DIR)/build/*.o | grep -w T | grep -w main | wc -l` == '0' ]; then echo "$(DEFAULT_MAIN_OBJS)"; else echo ""; fi')) @echo 'Invoking: C++ linker' @$(CXX) $(SYNTAX_FLAG) -L/usr/xenomai/lib -L/usr/arm-linux-gnueabihf/lib -L/usr/arm-linux-gnueabihf/lib/xenomai -L/usr/lib/arm-linux-gnueabihf -pthread -Wpointer-arith -o "$(PROJECT_DIR)/$(PROJECT)" $(CORE_ASM_OBJS) $(CORE_OBJS) $(DEFAULT_MAIN_CONDITIONAL) $(ASM_OBJS) $(C_OBJS) $(CPP_OBJS) $(STATIC_LIBS) $(LIBS) @@ -171,20 +175,18 @@ # Remove the project's build objects & binary projectclean: - -$(RM) $(PROJECT_DIR)/build/* $(PROJECT_DIR)/$(PROJECT) + -$(RM) $(PROJECT_DIR)/build/* $(OUTPUT_FILE) -@echo ' ' # Remove all the built objects, including the core Bela objects distclean: - -$(RM) build/source/* $(CORE_OBJS) $(CORE_CPP_DEPS) $(DEFAULT_MAIN_OBJS) $(DEFAULT_MAIN_CPP_DEPS) Bela + -$(RM) build/source/* $(CORE_OBJS) $(CORE_CPP_DEPS) $(DEFAULT_MAIN_OBJS) $(DEFAULT_MAIN_CPP_DEPS) $(OUTPUT_FILE) -@echo ' ' -OUTPUT_FILE="$(PROJECT_DIR)/$(PROJECT)" -$(OUTPUT_FILE): Bela -COMMAND_LINE_OPTIONS=$(CL) -RUN_COMMAND=$(OUTPUT_FILE) $(COMMAND_LINE_OPTIONS) +Bela: $(OUTPUT_FILE) + runfg: run -run: stop $(OUTPUT_FILE) +run: stop Bela echo "Running $(RUN_COMMAND)" $(RUN_COMMAND) runscreen: stop $(OUTPUT_FILE) @@ -212,5 +214,5 @@ post-build: # Nothing to do here (for now) -.PHONY: all clean distclean projectclean dependents debug run +.PHONY: all clean distclean projectclean dependents debug run runfg runscreen stop .SECONDARY: post-build