6423.1.5
by Paweł Forysiuk
Add dummy makefile to emulate autotools workflow |
1 |
# Based on "http://iany.me/wiki/Makefile/" by "Ian Yang" licensed under "CC by 3.0"
|
2 |
||
3 |
BUILD_FOLDER := _build |
|
4 |
||
5 |
CUSTOM_TARGETS := cmake |
|
6 |
||
7 |
# Do not try to use custom target when invoking external makefile
|
|
8 |
EXTERNAL_TARGETS := $(filter-out $(CUSTOM_TARGETS), $(MAKECMDGOALS)) |
|
9 |
||
10 |
# Call all targets using `Makefile` in build directory in one `make` command.
|
|
11 |
$(or $(lastword $(EXTERNAL_TARGETS)),all): |
|
12 |
$(MAKE) -C $(BUILD_FOLDER) $(EXTERNAL_TARGETS) |
|
13 |
||
14 |
# If no targets are specified, use the dummy `all` target
|
|
15 |
.PHONY: $(EXTERNAL_TARGETS) all |
|
16 |
||
17 |
# Do nothing for all targets but last. Also quiet the message "Noting to be done on xxx"
|
|
18 |
$(filter-out $(lastword $(EXTERNAL_TARGETS)), $(EXTERNAL_TARGETS)): |
|
19 |
@cd . |
|
20 |
||
21 |
cmake: $(BUILD_FOLDER) |
|
22 |
cd $(BUILD_FOLDER) && cmake .. |
|
23 |
||
24 |
$(BUILD_FOLDER): |
|
25 |
mkdir $(BUILD_FOLDER) |
|
26 |
||
27 |
.PHONY: cmake |