VERSION=$(shell cat VERSION) ARCH := $(patsubst i%86,i386,$(shell uname -m)) ARCH := $(patsubst sparc%,sparc,$(ARCH)) SUBDIRS = nash grubby livecd isolinux #ifeq ($(ARCH),sparc) #SUBDIRS += loadinitrd #endif #ifeq ($(ARCH),i386) #SUBDIRS += loadinitrd #endif OPTCFLAGS = $(CFLAGS) mandir = usr/share/man docdir = usr/share/doc/mkinitrd-$(VERSION) all: for n in $(SUBDIRS); do make -C $$n; done make -C klibc 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 mrproper: clean make -C busybox mrproper make -C klibc mrproper