Mercurial > hg > beaglert
changeset 374:ecad1ea0382a prerelease
Makefile improved checks. It does not fail after distclean
author | Giulio Moro <giuliomoro@yahoo.it> |
---|---|
date | Fri, 10 Jun 2016 00:02:48 +0100 |
parents | 361d0c2335cf |
children | 768acdeea362 |
files | Makefile |
diffstat | 1 files changed, 19 insertions(+), 11 deletions(-) [+] |
line wrap: on
line diff
--- a/Makefile Thu Jun 09 17:31:44 2016 +0100 +++ b/Makefile Fri Jun 10 00:02:48 2016 +0100 @@ -10,22 +10,31 @@ # if the PROJECT variable is not set, throw an error and exit # otherwise, we could have unexpected data loss when calling clean without it -ifndef PROJECT - ifndef EXAMPLE - $(warning PROJECT or EXAMPLE should be set in order to build) +NO_PROJECT_TARGETS=distclean stop +ifeq (,$(filter $(NO_PROJECT_TARGETS),$(MAKECMDGOALS))) + ifndef PROJECT + ifndef EXAMPLE + $(error PROJECT or EXAMPLE should be set when the target is not one of: `$(NO_PROJECT_TARGETS)`) + endif endif endif -ifndef EXAMPLE +# if we are building an example, just copy it to the projects/ folder +# and tehn treat it as a project +ifdef EXAMPLE + PROJECT?=exampleTempProject + PROJECT_DIR?=$(abspath projects/$(PROJECT)) + $(shell mkdir -p $(abspath projects) + $(shell rm -rf $(PROJECT_DIR)) + $(shell cp -r examples/$(EXAMPLE) $(PROJECT_DIR)) +else PROJECT_DIR := $(abspath projects/$(PROJECT)) endif -ifdef EXAMPLE - PROJECT?=exampleTempProject - PROJECT_DIR?=$(abspath projects/$(PROJECT)) - $(shell rm -rf $(PROJECT_DIR)) - $(shell cp -r examples/$(EXAMPLE) $(PROJECT_DIR)) +ifdef PROJECT + $(shell mkdir -p $(PROJECT_DIR)/build) endif + OUTPUT_FILE?=$(PROJECT_DIR)/$(PROJECT) COMMAND_LINE_OPTIONS?=$(CL) RUN_COMMAND?=$(OUTPUT_FILE) $(COMMAND_LINE_OPTIONS) @@ -33,8 +42,7 @@ BELA_AUDIO_THREAD_NAME?=bela-audio SCREEN_NAME?=BeagleRT -#TODO: run these lines only if the command is not syntax or -$(shell mkdir -p $(PROJECT_DIR)/build) + RM := rm -rf STATIC_LIBS := ./libprussdrv.a ./libNE10.a LIBS := -lrt -lnative -lxenomai -lsndfile