summaryrefslogtreecommitdiffstats
path: root/Makefile
blob: 86ffae7dd3958ec715419a8ac88e58e996602d9f (plain)
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
CC ?= gcc
CXX ?= g++
CMAKE ?= cmake
CMAKE_BUILD_TYPE ?= Release

define build_cross
	-rm -fr build-$(2)
	mkdir build-$(2)
	cd build-$(2) && \
		$(CMAKE) \
			-D CMAKE_BUILD_TYPE=$(CMAKE_BUILD_TYPE) \
			-D CMAKE_TOOLCHAIN_FILE=cmake/$(1)-$(2).cmake \
			..
	make -j$$((nproc+1)) VERBOSE=$(VERBOSE) -C build-$(2)
endef

.PHONY: imx6 ath79

all:
	-rm -fr build
	mkdir build
	cd build && CC=$(CC) CXX=$(CXX) $(CMAKE) \
		-D CMAKE_BUILD_TYPE=$(CMAKE_BUILD_TYPE) \
		..
	make -j$$((nproc+1)) VERBOSE=$(VERBOSE) -C build

imx6:
	$(call build_cross,openwrt-toolchain,$@)

ath79:
	$(call build_cross,openwrt-toolchain,$@)

clean:
	@-rm -fr build*

-include local.mk