comparison Makefile @ 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 58742af56d37
children a430a16d2c02
comparison
equal deleted inserted replaced
371:361d0c2335cf 374:ecad1ea0382a
8 8
9 # set the project to be compiled by calling: make all PROJECT=<project_name> 9 # set the project to be compiled by calling: make all PROJECT=<project_name>
10 10
11 # if the PROJECT variable is not set, throw an error and exit 11 # if the PROJECT variable is not set, throw an error and exit
12 # otherwise, we could have unexpected data loss when calling clean without it 12 # otherwise, we could have unexpected data loss when calling clean without it
13 ifndef PROJECT 13 NO_PROJECT_TARGETS=distclean stop
14 ifndef EXAMPLE 14 ifeq (,$(filter $(NO_PROJECT_TARGETS),$(MAKECMDGOALS)))
15 $(warning PROJECT or EXAMPLE should be set in order to build) 15 ifndef PROJECT
16 ifndef EXAMPLE
17 $(error PROJECT or EXAMPLE should be set when the target is not one of: `$(NO_PROJECT_TARGETS)`)
18 endif
16 endif 19 endif
17 endif 20 endif
18 21
19 ifndef EXAMPLE 22 # if we are building an example, just copy it to the projects/ folder
20 PROJECT_DIR := $(abspath projects/$(PROJECT)) 23 # and tehn treat it as a project
21 endif
22
23 ifdef EXAMPLE 24 ifdef EXAMPLE
24 PROJECT?=exampleTempProject 25 PROJECT?=exampleTempProject
25 PROJECT_DIR?=$(abspath projects/$(PROJECT)) 26 PROJECT_DIR?=$(abspath projects/$(PROJECT))
27 $(shell mkdir -p $(abspath projects)
26 $(shell rm -rf $(PROJECT_DIR)) 28 $(shell rm -rf $(PROJECT_DIR))
27 $(shell cp -r examples/$(EXAMPLE) $(PROJECT_DIR)) 29 $(shell cp -r examples/$(EXAMPLE) $(PROJECT_DIR))
28 endif 30 else
31 PROJECT_DIR := $(abspath projects/$(PROJECT))
32 endif
33
34 ifdef PROJECT
35 $(shell mkdir -p $(PROJECT_DIR)/build)
36 endif
37
29 OUTPUT_FILE?=$(PROJECT_DIR)/$(PROJECT) 38 OUTPUT_FILE?=$(PROJECT_DIR)/$(PROJECT)
30 COMMAND_LINE_OPTIONS?=$(CL) 39 COMMAND_LINE_OPTIONS?=$(CL)
31 RUN_COMMAND?=$(OUTPUT_FILE) $(COMMAND_LINE_OPTIONS) 40 RUN_COMMAND?=$(OUTPUT_FILE) $(COMMAND_LINE_OPTIONS)
32 BELA_STARTUP_SCRIPT?=/root/BeagleRT_startup.sh 41 BELA_STARTUP_SCRIPT?=/root/BeagleRT_startup.sh
33 BELA_AUDIO_THREAD_NAME?=bela-audio 42 BELA_AUDIO_THREAD_NAME?=bela-audio
34 SCREEN_NAME?=BeagleRT 43 SCREEN_NAME?=BeagleRT
35 44
36 #TODO: run these lines only if the command is not syntax or 45
37 $(shell mkdir -p $(PROJECT_DIR)/build)
38 RM := rm -rf 46 RM := rm -rf
39 STATIC_LIBS := ./libprussdrv.a ./libNE10.a 47 STATIC_LIBS := ./libprussdrv.a ./libNE10.a
40 LIBS := -lrt -lnative -lxenomai -lsndfile 48 LIBS := -lrt -lnative -lxenomai -lsndfile
41 49
42 # refresh library cache and check if libpd is there 50 # refresh library cache and check if libpd is there