diff options
Diffstat (limited to 'klibc/Makefile')
-rw-r--r-- | klibc/Makefile | 54 |
1 files changed, 49 insertions, 5 deletions
diff --git a/klibc/Makefile b/klibc/Makefile index 2506417ef5..eb8f55570d 100644 --- a/klibc/Makefile +++ b/klibc/Makefile @@ -1,5 +1,6 @@ VERSION := $(shell cat version) SUBDIRS = klibc ash ipconfig nfsmount utils kinit gzip +SRCROOT = . all: @@ -12,12 +13,55 @@ klibc.spec: klibc.spec.in version rpm: klibc.spec +$(rpmbuild) -bb klibc.spec --target=$(ARCH) -%: - @set -e; for d in $(SUBDIRS); do $(MAKE) -C $$d $@; done +$(CROSS)klibc.config: Makefile + rm -f $@ + echo 'ARCH=$(ARCH)' >> $@ + echo 'CROSS=$(CROSS)' >> $@ + echo "CC=$(shell bash -c 'type -p $(CC)')" >> $@ + echo "LD=$(shell bash -c 'type -p $(LD)')" >> $@ + echo 'REQFLAGS=$(filter-out -I%,$(REQFLAGS))' >> $@ + echo 'OPTFLAGS=$(OPTFLAGS)' >> $@ + echo 'LDFLAGS=$(LDFLAGS)' >> $@ + echo "STRIP=$(shell bash -c 'type -p $(STRIP)')" >> $@ + echo 'STRIPFLAGS=$(STRIPFLAGS)' >> $@ + echo 'EMAIN=$(EMAIN)' >> $@ + echo 'BITSIZE=$(BITSIZE)' >> $@ + echo 'INSTALLDIR=$(INSTALLDIR)' >> $@ -clean: - @set -e; for d in $(SUBDIRS); do $(MAKE) -C $$d $@; done +$(CROSS)klcc: klcc.in $(CROSS)klibc.config makeklcc.pl + $(PERL) makeklcc.pl klcc.in $(CROSS)klibc.config \ + $(shell bash -c 'type -p $(PERL)') > $@ || ( rm -f $@ ; exit 1 ) + chmod a+x $@ -spotless: +%: local-% @set -e; for d in $(SUBDIRS); do $(MAKE) -C $$d $@; done + +local-all: $(CROSS)klcc + +local-clean: + rm -f klibc.config klcc + +local-spotless: rm -f klibc.spec *~ tags + +local-install: $(CROSS)klcc + mkdir -p $(INSTALLROOT)$(bindir) + mkdir -p $(INSTALLROOT)$(mandir)/man1 + mkdir -p $(INSTALLROOT)$(SHLIBDIR) + mkdir -p $(INSTALLROOT)$(INSTALLDIR) + -rm -rf $(INSTALLROOT)$(INSTALLDIR)/$(CROSS)include + mkdir -p $(INSTALLROOT)$(INSTALLDIR)/$(CROSS)include + mkdir -p $(INSTALLROOT)$(INSTALLDIR)/$(CROSS)lib + mkdir -p $(INSTALLROOT)$(INSTALLDIR)/$(CROSS)bin + set -xe ; for d in linux asm asm-generic ; do \ + mkdir -p $(INSTALLROOT)$(INSTALLDIR)/$(CROSS)include/$$d ; \ + cp -rfL $(KRNLSRC)/include/$$d/. $(INSTALLROOT)$(INSTALLDIR)/$(CROSS)include/$$d/. ; \ + cp -rfL $(KRNLOBJ)/include/$$d/. $(INSTALLROOT)$(INSTALLDIR)/$(CROSS)include/$$d/. ; \ + [ ! -d $(KRNLOBJ)/include2/$$d ] || \ + cp -rfL $(KRNLOBJ)/include2/$$d/. $(INSTALLROOT)$(INSTALLDIR)/$(CROSS)include/$$d/. ; \ + done + cp -rf include/. $(INSTALLROOT)$(INSTALLDIR)/$(CROSS)include/. + $(INSTALL_DATA) klcc.1 $(INSTALLROOT)$(mandir)/man1/$(CROSS)klcc.1 + $(INSTALL_EXEC) $(CROSS)klcc $(INSTALLROOT)$(bindir) + +-include MCONFIG |