b.liu | e958203 | 2025-04-17 19:18:16 +0800 | [diff] [blame^] | 1 | # Makefile for OpenWrt |
| 2 | # |
| 3 | # Copyright (C) 2007-2015 OpenWrt.org |
| 4 | # |
| 5 | # This is free software, licensed under the GNU General Public License v2. |
| 6 | # See /LICENSE for more information. |
| 7 | # |
| 8 | |
| 9 | TOPDIR:=${CURDIR} |
| 10 | LC_ALL:=C |
| 11 | LANG:=C |
| 12 | SDK:=1 |
| 13 | export TOPDIR LC_ALL LANG SDK |
| 14 | |
| 15 | world: |
| 16 | |
| 17 | DISTRO_PKG_CONFIG:=$(shell $(TOPDIR)/scripts/command_all.sh pkg-config | grep '/usr' -m 1) |
| 18 | |
| 19 | export ORIG_PATH:=$(if $(ORIG_PATH),$(ORIG_PATH),$(PATH)) |
| 20 | export PATH:=$(TOPDIR)/staging_dir/host/bin:$(PATH) |
| 21 | |
| 22 | ifneq ($(OPENWRT_BUILD),1) |
| 23 | override OPENWRT_BUILD=1 |
| 24 | export OPENWRT_BUILD |
| 25 | |
| 26 | empty:= |
| 27 | space:= $(empty) $(empty) |
| 28 | _SINGLE=export MAKEFLAGS=$(space); |
| 29 | |
| 30 | include $(TOPDIR)/include/debug.mk |
| 31 | include $(TOPDIR)/include/depends.mk |
| 32 | include $(TOPDIR)/include/toplevel.mk |
| 33 | else |
| 34 | include rules.mk |
| 35 | include $(INCLUDE_DIR)/depends.mk |
| 36 | include $(INCLUDE_DIR)/subdir.mk |
| 37 | include package/Makefile |
| 38 | |
| 39 | $(package/stamp-compile): $(BUILD_DIR)/.prepared |
| 40 | $(BUILD_DIR)/.prepared: Makefile |
| 41 | @mkdir -p $$(dirname $@) |
| 42 | @touch $@ |
| 43 | |
| 44 | clean: FORCE |
| 45 | git clean -f -d $(STAGING_DIR); true |
| 46 | git clean -f -d $(BUILD_DIR); true |
| 47 | git clean -f -d $(BIN_DIR); true |
| 48 | |
| 49 | dirclean: clean |
| 50 | git reset --hard HEAD |
| 51 | git clean -f -d |
| 52 | rm -rf feeds/ |
| 53 | |
| 54 | # check prerequisites before starting to build |
| 55 | prereq: $(package/stamp-prereq) ; |
| 56 | |
| 57 | world: prepare $(package/stamp-compile) FORCE |
| 58 | @$(MAKE) package/index |
| 59 | |
| 60 | .PHONY: clean dirclean prereq prepare world |
| 61 | |
| 62 | endif |