1
+ default : all
2
+
1
3
include build/color.mk
2
4
3
5
# Default configuration
4
6
include build/default.mk
7
+ include build/flags.mk
5
8
6
9
# Modify default configuration for external vendors
7
10
include build/vendor.mk
@@ -12,103 +15,48 @@ include build/target-arch.mk
12
15
# Include vendor-specific configuration
13
16
include build/vendor-arch.mk
14
17
18
+ # KConfig configuration
19
+ include build/kconfig.mk
20
+
15
21
# Create CFG_DEFINES based on configuration options
16
22
include build/cfg-defines.mk
17
23
24
+ # Vendor defines
25
+ include build/vendor-defines.mk
26
+
27
+ ifneq ($(_OVERRIDE_MAIN_MAKEFILE ) ,1)
28
+
29
+ .PHONY : all build_all clean distclean FORCE
30
+
18
31
all : build_all
19
32
20
33
world : build_all
21
34
$(MAKE ) openwrt_all
22
35
23
- MAKEFLAGS := --no-print-directory
24
-
25
- CP = cp
26
- MKDIR = mkdir -p
27
- DIRNAME = dirname
28
- CAT = cat
29
- SED = sed
30
- MV = mv -f
31
- RM = rm -f
32
- CHMOD = chmod
33
- INSTALL = install -D
34
- TAR = tar
35
- GREP = grep
36
-
37
- SRCEXT = cpp
38
- SRCEXT.c = c
39
- DEPEXT = d
40
- OBJEXT = o
41
-
42
- SRCDIR = src
43
- WORKDIR = work/$(TARGET )
44
- OBJDIR = $(WORKDIR ) /obj
45
- BINDIR = $(WORKDIR ) /bin
46
- LIBDIR = $(WORKDIR ) /lib
47
- BUILD_ROOTFS_DIR = $(WORKDIR ) /rootfs
48
- APP_ROOTFS ?= $(BUILD_ROOTFS_DIR )
49
- IMAGEDIR = images
50
- WORKDIRS = $(WORKDIR ) $(OBJDIR ) $(LIBDIR ) $(BINDIR ) $(BUILD_ROOTFS_DIR ) $(IMAGEDIR )
51
-
52
- CFLAGS := -Wall -Wextra -Wno-unused-parameter -Wno-unused-label -Werror
53
- CFLAGS += $(CFG_DEFINES )
54
- CFLAGS += -fasynchronous-unwind-tables -rdynamic
55
-
56
- # Below are global settings that need to be used
57
- DEBUG := -g
58
- OPTIMIZE :=
59
-
60
- LDFLAGS := -rdynamic
61
-
62
36
# Include architecture specific makefile
63
37
include $(ARCH_MK )
64
38
65
- # Controls whether complete compilation lines are printed or not
66
- ifeq ($(V ) ,1)
67
- Q =
68
- NQ =@echo
69
- Q_NULL =
70
- else
71
- Q =@
72
- NQ =@echo
73
- Q_STDOUT = >/dev/null
74
- Q_STDERR = 2>/dev/null
75
- endif
76
-
77
- CFLAGS := $(CFLAGS ) $(OPTIMIZE ) $(DEBUG ) $(DEFINES ) $(INCLUDES )
78
- LIBS := $(LIBS ) -lpthread
79
-
80
- TARGET_DEF := TARGET_$(shell echo -n "$(TARGET ) " | tr -sc '[A-Za-z0-9]' _ | tr '[a-z]' '[A-Z]')
81
- CFLAGS += -D$(TARGET_DEF ) -DTARGET_NAME="\"$(TARGET ) \""
82
-
83
- .PHONY : build_all workdirs clean distclean FORCE
84
-
39
+ include build/flags2.mk
40
+ include build/dirs.mk
41
+ include build/verbose.mk
85
42
include build/version.mk
86
43
include build/git.mk
87
44
include build/unit-build.mk
88
45
include build/tags.mk
89
46
include build/app_install.mk
90
47
include build/ovsdb.mk
91
48
include build/rootfs.mk
49
+ include build/schema.mk
50
+ include build/devshell.mk
51
+ include build/help.mk
52
+ include build/doc.mk
92
53
93
- $(WORKDIRS ) :
94
- $(Q ) mkdir -p $@
95
-
96
- workdirs : $(WORKDIRS )
97
-
98
- build_all : workdirs schema-check unit-install # rootfs
54
+ build_all : workdirs schema-check unit-install
99
55
100
56
clean : unit-clean
101
57
$(NQ ) " $( call color_clean,clean) [$( call COLOR_BOLD,workdir) ] $( WORKDIR) "
102
58
$(Q )$(RM ) -r $(WORKDIR )
103
59
104
- .PHONY : schema-check
105
- schema-check :
106
- $(Q ) build/schema.sh check || { echo " The OVS schema was changed but the version was not updated. Please run make schema-update" ; exit 1; }
107
-
108
- .PHONY : schema-update
109
- schema-update :
110
- @build/schema.sh update
111
-
112
60
DISTCLEAN_TARGETS := clean
113
61
114
62
distclean : $(DISTCLEAN_TARGETS )
@@ -120,8 +68,9 @@ $(error Unsupported TARGET ($(TARGET)). Supported targets are: \
120
68
$(COL_CFG_GREEN )$(OS_TARGETS )$(COL_CFG_NONE ) )
121
69
endif
122
70
123
- # Include makefile for vendor-specific rules, if it exists
124
- -include $(VENDOR_DIR ) /Makefile
71
+ # Include makefile for target-specific rules, if it exists
72
+ TARGET_MAKEFILE ?= $(VENDOR_DIR ) /Makefile
73
+ -include $(TARGET_MAKEFILE )
125
74
126
75
# backward compatibility
127
76
SDK_DIR ?= $(OWRT_ROOT )
@@ -131,47 +80,5 @@ ifeq ($(INSTALL_ROOTFS_DIR),)
131
80
INSTALL_ROOTFS_DIR = $(WORKDIR ) /rootfs-install
132
81
endif
133
82
134
- DEVSHELL ?= $(SHELL )
135
- devshell :
136
- $(NQ ) " make: running devshell TARGET=$( TARGET) DEVSHELL=$( DEVSHELL) "
137
- @PS1=' TARGET=$(TARGET) $$PWD $$ ' $(DEVSHELL )
138
- $(NQ ) " make: exit devshell TARGET=$( TARGET) "
139
-
140
-
141
- help :
142
- $(NQ ) " Makefile help"
143
- $(NQ ) " "
144
- $(NQ ) " Makefile commands:"
145
- $(NQ ) " all builds all enabled units"
146
- $(NQ ) " os builds device image based on specified SDK"
147
- $(NQ ) " tags Creates CTAGS for src directories"
148
- $(NQ ) " cscope Creates CSCOPE for the same directories as ctags"
149
- $(NQ ) " clean Removes generated, compiled objects"
150
- $(NQ ) " distclean Invokes clean and also cleans the ctags and cscope files"
151
- $(NQ ) " devshell Run shell with all environment variables set for TARGET"
152
- $(NQ ) " "
153
- $(NQ ) " Build Unit commands:"
154
- $(NQ ) " unit-all Build ALL active units"
155
- $(NQ ) " unit-install Build and install ALL active units"
156
- $(NQ ) " unit-clean Clean ALL active units"
157
- $(NQ ) " unit-list List ALL active units"
158
- $(NQ ) " "
159
- $(NQ ) " UNIT_PATH/clean Clean a single UNIT"
160
- $(NQ ) " UNIT_PATH/rclean Clean a single UNIT and its dependencies"
161
- $(NQ ) " UNIT_PATH/compile Compile a single UNIT and its dependencies"
162
- $(NQ ) " UNIT_PATH/install Install UNIT products to target rootfs"
163
- $(NQ ) " "
164
- $(NQ ) " Control variables:"
165
- $(NQ ) " V make verbose level. (values: 0, 1)"
166
- $(NQ ) " default = 0"
167
- $(NQ ) " TARGET Target identifier. See Supported targets."
168
- $(NQ ) " default: $( DEFAULT_TARGET) "
169
- $(NQ ) " current: $( TARGET) "
170
- $(NQ ) " Supported targets:"
171
- @for x in $(OS_TARGETS ) ; do echo " " $$ x; done
172
- $(NQ ) " IMAGE_TYPE squashfs (FLASH) or initramfs(BOOTP),"
173
- $(NQ ) " default: $( DEFAULT_IMAGE_TYPE) "
174
- $(NQ ) " IMAGE_DEPLOYMENT_PROFILE Supported deployment profiles:"
175
- @for x in $(VALID_IMAGE_DEPLOYMENT_PROFILES ) ; do echo " " $$ x; done
176
- $(NQ ) " "
83
+ endif # _OVERRIDE_MAIN_MAKEFILE
177
84
0 commit comments