Magellan Linux

Annotation of /trunk/mkinitrd-magellan/klibc/Makefile

Parent Directory Parent Directory | Revision Log Revision Log


Revision 815 - (hide annotations) (download)
Fri Apr 24 18:32:46 2009 UTC (15 years ago) by niro
File size: 4167 byte(s)
-updated to klibc-1.5.15
1 niro 532 SRCROOT = .
2    
3     # kbuild compatibility
4     export srctree := $(shell pwd)
5     export objtree := $(shell pwd)
6     export KLIBCSRC := usr/klibc
7     export VERSION := $(shell cat $(KLIBCSRC)/version)
8     export KLIBCINC := usr/include
9     export KLIBCOBJ := usr/klibc
10     export KLIBCKERNELSRC := linux/
11     export KLIBCKERNELOBJ := linux/
12     include scripts/Kbuild.include
13    
14     KLIBCROSS ?= $(CROSS_COMPILE)
15     export KLIBCROSS
16     export CC := $(KLIBCROSS)gcc
17     export LD := $(KLIBCROSS)ld
18     export AR := $(KLIBCROSS)ar
19     export RANLIB := $(KLIBCROSS)ranlib
20     export STRIP := $(KLIBCROSS)strip
21     export NM := $(KLIBCROSS)nm
22     export OBJCOPY := $(KLIBCROSS)objcopy
23     export OBJDUMP := $(KLIBCROSS)objdump
24    
25     NOSTDINC_FLAGS := -nostdlib -nostdinc -isystem $(shell $(CC) -print-file-name=include)
26    
27 niro 815 ARCH := $(shell uname -m | sed -e s/i.86/i386/ -e s/parisc64/parisc/ -e s/sun4u/sparc64/ -e s/arm.*/arm/ -e s/sa110/arm/ -e s/sh4/sh/)
28 niro 532 export KLIBCARCH ?= $(ARCH)
29     export KLIBCARCHDIR := $(shell echo $(KLIBCARCH) | sed -e s/s390x/s390/)
30    
31     export HOSTCC := gcc
32     export HOSTCFLAGS := -Wall -Wstrict-prototypes -O2 -fomit-frame-pointer
33     export PERL := perl
34    
35     # Location for installation
36     export prefix = /usr
37     export bindir = $(prefix)/bin
38     export libdir = $(prefix)/lib
39     export mandir = $(prefix)/man
40     export INSTALLDIR = $(prefix)/lib/klibc
41     export INSTALLROOT =
42    
43     # Create a fake .config as present in the kernel tree
44     # But if it exists leave it alone
45     $(if $(wildcard $(objtree)/.config),,$(shell cp defconfig .config))
46    
47     # Prefix Make commands with $(Q) to silence them
48     # Use quiet_cmd_xxx, cmd_xxx to create nice output
49     # use make V=1 to get verbose output
50    
51     ifdef V
52     ifeq ("$(origin V)", "command line")
53     KBUILD_VERBOSE = $(V)
54     endif
55     endif
56     ifndef KBUILD_VERBOSE
57     KBUILD_VERBOSE = 0
58     endif
59    
60     ifeq ($(KBUILD_VERBOSE),1)
61     quiet =
62     Q =
63     else
64     quiet=quiet_
65     Q = @
66     endif
67    
68     # If the user is running make -s (silent mode), suppress echoing of
69     # commands
70    
71     ifneq ($(findstring s,$(MAKEFLAGS)),)
72     quiet=silent_
73     endif
74    
75     export quiet Q KBUILD_VERBOSE
76    
77     # Do not print "Entering directory ..."
78     MAKEFLAGS += --no-print-directory
79    
80     # Shorthand to call Kbuild.klibc
81     klibc := -f $(srctree)/scripts/Kbuild.klibc obj
82    
83     # Very first target
84     .PHONY: all klcc klibc
85     all: klcc klibc
86    
87     .config: defconfig linux
88     @echo "defconfig has changed, please remove or edit .config"
89     @false
90    
91     linux:
92 niro 815 @echo "The 'linux' symlink is missing; it should point to a kernel tree "
93     @echo "configured for the $(KLIBCARCH) architecture."
94     @false
95 niro 532
96     rpmbuild = $(shell which rpmbuild 2>/dev/null || which rpm)
97    
98     klibc.spec: klibc.spec.in $(KLIBCSRC)/version
99     sed -e 's/@@VERSION@@/$(VERSION)/g' < $< > $@
100    
101     # Build klcc - it is the first target
102     klcc: .config
103     $(Q)$(MAKE) $(klibc)=klcc
104    
105     klibc: .config
106     $(Q)$(MAKE) $(klibc)=.
107    
108     test: klibc
109     $(Q)$(MAKE) $(klibc)=usr/klibc/tests
110    
111    
112     ###
113     # allow one to say make dir/file.o
114     # Caveat: works only for .c files where we have a Kbuild file in same dir
115     %.o: %.c FORCE
116     $(Q)$(MAKE) $(klibc)=$(dir $<) $(dir $<)$(notdir $@)
117    
118     %.s: %.c FORCE
119     $(Q)$(MAKE) $(klibc)=$(dir $<) $(dir $<)$(notdir $@)
120    
121     %.i: %.c FORCE
122     $(Q)$(MAKE) $(klibc)=$(dir $<) $(dir $<)$(notdir $@)
123    
124     FORCE: ;
125     ###
126     # clean: remove generated files
127     # mrproper does a full cleaning including .config and linux symlink
128     FIND_IGNORE := \( -name .git \) -prune -o
129     quiet_cmd_rmfiles = $(if $(wildcard $(rm-files)),RM $(wildcard $(rm-files)))
130     cmd_rmfiles = rm -f $(rm-files)
131     clean:
132     $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.clean obj=.
133     $(Q)find . $(FIND_IGNORE) \
134     \( -name *.o -o -name *.a -o -name '.*.cmd' -o \
135     -name '.*.d' -o -name '.*.tmp' \) \
136     -type f -print | xargs rm -f
137    
138     rm-files := .config linux
139     distclean mrproper: clean
140     $(Q)find . $(FIND_IGNORE) \
141     \( -name '*.orig' -o -name '*.rej' -o -name '*~' \
142     -o -name '*.bak' -o -name '#*#' -o -name '.*.orig' \
143     -o -name '.*.rej' -o -size 0 \
144     -o -name '*%' -o -name '.*.cmd' -o -name 'core' \) \
145     -type f -print | xargs rm -f
146     $(call cmd,rmfiles)
147    
148     install: all
149     $(Q)$(MAKE) -f $(srctree)/scripts/Kbuild.install obj=.
150    
151     # This does all the prep work needed to turn a freshly exported git repository
152     # into a release tarball tree
153     release: klibc.spec
154     rm -f maketar.sh .config