OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [rc203soc/] [sw/] [uClinux/] [Makefile] - Blame information for rev 1767

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 1622 jcastillo
VERSION = 2
2
PATCHLEVEL = 0
3
SUBLEVEL = 38
4
UCRELEASE = 1pre3
5
 
6
ARCH = or32
7
 
8
#
9
# For SMP kernels, set this. We don't want to have this in the config file
10
# because it makes re-config very ugly and too many fundamental files depend
11
# on "CONFIG_SMP"
12
#
13
# NOTE! SMP is experimental. See the file Documentation/SMP.txt
14
#
15
# SMP = 1
16
#
17
# SMP profiling options
18
# SMP_PROF = 1
19
 
20
.EXPORT_ALL_VARIABLES:
21
 
22
CONFIG_SHELL := $(shell if [ -x "$$BASH" ]; then echo $$BASH; \
23
          else if [ -x /bin/bash ]; then echo /bin/bash; \
24
          else echo sh; fi ; fi)
25
TOPDIR  := $(shell if [ "$$PWD" != "" ]; then echo $$PWD; else pwd; fi)
26
 
27
HPATH           = $(TOPDIR)/include
28
FINDHPATH       = $(HPATH)/asm $(HPATH)/linux $(HPATH)/scsi $(HPATH)/net
29
 
30
HOSTCC          =gcc -I$(HPATH)
31
HOSTCFLAGS      =-O2 -fomit-frame-pointer
32
 
33
CROSS_COMPILE   =or32-rtems-
34
 
35
AS      =$(CROSS_COMPILE)as
36
LD      =$(CROSS_COMPILE)ld
37
CC      =$(CROSS_COMPILE)gcc -D__KERNEL__ -I$(HPATH)
38
CPP     =$(CC) -E
39
AR      =$(CROSS_COMPILE)ar
40
NM      =$(CROSS_COMPILE)nm
41
STRIP   =$(CROSS_COMPILE)strip
42
MAKE    =make
43
 
44
all:    do-it-all
45
 
46
#
47
# Make "config" the default target if there is no configuration file or
48
# "depend" the target if there is no top-level dependency information.
49
#
50
ifeq (.config,$(wildcard .config))
51
include .config
52
ifeq (.depend,$(wildcard .depend))
53
include .depend
54
 
55
ifdef CONFIG_UCLINUX
56
LINUX = linux
57
else
58
LINUX = vmlinux
59
endif
60
 
61
do-it-all:      Version $(LINUX)
62
else
63
CONFIGURATION = depend
64
do-it-all:      depend
65
endif
66
else
67
CONFIGURATION = config
68
do-it-all:      config
69
endif
70
 
71
#
72
# ROOT_DEV specifies the default root-device when making the image.
73
# This can be either FLOPPY, CURRENT, /dev/xxxx or empty, in which case
74
# the default of FLOPPY is used by 'build'.
75
#
76
 
77
ROOT_DEV = CURRENT
78
 
79
#
80
# INSTALL_PATH specifies where to place the updated kernel and system map
81
# images.  Uncomment if you want to place them anywhere other than root.
82
 
83
#INSTALL_PATH=/boot
84
 
85
#
86
# If you want to preset the SVGA mode, uncomment the next line and
87
# set SVGA_MODE to whatever number you want.
88
# Set it to -DSVGA_MODE=NORMAL_VGA if you just want the EGA/VGA mode.
89
# The number is the same as you would ordinarily press at bootup.
90
#
91
 
92
SVGA_MODE=      -DSVGA_MODE=NORMAL_VGA
93
 
94
#
95
# standard CFLAGS
96
#
97
 
98
 
99
CFLAGS = -Wall -Wstrict-prototypes -Werror-implicit-function-declaration -fomit-frame-pointer -fno-strength-reduce -O2 -g
100
# CFLAGS = -Wall -Wstrict-prototypes -fomit-frame-pointer -fno-strength-reduce -O2 -DDEBUG
101
 
102
ifdef CONFIG_CPP
103
CFLAGS := $(CFLAGS) -x c++
104
endif
105
 
106
ifdef SMP
107
CFLAGS += -D__SMP__
108
AFLAGS += -D__SMP__
109
 
110
ifdef SMP_PROF
111
CFLAGS += -D__SMP_PROF__
112
AFLAGS += -D__SMP_PROF__
113
endif
114
endif
115
 
116
#
117
# if you want the ram-disk device, define this to be the
118
# size in blocks.
119
#
120
 
