2003-12-17 11:22:55 +03:00
VERSION := $( shell cat version)
2005-01-17 11:26:07 +03:00
SUBDIRS = klibc ash ipconfig nfsmount utils kinit gzip
2005-03-04 06:26:44 +03:00
SRCROOT = .
2005-04-27 07:59:47 +04:00
2003-10-23 05:37:40 +04:00
all :
2003-12-17 11:22:55 +03:00
rpmbuild = $( shell which rpmbuild 2>/dev/null || which rpm)
klibc.spec : klibc .spec .in version
sed -e 's/@@VERSION@@/$(VERSION)/g' < $< > $@
.PHONY : rpm
rpm : klibc .spec
2004-10-06 05:32:12 +04:00
+$( rpmbuild) -bb klibc.spec --target= $( ARCH)
2003-12-17 11:22:55 +03:00
2005-03-04 06:26:44 +03:00
$(CROSS)klibc.config : Makefile
rm -f $@
echo 'ARCH=$(ARCH)' >> $@
echo 'CROSS=$(CROSS)' >> $@
2005-03-05 09:36:51 +03:00
echo 'KCROSS=$(KCROSS)' >> $@
2005-04-11 06:51:03 +04:00
echo 'CC=$(CC)' >> $@
echo 'LD=$(LD)' >> $@
2005-03-04 06:26:44 +03:00
echo 'REQFLAGS=$(filter-out -I%,$(REQFLAGS))' >> $@
echo 'OPTFLAGS=$(OPTFLAGS)' >> $@
echo 'LDFLAGS=$(LDFLAGS)' >> $@
2005-04-11 06:51:03 +04:00
echo 'STRIP=$(STRIP)' >> $@
2005-03-04 06:26:44 +03:00
echo 'STRIPFLAGS=$(STRIPFLAGS)' >> $@
echo 'EMAIN=$(EMAIN)' >> $@
echo 'BITSIZE=$(BITSIZE)' >> $@
2005-03-10 19:51:43 +03:00
echo 'prefix=$(INSTALLDIR)' >> $@
echo 'bindir=$(INSTALLDIR)/$(KCROSS)bin' >> $@
echo 'libdir=$(INSTALLDIR)/$(KCROSS)lib' >> $@
echo 'includedir=$(INSTALLDIR)/$(KCROSS)include' >> $@
2003-12-17 11:22:55 +03:00
2005-03-04 06:26:44 +03:00
$(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 $@
2003-12-17 11:22:55 +03:00
2005-03-04 06:26:44 +03:00
% : local -%
2003-12-17 11:22:55 +03:00
@set -e; for d in $( SUBDIRS) ; do $( MAKE) -C $$ d $@ ; done
2005-03-04 06:26:44 +03:00
local-all : $( CROSS ) klcc
local-clean :
rm -f klibc.config klcc
2005-04-11 06:51:03 +04:00
local-spotless : local -clean
2003-12-17 11:22:55 +03:00
rm -f klibc.spec *~ tags
2005-03-04 06:26:44 +03:00
local-install : $( CROSS ) klcc
mkdir -p $( INSTALLROOT) $( bindir)
mkdir -p $( INSTALLROOT) $( mandir) /man1
mkdir -p $( INSTALLROOT) $( SHLIBDIR)
mkdir -p $( INSTALLROOT) $( INSTALLDIR)
2005-03-05 09:36:51 +03:00
-rm -rf $( INSTALLROOT) $( INSTALLDIR) /$( KCROSS) include
mkdir -p $( INSTALLROOT) $( INSTALLDIR) /$( KCROSS) include
mkdir -p $( INSTALLROOT) $( INSTALLDIR) /$( KCROSS) lib
mkdir -p $( INSTALLROOT) $( INSTALLDIR) /$( KCROSS) bin
2005-03-07 09:04:46 +03:00
set -xe ; for d in linux scsi asm-$( ARCH) asm-generic $( ASMARCH) ; do \
2005-03-04 06:26:44 +03:00
mkdir -p $( INSTALLROOT) $( INSTALLDIR) /$( CROSS) include/$$ d ; \
2005-03-05 09:36:51 +03:00
for r in $( KRNLSRC) /include $( KRNLOBJ) /include $( KRNLOBJ) /include2 ; do \
[ ! -d $$ r/$$ d ] || \
cp -rfL $$ r/$$ d/. $( INSTALLROOT) $( INSTALLDIR) /$( KCROSS) include/$$ d/. ; \
done ; \
2005-03-04 06:26:44 +03:00
done
2005-03-05 09:36:51 +03:00
cd $( INSTALLROOT) $( INSTALLDIR) /$( KCROSS) include && ln -sf asm-$( ARCH) asm
cp -rf include/. $( INSTALLROOT) $( INSTALLDIR) /$( KCROSS) include/.
$( INSTALL_DATA) klcc.1 $( INSTALLROOT) $( mandir) /man1/$( KCROSS) klcc.1
$( INSTALL_EXEC) $( KCROSS) klcc $( INSTALLROOT) $( bindir)
2005-03-04 06:26:44 +03:00
- i n c l u d e M C O N F I G