]>
Commit | Line | Data |
---|---|---|
efee1709 | 1 | # |
f9328639 | 2 | # (C) Copyright 2000-2006 |
efee1709 WD |
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 | ||
f9328639 | 24 | BIN_FILES = img2srec$(SFX) mkimage$(SFX) envcrc$(SFX) gen_eth_addr$(SFX) bmp_logo$(SFX) |
efee1709 | 25 | |
f9328639 MB |
26 | OBJ_LINKS = environment.o crc32.o |
27 | OBJ_FILES = img2srec.o mkimage.o envcrc.o gen_eth_addr.o bmp_logo.o | |
efee1709 | 28 | |
3e38691e | 29 | ifeq ($(ARCH),mips) |
f9328639 MB |
30 | BIN_FILES += inca-swap-bytes$(SFX) |
31 | OBJ_FILES += inca-swap-bytes.o | |
3e38691e WD |
32 | endif |
33 | ||
ef1464cc WD |
34 | # Don't build by default |
35 | #ifeq ($(ARCH),ppc) | |
f9328639 MB |
36 | #BIN_FILES += mpc86x_clk$(SFX) |
37 | #OBJ_FILES += mpc86x_clk.o | |
ef1464cc WD |
38 | #endif |
39 | ||
f9328639 | 40 | LOGO_H = $(OBJTREE)/include/bmp_logo.h |
efee1709 WD |
41 | |
42 | ifeq ($(LOGO_BMP),) | |
43 | LOGO_BMP= logos/denx.bmp | |
44 | endif | |
45 | ||
46 | #------------------------------------------------------------------------- | |
47 | ||
48 | HOSTARCH := $(shell uname -m | \ | |
49 | sed -e s/i.86/i386/ \ | |
50 | -e s/sun4u/sparc64/ \ | |
51 | -e s/arm.*/arm/ \ | |
52 | -e s/sa110/arm/ \ | |
53 | -e s/powerpc/ppc/ \ | |
54 | -e s/Power\ Macintosh/ppc/ \ | |
55 | -e s/macppc/ppc/) | |
56 | ||
57 | HOSTOS := $(shell uname -s | tr A-Z a-z | \ | |
58 | sed -e 's/\(cygwin\).*/cygwin/') | |
59 | ||
60 | TOOLSUBDIRS = | |
61 | ||
62 | # | |
63 | # Mac OS X / Darwin's C preprocessor is Apple specific. It | |
64 | # generates numerous errors and warnings. We want to bypass it | |
65 | # and use GNU C's cpp. To do this we pass the -traditional-cpp | |
66 | # option to the compiler. Note that the -traditional-cpp flag | |
67 | # DOES NOT have the same semantics as GNU C's flag, all it does | |
68 | # is invoke the GNU preprocessor in stock ANSI/ISO C fashion. | |
69 | # | |
70 | # Apple's linker is similar, thanks to the new 2 stage linking | |
71 | # multiple symbol definitions are treated as errors, hence the | |
72 | # -multiply_defined suppress option to turn off this error. | |
73 | # | |
74 | ifeq ($(HOSTOS)-$(HOSTARCH),darwin-ppc) | |
efee1709 WD |
75 | HOST_CFLAGS = -traditional-cpp -Wall |
76 | HOST_LDFLAGS =-multiply_defined suppress | |
77 | HOST_ENVIRO_CFLAGS = -traditional-cpp | |
78 | ||
79 | else | |
efee1709 WD |
80 | ifeq ($(HOSTOS)-$(HOSTARCH),netbsd-ppc) |
81 | HOST_CFLAGS = -Wall -pedantic | |
82 | HOST_LDFLAGS = | |
83 | HOST_ENVIRO_CFLAGS = | |
84 | ||
85 | # | |
86 | # Everyone else | |
87 | # | |
88 | else | |
efee1709 WD |
89 | HOST_CFLAGS = -Wall -pedantic |
90 | HOST_LDFLAGS = | |
91 | HOST_ENVIRO_CFLAGS = | |
92 | endif | |
93 | endif | |
94 | ||
95 | # | |
96 | # Cygwin needs .exe files :-( | |
97 | # | |
98 | ifeq ($(HOSTOS),cygwin) | |
99 | SFX = .exe | |
100 | else | |
101 | SFX = | |
102 | endif | |
103 | ||
efee1709 WD |
104 | # |
105 | # Include this after HOSTOS HOSTARCH check | |
106 | # so that we can act intelligently. | |
107 | # | |
108 | include $(TOPDIR)/config.mk | |
109 | ||
f9328639 MB |
110 | # now $(obj) is defined |
111 | SRCS := $(addprefix $(obj),$(OBJ_LINKS:.o=.c)) $(OBJ_FILES:.o=.c) | |
112 | BINS := $(addprefix $(obj),$(BIN_FILES)) | |
113 | ||
efee1709 WD |
114 | # |
115 | # Use native tools and options | |
116 | # | |
f9328639 MB |
117 | CPPFLAGS = -idirafter $(SRCTREE)/include \ |
118 | -idirafter $(OBJTREE)/include2 \ | |
119 | -idirafter $(OBJTREE)/include \ | |
120 | -DTEXT_BASE=$(TEXT_BASE) -DUSE_HOSTCC | |
efee1709 WD |
121 | CFLAGS = $(HOST_CFLAGS) $(CPPFLAGS) -O |
122 | AFLAGS = -D__ASSEMBLY__ $(CPPFLAGS) | |
123 | CC = $(HOSTCC) | |
124 | STRIP = $(HOSTSTRIP) | |
125 | MAKEDEPEND = makedepend | |
126 | ||
f9328639 | 127 | all: $(obj).depend $(BINS) $(LOGO_H) subdirs |
efee1709 | 128 | |
f9328639 | 129 | $(obj)envcrc$(SFX): $(obj)envcrc.o $(obj)crc32.o $(obj)environment.o |
efee1709 WD |
130 | $(CC) $(CFLAGS) -o $@ $^ |
131 | ||
f9328639 | 132 | $(obj)img2srec$(SFX): $(obj)img2srec.o |
efee1709 WD |
133 | $(CC) $(CFLAGS) $(HOST_LDFLAGS) -o $@ $^ |
134 | $(STRIP) $@ | |
135 | ||
f9328639 | 136 | $(obj)mkimage$(SFX): $(obj)mkimage.o $(obj)crc32.o |
efee1709 WD |
137 | $(CC) $(CFLAGS) $(HOST_LDFLAGS) -o $@ $^ |
138 | $(STRIP) $@ | |
139 | ||
f9328639 | 140 | $(obj)ncb$(SFX): $(obj)ncb.o |
eedcd078 WD |
141 | $(CC) $(CFLAGS) $(HOST_LDFLAGS) -o $@ $^ |
142 | $(STRIP) $@ | |
143 | ||
f9328639 | 144 | $(obj)gen_eth_addr$(SFX): $(obj)gen_eth_addr.o |
efee1709 WD |
145 | $(CC) $(CFLAGS) $(HOST_LDFLAGS) -o $@ $^ |
146 | $(STRIP) $@ | |
147 | ||
f9328639 | 148 | $(obj)bmp_logo$(SFX): $(obj)bmp_logo.o |
efee1709 WD |
149 | $(CC) $(CFLAGS) $(HOST_LDFLAGS) -o $@ $^ |
150 | $(STRIP) $@ | |
151 | ||
f9328639 | 152 | $(obj)inca-swap-bytes$(SFX): $(obj)inca-swap-bytes.o |
3e38691e WD |
153 | $(CC) $(CFLAGS) $(HOST_LDFLAGS) -o $@ $^ |
154 | $(STRIP) $@ | |
155 | ||
f9328639 | 156 | $(obj)mpc86x_clk$(SFX): $(obj)mpc86x_clk.o |
ef1464cc WD |
157 | $(CC) $(CFLAGS) $(HOST_LDFLAGS) -o $@ $^ |
158 | $(STRIP) $@ | |
159 | ||
f9328639 MB |
160 | $(obj)envcrc.o: $(src)envcrc.c |
161 | $(CC) -g $(CFLAGS) -c -o $@ $< | |
efee1709 | 162 | |
f9328639 MB |
163 | $(obj)crc32.o: $(obj)crc32.c |
164 | $(CC) -g $(CFLAGS) -c -o $@ $< | |
efee1709 | 165 | |
f9328639 MB |
166 | $(obj)mkimage.o: $(src)mkimage.c |
167 | $(CC) -g $(CFLAGS) -c -o $@ $< | |
efee1709 | 168 | |
f9328639 MB |
169 | $(obj)ncb.o: $(src)ncb.c |
170 | $(CC) -g $(CFLAGS) -c -o $@ $< | |
eedcd078 | 171 | |
f9328639 MB |
172 | $(obj)gen_eth_addr.o: $(src)gen_eth_addr.c |
173 | $(CC) -g $(CFLAGS) -c -o $@ $< | |
efee1709 | 174 | |
f9328639 MB |
175 | $(obj)inca-swap-bytes.o: $(src)inca-swap-bytes.c |
176 | $(CC) -g $(CFLAGS) -c -o $@ $< | |
3e38691e | 177 | |
f9328639 MB |
178 | $(obj)mpc86x_clk.o: $(src)mpc86x_clk.c |
179 | $(CC) -g $(CFLAGS) -c -o $@ $< | |
ef1464cc | 180 | |
efee1709 | 181 | subdirs: |
e0ac62d7 WD |
182 | ifeq ($(TOOLSUBDIRS),) |
183 | @: | |
184 | else | |
efee1709 WD |
185 | @for dir in $(TOOLSUBDIRS) ; do \ |
186 | $(MAKE) \ | |
187 | HOSTOS=$(HOSTOS) \ | |
188 | HOSTARCH=$(HOSTARCH) \ | |
189 | HOST_CFLAGS="$(HOST_CFLAGS)" \ | |
190 | HOST_LDFLAGS="$(HOST_LDFLAGS)" \ | |
191 | -C $$dir || exit 1 ; \ | |
192 | done | |
e0ac62d7 WD |
193 | endif |
194 | ||
f9328639 MB |
195 | $(obj)environment.c: |
196 | @rm -f $(obj)environment.c | |
197 | ln -s $(src)../common/environment.c $(obj)environment.c | |
efee1709 | 198 | |
f9328639 MB |
199 | $(obj)environment.o: $(obj)environment.c |
200 | $(CC) -g $(HOST_ENVIRO_CFLAGS) $(CPPFLAGS) -c -o $@ $< | |
efee1709 | 201 | |
f9328639 MB |
202 | $(obj)crc32.c: |
203 | @rm -f $(obj)crc32.c | |
204 | ln -s $(src)../lib_generic/crc32.c $(obj)crc32.c | |
efee1709 | 205 | |
f9328639 MB |
206 | $(LOGO_H): $(obj)bmp_logo $(LOGO_BMP) |
207 | $(obj)./bmp_logo $(LOGO_BMP) >$@ | |
efee1709 WD |
208 | |
209 | ######################################################################### | |
210 | ||
f9328639 MB |
211 | # defines $(obj).depend target |
212 | include $(SRCTREE)/rules.mk | |
efee1709 | 213 | |
f9328639 | 214 | sinclude $(obj).depend |
efee1709 WD |
215 | |
216 | ######################################################################### |