forked from AlgoLab/galig
-
Notifications
You must be signed in to change notification settings - Fork 0
/
target.mk
34 lines (26 loc) · 786 Bytes
/
target.mk
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# Based on the idea/skeleton presented at
# http://mad-scientist.net/make/multi-arch.html
.SUFFIXES:
# Directories.
export BASE_DIR:=$(CURDIR)
export SRC_DIR:=$(BASE_DIR)/src
export BIN_DIR:=$(BASE_DIR)/bin
export OBJ_DIR:=$(BASE_DIR)/$(OBJ_DIR)
MAKETARGET = $(MAKE) --no-print-directory -C $@ -f $(CURDIR)/Makefile $(MAKECMDGOALS)
.PHONY: $(OBJ_DIR)
$(OBJ_DIR):
+@[ -d $@ ] || mkdir -p $@
+@$(MAKETARGET)
Makefile : ;
%.mk :: ;
% :: $(OBJ_DIR) ;
# The clean and depclean targets should stay here since they
# delete the directory which the main Makefile is executed from.
.PHONY: clean
clean:
@echo '* Cleaning objects and binaries...' ; \
rm -rf $(OBJ_DIR) $(BIN_DIR)
.PHONY: depclean
depclean: clean
@echo '* Cleaning pre-requisites...' ; \
$(MAKE) clean-prerequisites