121
#RAMDISK = -DRAMDISK=512
122
 
123
# Include the make variables (CC, etc...)
124
#
125
 
126
ARCHIVES        =kernel/kernel.o fs/fs.o ipc/ipc.o net/network.a
127
FILESYSTEMS     =fs/filesystems.a
128
DRIVERS         =drivers/block/block.a \
129
                 drivers/char/char.a
130
LIBS            =$(TOPDIR)/lib/lib.a
131
SUBDIRS         =kernel drivers fs net ipc lib
132
 
133
ifdef CONFIG_UCLINUX
134
ARCHIVES := $(ARCHIVES) mmnommu/mm.o
135
SUBDIRS := $(SUBDIRS) mmnommu
136
else
137
ARCHIVES := $(ARCHIVES) mm/mm.o
138
SUBDIRS := $(SUBDIRS) mm
139
endif
140
 
141
ifeq ($(CONFIG_ISDN),y)
142
DRIVERS := $(DRIVERS) drivers/isdn/isdn.a
143
endif
144
 
145
DRIVERS := $(DRIVERS) drivers/net/net.a
146
 
147
ifdef CONFIG_CD_NO_IDESCSI
148
DRIVERS := $(DRIVERS) drivers/cdrom/cdrom.a
149
endif
150
 
151
ifeq ($(CONFIG_SCSI),y)
152
DRIVERS := $(DRIVERS) drivers/scsi/scsi.a
153
endif
154
 
155
ifeq ($(CONFIG_SOUND),y)
156
DRIVERS := $(DRIVERS) drivers/sound/sound.a
157
endif
158
 
159
ifdef CONFIG_PCI
160
DRIVERS := $(DRIVERS) drivers/pci/pci.a
161
endif
162
 
163
ifdef CONFIG_SBUS
164
DRIVERS := $(DRIVERS) drivers/sbus/sbus.a
165
endif
166
 
167
include arch/$(ARCH)/Makefile
168
 
169
.S.s:
170
        $(CC) -D__ASSEMBLY__ $(AFLAGS) -traditional -E -o $*.s $<
171
.S.o:
172
        $(CC) -D__ASSEMBLY__ $(AFLAGS) -traditional -c -o $*.o $<
173
 
174
Version: dummy
175
        @rm -f include/linux/compile.h
176
 
177
boot: $(LINUX)
178
        @$(MAKE) -C arch/$(ARCH)/boot
179
 
180
$(LINUX): $(CONFIGURATION) init/main.o init/version.o linuxsubdirs
181
        $(LD) $(LINKFLAGS) $(HEAD) init/main.o init/version.o \
182
                $(ARCHIVES) \
183
                $(FILESYSTEMS) \
184
                $(DRIVERS) \
185
                $(LIBS) -o $(LINUX)
186
        $(NM) --line-numbers $(LINUX) | grep -v '\(compiled\)\|\(\.o$$\)\|\( a \)' | sort > System.map
187
 
188
symlinks:
189
        rm -f include/asm
190
        ( cd include ; ln -sf asm-$(ARCH) asm)
191
 
192
oldconfig: symlinks
193
        $(CONFIG_SHELL) scripts/Configure -d arch/$(ARCH)/config.in
194
 
195
xconfig: symlinks
196
        $(MAKE) -C scripts kconfig.tk
197
        wish -f scripts/kconfig.tk
198
 
199
menuconfig: include/linux/version.h symlinks
200
        $(MAKE) -C scripts/lxdialog all
201
        $(CONFIG_SHELL) scripts/Menuconfig arch/$(ARCH)/config.in
202
 
203
config: symlinks
204
        $(CONFIG_SHELL) scripts/Configure arch/$(ARCH)/config.in
205
 
206
linuxsubdirs: dummy
207
        set -e; for i in $(SUBDIRS); do $(MAKE) -C $$i; done
208
 
209
$(TOPDIR)/include/linux/version.h: include/linux/version.h
210
$(TOPDIR)/include/linux/compile.h: include/linux/compile.h
211
 
212
newversion:
213
        @if [ ! -f .version ]; then \
214
                echo 1 > .version; \
215
        else \
216
                expr 0`cat .version` + 1 > .version; \
217
        fi
218
 
219
include/linux/compile.h: $(CONFIGURATION) include/linux/version.h newversion
220
        @if [ -f .name ]; then \
221
           echo \#define UTS_VERSION \"\#`cat .version`-`cat .name` `date`\"; \
222
         else \
223
           echo \#define UTS_VERSION \"\#`cat .version` `date`\";  \
