1 VERSION := $(shell cat version)
2 SUBDIRS = klibc ash ipconfig nfsmount utils kinit gzip
7 rpmbuild = $(shell which rpmbuild 2>/dev/null || which rpm)
9 klibc.spec: klibc.spec.in version
10 sed -e 's/@@VERSION@@/$(VERSION)/g' < $< > $@
14 +$(rpmbuild) -bb klibc.spec --target=$(ARCH)
16 $(CROSS)klibc.config: Makefile
18 echo 'ARCH=$(ARCH)' >> $@
19 echo 'CROSS=$(CROSS)' >> $@
20 echo 'KCROSS=$(KCROSS)' >> $@
23 echo 'REQFLAGS=$(filter-out -I%,$(REQFLAGS))' >> $@
24 echo 'OPTFLAGS=$(OPTFLAGS)' >> $@
25 echo 'LDFLAGS=$(LDFLAGS)' >> $@
26 echo 'STRIP=$(STRIP)' >> $@
27 echo 'STRIPFLAGS=$(STRIPFLAGS)' >> $@
28 echo 'EMAIN=$(EMAIN)' >> $@
29 echo 'BITSIZE=$(BITSIZE)' >> $@
30 echo 'prefix=$(INSTALLDIR)' >> $@
31 echo 'bindir=$(INSTALLDIR)/$(KCROSS)bin' >> $@
32 echo 'libdir=$(INSTALLDIR)/$(KCROSS)lib' >> $@
33 echo 'includedir=$(INSTALLDIR)/$(KCROSS)include' >> $@
35 $(CROSS)klcc: klcc.in $(CROSS)klibc.config makeklcc.pl
36 $(PERL) makeklcc.pl klcc.in $(CROSS)klibc.config \
37 $(shell bash -c 'type -p $(PERL)') > $@ || ( rm -f $@ ; exit 1 )
41 @set -e; for d in $(SUBDIRS); do $(MAKE) -C $$d $@; done
43 local-all: $(CROSS)klcc
46 rm -f klibc.config klcc
48 local-spotless: local-clean
49 rm -f klibc.spec *~ tags
51 local-install: $(CROSS)klcc
52 mkdir -p $(INSTALLROOT)$(bindir)
53 mkdir -p $(INSTALLROOT)$(mandir)/man1
54 mkdir -p $(INSTALLROOT)$(SHLIBDIR)
55 mkdir -p $(INSTALLROOT)$(INSTALLDIR)
56 -rm -rf $(INSTALLROOT)$(INSTALLDIR)/$(KCROSS)include
57 mkdir -p $(INSTALLROOT)$(INSTALLDIR)/$(KCROSS)include
58 mkdir -p $(INSTALLROOT)$(INSTALLDIR)/$(KCROSS)lib
59 mkdir -p $(INSTALLROOT)$(INSTALLDIR)/$(KCROSS)bin
60 set -xe ; for d in linux scsi asm-$(ARCH) asm-generic $(ASMARCH); do \
61 mkdir -p $(INSTALLROOT)$(INSTALLDIR)/$(CROSS)include/$$d ; \
62 for r in $(KRNLSRC)/include $(KRNLOBJ)/include $(KRNLOBJ)/include2 ; do \
64 cp -rfL $$r/$$d/. $(INSTALLROOT)$(INSTALLDIR)/$(KCROSS)include/$$d/. ; \
67 cd $(INSTALLROOT)$(INSTALLDIR)/$(KCROSS)include && ln -sf asm-$(ARCH) asm
68 cp -rf include/. $(INSTALLROOT)$(INSTALLDIR)/$(KCROSS)include/.
69 $(INSTALL_DATA) klcc.1 $(INSTALLROOT)$(mandir)/man1/$(KCROSS)klcc.1
70 $(INSTALL_EXEC) $(KCROSS)klcc $(INSTALLROOT)$(bindir)
72 # This does all the prep work needed to turn a freshly exported git repository
73 # into a release tarball tree