2009-06-04 15:08:39 +04:00
VERSION = 0.1
2009-03-05 13:05:35 +03:00
GITVERSION = $( shell [ -d .git ] && git rev-list --abbrev-commit -n 1 HEAD | cut -b 1-8)
2009-03-05 12:17:29 +03:00
2009-06-04 19:19:42 +04:00
prefix = /usr
libdir = ${ prefix } /lib
pkglibdir = ${ libdir } /dracut
sysconfdir = ${ prefix } /etc
sbindir = ${ prefix } /sbin
2009-03-04 15:54:55 +03:00
modules.d/99base/switch_root : switch_root .c
gcc -o modules.d/99base/switch_root switch_root.c
all : modules .d /99base /switch_root
2008-12-18 23:58:15 +03:00
2009-05-25 16:43:03 +04:00
.PHONY : install clean archive rpm testimage test all check
2009-03-08 18:49:44 +03:00
2008-12-18 23:58:15 +03:00
install :
2009-06-04 19:19:42 +04:00
mkdir -p $( DESTDIR) $( pkglibdir)
mkdir -p $( DESTDIR) $( sbindir)
mkdir -p $( DESTDIR) $( sysconfdir)
mkdir -p $( DESTDIR) $( pkglibdir) /modules.d
install -m 0755 dracut $( DESTDIR) $( sbindir) /dracut
2009-06-04 19:23:41 +04:00
install -m 0755 modules.d/99base/switch_root $( DESTDIR) $( sbindir) /switch_root
2009-06-04 19:19:42 +04:00
install -m 0644 dracut.conf $( DESTDIR) $( sysconfdir) /dracut.conf
install -m 0755 dracut-functions $( DESTDIR) $( pkglibdir) /dracut-functions
cp -arx modules.d $( DESTDIR) $( pkglibdir)
2009-06-04 19:23:41 +04:00
rm $( DESTDIR) $( pkglibdir) /modules.d/99base/switch_root
2009-03-04 16:23:02 +03:00
2008-12-18 23:58:15 +03:00
clean :
rm -f *~
2009-03-04 16:23:02 +03:00
rm -f modules.d/99base/switch_root
2009-03-05 16:20:05 +03:00
rm -f test-*.img
2009-05-25 16:43:03 +04:00
make -C test clean
2008-12-18 23:58:15 +03:00
2009-03-05 12:48:18 +03:00
archive : dracut -$( VERSION ) -$( GITVERSION ) .tar .bz 2
dracut-$(VERSION)-$(GITVERSION).tar.bz2 :
2009-03-05 12:17:29 +03:00
git archive --format= tar HEAD --prefix= dracut-$( VERSION) -$( GITVERSION) / | bzip2 > dracut-$( VERSION) -$( GITVERSION) .tar.bz2
2009-03-05 12:48:18 +03:00
rpm : dracut -$( VERSION ) -$( GITVERSION ) .tar .bz 2
2009-03-05 13:28:09 +03:00
rpmbuild --define " _topdir $$ PWD " --define " _sourcedir $$ PWD " --define " _specdir $$ PWD " --define " _srcrpmdir $$ PWD " --define " _rpmdir $$ PWD " --define " gittag $( GITVERSION) " -ba dracut.spec
rm -fr BUILD BUILDROOT
2009-03-05 12:33:18 +03:00
2009-05-25 16:43:03 +04:00
check : all
2009-05-15 14:44:36 +04:00
@ret= 0; for i in modules.d/99base/init modules.d/*/*.sh; do \
dash -n " $$ i " ; ret = $$ ( ( $$ ret+$$ ?) ) ; \
done ; exit $$ ret
2009-05-25 16:43:03 +04:00
make -C test check
2009-05-15 14:44:36 +04:00
2009-03-05 13:07:52 +03:00
testimage : all
2009-06-03 19:04:43 +04:00
./dracut -l -f test-$( shell uname -r) .img $( shell uname -r)
2009-03-05 16:20:05 +03:00
@echo wrote test-$( shell uname -r) .img