Magellan Linux

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 532 - (show annotations) (download)
Sat Sep 1 22:45:15 2007 UTC (16 years, 8 months ago) by niro
File size: 4068 byte(s)
-import if magellan mkinitrd; it is a fork of redhats mkinitrd-5.0.8 with all magellan patches and features; deprecates magellan-src/mkinitrd

1 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 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/)
28 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 ln -snf /lib/modules/$(shell uname -r)/build linux
93
94 rpmbuild = $(shell which rpmbuild 2>/dev/null || which rpm)
95
96 klibc.spec: klibc.spec.in $(KLIBCSRC)/version
97 sed -e 's/@@VERSION@@/$(VERSION)/g' < $< > $@
98
99 # Build klcc - it is the first target
100 klcc: .config
101 $(Q)$(MAKE) $(klibc)=klcc
102
103 klibc: .config
104 $(Q)$(MAKE) $(klibc)=.
105
106 test: klibc
107 $(Q)$(MAKE) $(klibc)=usr/klibc/tests
108
109
110 ###
111 # allow one to say make dir/file.o
112 # Caveat: works only for .c files where we have a Kbuild file in same dir
113 %.o: %.c FORCE
114 $(Q)$(MAKE) $(klibc)=$(dir $<) $(dir $<)$(notdir $@)
115
116 %.s: %.c FORCE
117 $(Q)$(MAKE) $(klibc)=$(dir $<) $(dir $<)$(notdir $@)
118
119 %.i: %.c FORCE
120 $(Q)$(MAKE) $(klibc)=$(dir $<) $(dir $<)$(notdir $@)
121
122 FORCE: ;
123 ###
124 # clean: remove generated files
125 # mrproper does a full cleaning including .config and linux symlink
126 FIND_IGNORE := \( -name .git \) -prune -o
127 quiet_cmd_rmfiles = $(if $(wildcard $(rm-files)),RM $(wildcard $(rm-files)))
128 cmd_rmfiles = rm -f $(rm-files)
129 clean:
130 $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.clean obj=.
131 $(Q)find . $(FIND_IGNORE) \
132 \( -name *.o -o -name *.a -o -name '.*.cmd' -o \
133 -name '.*.d' -o -name '.*.tmp' \) \
134 -type f -print | xargs rm -f
135
136 rm-files := .config linux
137 distclean mrproper: clean
138 $(Q)find . $(FIND_IGNORE) \
139 \( -name '*.orig' -o -name '*.rej' -o -name '*~' \
140 -o -name '*.bak' -o -name '#*#' -o -name '.*.orig' \
141 -o -name '.*.rej' -o -size 0 \
142 -o -name '*%' -o -name '.*.cmd' -o -name 'core' \) \
143 -type f -print | xargs rm -f
144 $(call cmd,rmfiles)
145
146 install: all
147 $(Q)$(MAKE) -f $(srctree)/scripts/Kbuild.install obj=.
148
149 # This does all the prep work needed to turn a freshly exported git repository
150 # into a release tarball tree
151 release: klibc.spec
152 rm -f maketar.sh .config