Keep TP-Link TL-WR902AC v1 power LED always on
[oweals/u-boot_mod.git] / u-boot / config.mk
1 #
2 # (C) Copyright 2000
3 # Wolfgang Denk, DENX Software Engineering, wd@denx.de.
4 #
5 # See file CREDITS for list of people who contributed to this
6 # project.
7 #
8 # This program is free software; you can redistribute it and/or
9 # modify it under the terms of the GNU General Public License as
10 # published by the Free Software Foundation; either version 2 of
11 # the License, or (at your option) any later version.
12 #
13 # This program is distributed in the hope that it will be useful,
14 # but WITHOUT ANY WARRANTY; without even the implied warranty of
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16 # GNU General Public License for more details.
17 #
18 # You should have received a copy of the GNU General Public License
19 # along with this program; if not, write to the Free Software
20 # Foundation, Inc., 59 Temple Place, Suite 330, Boston,
21 # MA 02111-1307 USA
22 #
23
24 #########################################################################
25
26 # clean the slate ...
27 PLATFORM_RELFLAGS =
28 PLATFORM_CPPFLAGS =
29 PLATFORM_LDFLAGS  =
30
31 # include architecture dependend rules
32 ifdef ARCH
33   sinclude $(TOPDIR)/$(ARCH)_config.mk
34 endif
35
36 # include CPU specific rules
37 ifdef CPU
38   sinclude $(TOPDIR)/cpu/$(CPU)/config.mk
39 endif
40
41 # include SoC specific rules
42 ifdef SOC
43   sinclude $(TOPDIR)/cpu/$(CPU)/$(SOC)/config.mk
44 endif
45
46 # include vendor/board specific rules
47 ifdef VENDOR
48   BOARDDIR = $(VENDOR)/$(BOARD)
49 else
50   BOARDDIR = $(BOARD)
51 endif
52
53 ifdef BOARD
54   sinclude $(TOPDIR)/board/$(BOARDDIR)/config.mk
55 endif
56
57 #########################################################################
58
59 CONFIG_SHELL := $(shell if [ -x "$$BASH" ]; then echo $$BASH;          \
60                         else if [ -x /bin/bash ]; then echo /bin/bash; \
61                         else echo sh; fi; fi)
62
63 ifeq ($(HOSTOS)-$(HOSTARCH),darwin-ppc)
64   HOSTCC = cc
65 else
66   HOSTCC = gcc
67 endif
68
69 HOSTCFLAGS = -Wall -Wstrict-prototypes -O2 -fomit-frame-pointer
70 HOSTSTRIP  = strip
71
72 #########################################################################
73
74 # Include the make variables (CC, etc...)
75 AS      = $(CROSS_COMPILE)as
76 LD      = $(CROSS_COMPILE)ld
77 CC      = $(CROSS_COMPILE)gcc
78 CPP     = $(CC) -E
79 AR      = $(CROSS_COMPILE)ar
80 NM      = $(CROSS_COMPILE)nm
81 STRIP   = $(CROSS_COMPILE)strip
82 OBJCOPY = $(CROSS_COMPILE)objcopy
83 OBJDUMP = $(CROSS_COMPILE)objdump
84 RANLIB  = $(CROSS_COMPILE)RANLIB
85
86 .depend : CC = @$(CROSS_COMPILE)gcc
87
88 RELFLAGS = $(PLATFORM_RELFLAGS)
89 OPTFLAGS = -O
90
91 ifndef LDSCRIPT
92   LDSCRIPT := $(TOPDIR)/board/$(BOARDDIR)/u-boot.lds
93 endif
94 LDFLAGS += -Bstatic -T $(LDSCRIPT) -Ttext $(TEXT_BASE) $(PLATFORM_LDFLAGS)
95
96 ifdef COMPRESSED_UBOOT
97   ifndef LDSCRIPT_BOOTSTRAP
98     LDSCRIPT_BOOTSTRAP := $(TOPDIR)/board/$(BOARDDIR)/u-boot-bootstrap.lds
99   endif
100   LDFLAGS_BOOTSTRAP := -Bstatic -T $(LDSCRIPT_BOOTSTRAP)
101   LDFLAGS_BOOTSTRAP += -Ttext $(BOOTSTRAP_TEXT_BASE) $(PLATFORM_LDFLAGS)
102 endif
103
104 OBJCFLAGS += --gap-fill=0xff
105
106 gccincdir := $(shell $(CC) -print-file-name=include)
107
108 CPPFLAGS := $(DBGFLAGS) $(OPTFLAGS) $(RELFLAGS)            \
109             -D__KERNEL__ -DTEXT_BASE=$(TEXT_BASE)          \
110             -I$(TOPDIR)/include                            \
111             -fno-builtin -ffreestanding -nostdinc -isystem \
112             $(gccincdir) -pipe $(PLATFORM_CPPFLAGS)
113
114 CFLAGS := $(CPPFLAGS) -Wall -Wstrict-prototypes
115
116 ifdef COMPRESSED_UBOOT
117   CFLAGS += -DCOMPRESSED_UBOOT=1
118 endif
119
120 ifeq ($(BUILD_OPTIMIZED),y)
121   CFLAGS += -Os -fno-reorder-functions -fno-delete-null-pointer-checks
122   CPPFLAGS += -Os -fno-reorder-functions -fno-delete-null-pointer-checks
123 endif
124
125 AFLAGS_DEBUG :=
126 AFLAGS := $(AFLAGS_DEBUG) -D__ASSEMBLY__ $(CPPFLAGS)
127
128 ifdef COMPRESSED_UBOOT
129   AFLAGS += -DCOMPRESSED_UBOOT=1
130 endif
131
132 #########################################################################
133
134 export AFLAGS AR AS CC CFLAGS CONFIG_SHELL CPP CPPFLAGS CROSS_COMPILE HOSTCC \
135        HOSTCFLAGS HPATH LD MAKE NM OBJCOPY OBJDUMP PLATFORM_CPPFLAGS         \
136        PLATFORM_RELFLAGS STRIP TEXT_BASE
137
138 ifeq ($(V),1)
139   Q =
140 else
141   Q = @
142 endif
143
144 export quiet Q V
145
146 #########################################################################
147
148 %.s:    %.S
149 ifneq ($(V),1)
150         @echo [CPP] $(CURDIR)/$<
151 endif
152         $(Q)$(CPP) $(AFLAGS) -o $@ $(CURDIR)/$<
153
154 %.o:    %.S
155 ifneq ($(V),1)
156         @echo [CC] $(CURDIR)/$<
157 endif
158         $(Q)$(CC) $(AFLAGS) -c -o $@ $(CURDIR)/$<
159
160 %.o:    %.c
161 ifneq ($(V),1)
162         @echo [CC] $(CURDIR)/$<
163 endif
164         $(Q)$(CC) $(CFLAGS) -c -o $@ $<
165
166 #########################################################################