224
         fi >> .ver
225
        @echo \#define LINUX_COMPILE_TIME \"`date +%T`\" >> .ver
226
        @echo \#define LINUX_COMPILE_BY \"`whoami`\" >> .ver
227
        @echo \#define LINUX_COMPILE_HOST \"`hostname`\" >> .ver
228
        @if [ -x /bin/dnsdomainname ]; then \
229
           echo \#define LINUX_COMPILE_DOMAIN \"`dnsdomainname`\"; \
230
         elif [ -x /bin/domainname ]; then \
231
           echo \#define LINUX_COMPILE_DOMAIN \"`domainname`\"; \
232
         else \
233
           echo \#define LINUX_COMPILE_DOMAIN ; \
234
         fi >> .ver
235
        @echo \#define LINUX_COMPILER \"`$(CC) -v 2>&1 | tail -1`\" >> .ver
236
        @mv -f .ver $@
237
 
238
ifdef CONFIG_UCLINUX
239
include/linux/version.h: ./Makefile .config
240
        @echo \#define UTS_RELEASE \"$(VERSION).$(PATCHLEVEL).$(SUBLEVEL).$(UCRELEASE)\" > .ver
241
        @echo \#define LINUX_VERSION_CODE `expr $(VERSION) \\* 65536 + $(PATCHLEVEL) \\* 256 + $(SUBLEVEL)` >> .ver
242
        @mv -f .ver $@
243
else
244
include/linux/version.h: ./Makefile
245
        @echo \#define UTS_RELEASE \"$(VERSION).$(PATCHLEVEL).$(SUBLEVEL)\" > .ver
246
        @echo \#define LINUX_VERSION_CODE `expr $(VERSION) \\* 65536 + $(PATCHLEVEL) \\* 256 + $(SUBLEVEL)` >> .ver
247
        @mv -f .ver $@
248
endif
249
 
250
init/version.o: init/version.c include/linux/compile.h
251
        $(CC) $(CFLAGS) -DUTS_MACHINE='"$(ARCH)"' -c -o init/version.o init/version.c
252
 
253
init/main.o: init/main.c
254
        $(CC) $(CFLAGS) $(PROFILING) -c -o $*.o $<
255
 
256
fs: dummy
257
        $(MAKE) linuxsubdirs SUBDIRS=fs
258
 
259
lib: dummy
260
        $(MAKE) linuxsubdirs SUBDIRS=lib
261
 
262
mm: dummy
263
        $(MAKE) linuxsubdirs SUBDIRS=mm
264
 
265
mmnommu: dummy
266
        $(MAKE) linuxsubdirs SUBDIRS=mmnommu
267
 
268
ipc: dummy
269
        $(MAKE) linuxsubdirs SUBDIRS=ipc
270
 
271
kernel: dummy
272
        $(MAKE) linuxsubdirs SUBDIRS=kernel
273
 
274
drivers: dummy
275
        $(MAKE) linuxsubdirs SUBDIRS=drivers
276
 
277
net: dummy
278
        $(MAKE) linuxsubdirs SUBDIRS=net
279
 
280
MODFLAGS = -DMODULE
281
ifdef CONFIG_MODULES
282
ifdef CONFIG_MODVERSIONS
283
MODFLAGS += -DMODVERSIONS -include $(HPATH)/linux/modversions.h
284
endif
285
 
286
modules: include/linux/version.h
287
        @set -e; \
288
        for i in $(SUBDIRS); \
289
        do $(MAKE) -C $$i CFLAGS="$(CFLAGS) $(MODFLAGS)" MAKING_MODULES=1 modules; \
290
        done
291
 
292
modules_install:
293
        @( \
294
        MODLIB=/lib/modules/$(VERSION).$(PATCHLEVEL).$(SUBLEVEL); \
295
        cd modules; \
296
        MODULES=""; \
297
        inst_mod() { These="`cat $$1`"; MODULES="$$MODULES $$These"; \
298
                mkdir -p $$MODLIB/$$2; cp -p $$These $$MODLIB/$$2; \
299
                echo Installing modules under $$MODLIB/$$2; \
300
        }; \
301
        \
302
        if [ -f BLOCK_MODULES ]; then inst_mod BLOCK_MODULES block; fi; \
303
        if [ -f NET_MODULES   ]; then inst_mod NET_MODULES   net;   fi; \
304
        if [ -f IPV4_MODULES  ]; then inst_mod IPV4_MODULES  ipv4;  fi; \
305
        if [ -f SCSI_MODULES  ]; then inst_mod SCSI_MODULES  scsi;  fi; \
306
        if [ -f FS_MODULES    ]; then inst_mod FS_MODULES    fs;    fi; \
307
        if [ -f CDROM_MODULES ]; then inst_mod CDROM_MODULES cdrom; fi; \
308
        \
309
        ls *.o > .allmods; \
310
        echo $$MODULES | tr ' ' '\n' | sort | comm -23 .allmods - > .misc; \
311
        if [ -s .misc ]; then inst_mod .misc misc; fi; \
312
        rm -f .misc .allmods; \
313
        )
