forked from tsl0922/padavan
-
Notifications
You must be signed in to change notification settings - Fork 33
/
Makefile
34 lines (30 loc) · 988 Bytes
/
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
TOPDIR = ${CURDIR}
SOURCE_DIR = $(TOPDIR)/trunk
TEMPLATE_DIR = $(SOURCE_DIR)/configs/templates
PRODUCTS = $(shell ls $(TEMPLATE_DIR) | sed 's/.config//g')
CONFIG = $(SOURCE_DIR)/.config
TOOLCHAIN := mipsel-linux-musl
TOOLCHAIN_ROOT := $(TOPDIR)/toolchain/toolchain-mipsel
all: build
build:
$(MAKE) -C $(TOPDIR)/toolchain download CT_TARGET=$(TOOLCHAIN)
@if [ ! -f $(CONFIG) ]; then \
echo "Please run 'make PRODUCT_NAME' to start build!"; \
echo "Supported products: $(PRODUCTS)"; \
exit 1; \
fi
$(MAKE) -C $(SOURCE_DIR)
clean:
@if [ ! -f $(CONFIG) ]; then \
echo "Project config file .config not found! Terminate."; \
exit 1; \
fi
$(MAKE) -C $(SOURCE_DIR) clean
@rm -f $(CONFIG)
.PHONY: $(PRODUCTS)
$(PRODUCTS):
cp -f $(TEMPLATE_DIR)/$(@).config $(CONFIG)
@echo "CONFIG_CROSS_COMPILER_ROOT=$(TOOLCHAIN_ROOT)" >> $(CONFIG)
@echo "CONFIG_TOOLCHAIN=$(TOOLCHAIN)" >> $(CONFIG)
@echo "CONFIG_CCACHE=y" >> $(CONFIG)
@make build