Makefile 1.52 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 image
9 10 11

all help:
	@echo '** available distribution targets:'
12
	@echo $(DISTROS) | 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
CONFIGS := $(shell sed -n 's,^distro/\([^:.]\+\):.*$$,\1,p' distro.mk)
23
DISTROS := $(addsuffix .iso,$(CONFIGS))
24
ARCH ?= $(shell arch | sed 's/i686/i586/')
25 26
DATE = $(shell date +%Y%m%d)

27
export ARCH DATE
28

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

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