VERSION=$(shell cat VERSION) ARCH := $(patsubst i%86,i386,$(shell uname -m)) ARCH := $(patsubst sparc%,sparc,$(ARCH)) SUBDIRS = grubby livecd isolinux #ifeq ($(ARCH),sparc) #SUBDIRS += loadinitrd #endif #ifeq ($(ARCH),i386) #SUBDIRS += loadinitrd #endif OPTCFLAGS = $(CFLAGS) LINUX_SOURCES=/usr/src/linux mandir = usr/share/man docdir = usr/share/doc/mkinitrd-$(VERSION) all: for n in $(SUBDIRS); do make -C $$n; done # use linux sources from default path, not the installed kernel ln -snf $(LINUX_SOURCES) klibc/linux make -C klibc # force chmod +x for scripts in busybox chmod +x busybox/scripts/*.sh make -C busybox defconfig make -C busybox sed 's:%VERSIONTAG%:$(VERSION):' < mkinitrd.in > mkinitrd test: all for i in grubby busybox klibc; do make -C $$i test; done install: for n in $(SUBDIRS); do make -C $$n install DESTDIR=$(DESTDIR); done for i in etc/conf.d sbin usr/sbin $(mandir)/man8 $(docdir)/busybox $(docdir)/klibc; do \ if [ ! -d $(DESTDIR)/$$i ]; then \ mkdir -p $(DESTDIR)/$$i; \ fi; \ done install -m755 mkinitrd $(DESTDIR)/sbin/mkinitrd install -m755 installkernel $(DESTDIR)/sbin/installkernel chmod 755 $(DESTDIR)/sbin/mkinitrd install -m644 mkinitrd.8 $(DESTDIR)/$(mandir)/man8/mkinitrd.8 install -m644 mkinitrd.confd $(DESTDIR)/etc/conf.d/mkinitrd install -m755 busybox/busybox $(DESTDIR)/usr/sbin/busybox.mkinitrd cat busybox/LICENSE | gzip -9 > $(DESTDIR)/$(docdir)/busybox/LICENSE.gz cat busybox/README | gzip -9 > $(DESTDIR)/$(docdir)/busybox/README.gz cat busybox/TODO | gzip -9 > $(DESTDIR)/$(docdir)/busybox/TODO.gz install -m755 klibc/usr/kinit/run-init/static/run-init $(DESTDIR)/usr/sbin/run-init.mkinitrd cat klibc/usr/klibc/README | gzip -9 > $(DESTDIR)/$(docdir)/klibc/README.gz cat klibc/usr/klibc/LICENSE | gzip -9 > $(DESTDIR)/$(docdir)/klibc/LICENSE.gz clean: for n in $(SUBDIRS) busybox klibc isolinux; do make -C $$n clean; done rm -f mkinitrd rm klibc/linux mrproper: clean make -C busybox mrproper make -C klibc mrproper