Makefile 1.5 KB
Newer Older
Michael Shigorin's avatar
Michael Shigorin committed
1
# steps to build a distribution image:
2
# --- here
Michael Shigorin's avatar
Michael Shigorin committed
3 4
# 1. initialize new profile (BUILDDIR) as a copy of image.in/
# 2. configure distro
5
# 3. copy subprofiles, script hooks, and package lists/groups
Michael Shigorin's avatar
Michael Shigorin committed
6
#    from metaprofile to new profile (as needed)
7
# --- in BUILDDIR
Michael Shigorin's avatar
Michael Shigorin committed
8
# 4. build subprofiles and subsequently the image
9 10 11

all help:
	@echo '** available distribution targets:'
12
	@echo $(IMAGES) | fmt -sw"$$((COLUMNS>>1))" | column -t
13

14 15 16
# most of the actual work done elsewhere
include clean.mk
include profile.mk
17
include distro.mk
18 19
include log.mk
include iso.mk
20

21
# we can't use implicit rules for top-level targets, only for prereqs
22 23 24 25
# NB: what about static pattern rules?
# TODO: move into libdistro?
DISTROS := $(shell sed -n 's,^distro/\([^:.]\+\):.*$$,\1,p' distro.mk)
IMAGES := $(addsuffix .iso,$(DISTROS))
26

27
# to be passed into distcfg.mk
28 29 30 31
IMAGEDIR ?= $(shell [ -d "$$HOME/out" -a -w "$$HOME/out" ] \
	&& echo "$$HOME/out" \
	|| echo "$(BUILDDIR)/out" )
IMAGENAME ?= mkimage-profiles-$(ARCH).iso
32

33
$(IMAGES): %.iso: | profile/init distro/% boot/isolinux profile/populate iso
34 35
	@# TODO: run automated tests (e.g. iso size)
	@OUTNAME="$(@:.iso=)-$(DATE)-$(ARCH).iso"; \
36
	 OUTPATH="$(IMAGEDIR)/$$OUTNAME"; \
37
		test -s "$(IMAGEDIR)/$(IMAGENAME)" && \
38 39
		mv "$(IMAGEDIR)/$(IMAGENAME)" "$$OUTPATH" && \
		echo "** image: $$OUTPATH" && \
40
		ln -sf "$$OUTNAME" "$(IMAGEDIR)/$@" && \
41 42 43 44 45
		ln -sf "$@" "$(IMAGEDIR)/mkimage-profiles.iso"; \
		if [ -n "$(DEBUG)" ]; then \
			cp -a "$(BUILDLOG)" "$$OUTPATH.log"; \
			cp -a "$(CONFIG)" "$$OUTPATH.cfg"; \
		fi