314
 
315
# modules disabled....
316
 
317
else
318
modules modules_install: dummy
319
        @echo
320
        @echo "The present kernel configuration has modules disabled."
321
        @echo "Type 'make config' and enable loadable module support."
322
        @echo "Then build a kernel with module support enabled."
323
        @echo
324
        @exit 1
325
endif
326
 
327
clean:  archclean
328
        rm -f kernel/ksyms.lst include/linux/compile.h
329
        rm -f core `find . -name '*.[oas]' ! -regex '.*lxdialog/.*' -print`
330
        rm -f core `find . -type f -name 'core' -print`
331
        rm -f core `find . -name '*.rh' -print`
332
        rm -f $(LINUX) System.map
333
        rm -f .tmp* drivers/sound/configure
334
        rm -fr modules/*
335
        rm -f submenu*
336
 
337
mrproper: clean
338
        rm -f include/linux/autoconf.h include/linux/version.h
339
        rm -f drivers/sound/local.h drivers/sound/.defines
340
        rm -f drivers/char/uni_hash.tbl drivers/char/conmakehash
341
        rm -f .version .config* config.in config.old
342
        rm -f scripts/tkparse scripts/kconfig.tk scripts/kconfig.tmp
343
        rm -f scripts/lxdialog/*.o scripts/lxdialog/lxdialog
344
        rm -f .menuconfig .menuconfig.log
345
        rm -f include/asm
346
        rm -f .depend `find . -name .depend -print`
347
        rm -f .hdepend scripts/mkdep
348
        rm -f $(TOPDIR)/include/linux/modversions.h
349
        rm -f $(TOPDIR)/include/linux/modules/*
350
 
351
 
352
distclean: mrproper
353
        rm -f core `find . \( -name '*.orig' -o -name '*.rej' -o -name '*~' \
354
                -o -name '*.bak' -o -name '#*#' -o -name '.*.orig' \
355
                -o -name '.*.rej' -o -name '.SUMS' -o -size 0 \) -print` TAGS
356
 
357
backup: mrproper
358
        cd .. && tar cf - linux/ | gzip -9 > backup.gz
359
        sync
360
 
361
sums:
362
        find . -type f -print | sort | xargs sum > .SUMS
363
 
364
dep-files: scripts/mkdep archdep include/linux/version.h
365
        echo Platform $(PLATFORM) Board $(BOARD) Model $(MODEL)
366
        scripts/mkdep init/*.c > .tmpdepend
367
        scripts/mkdep `find $(FINDHPATH) -follow -name \*.h ! -name modversions.h -print` > .hdepend
368
        set -e; for i in $(SUBDIRS); do $(MAKE) -C $$i fastdep; done
369
        mv .tmpdepend .depend
370
 
371
MODVERFILE :=
372
 
373
ifdef CONFIG_MODVERSIONS
374
MODVERFILE := $(TOPDIR)/include/linux/modversions.h
375
endif
376
 
377
depend dep: dep-files $(MODVERFILE)
378
 
379
ifdef CONFIGURATION
380
..$(CONFIGURATION):
381
        @echo
382
        @echo "You have a bad or nonexistent" .$(CONFIGURATION) ": running 'make" $(CONFIGURATION)"'"
383
        @echo
384
        $(MAKE) $(CONFIGURATION)
385
        @echo
386
        @echo "Successful. Try re-making (ignore the error that follows)"
387
        @echo
388
        exit 1
389
 
390
#dummy: ..$(CONFIGURATION)
391
dummy:
392
 
393
else
394
 
395
dummy:
396
 
397
endif
398
 
399
include Rules.make
400
 
401
#
402
# This generates dependencies for the .h files.
403
#
404
 
405
scripts/mkdep: scripts/mkdep.c
406
        $(HOSTCC) $(HOSTCFLAGS) -o scripts/mkdep scripts/mkdep.c

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.