-
Notifications
You must be signed in to change notification settings - Fork 8
/
Makefile
72 lines (58 loc) · 1.49 KB
/
Makefile
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
##
## Autotools build wrapper.
## Kieran Bingham
## August 2014
##
## Configures and builds under build-<arch>
##
## Cross compilation can be supported by defining
## ARCH=<target arch>
## CROSS=<cross prefix of toolchain on path>
##
##
## Some very useful advice used here from http://mad-scientist.net/make/multi-arch.html
##
# Disable all implicit build targets
.SUFFIXES:
#ARCH?=armv7
ARCH?=$(shell uname -m)
BUILD_DIR=build-$(ARCH)
SOURCE_DIR=$(CURDIR)
export CC=${CROSS}gcc
export LD=${CROSS}gcc
export CXX=${CROSS}c++
export ARCH
export PATH
export DESTDIR
# No make directory output from this wrapper
MAKE:=$(MAKE) --no-print-directory
.PHONY: all
all: $(BUILD_DIR)/Makefile
+@echo " [$(BUILD_DIR)] $(MAKECMDGOALS)"
+@$(MAKE) --no-print-directory -C $(BUILD_DIR) $(MAKECMDGOALS)
$(BUILD_DIR):
@echo " [$(BUILD_DIR)] MKDIR"
@mkdir -p $@
$(SOURCE_DIR)/configure:
@echo " [$(BUILD_DIR)] Autoconf"
cd $(SOURCE_DIR) && autoreconf --verbose --force --install
$(BUILD_DIR)/Makefile: $(SOURCE_DIR)/configure | $(BUILD_DIR)
@echo " [$(BUILD_DIR)] Configure"
cd $(BUILD_DIR) && \
$(SOURCE_DIR)/configure \
--prefix=/usr \
--host=$(CROSS)linux \
--build=$(shell uname -p)-linux \
--with-sysroot \
# Prevent Make from sending these targets through the wrapper CMDGOALS
Makefile : ;
%.mk :: ;
# Send all other targets through the default target
% :: all ;
deb:
@echo " [$(BUILD_DIR)] Packaging"
debuild -us -uc
distclean:
@echo " [$(BUILD_DIR)] $@"
@rm -rf $(BUILD_DIR)
@git clean -fxd