Makefile restructuring proposal

Alexander E. Patrakov patrakov at
Sun Jul 17 07:47:52 PDT 2005


right now the Live CD Makefiles are equivalent to shell scripts. I mean 
that all targets are always remade, and the need to actually build a 
package, download a file, ... is checked at shell level, not at makefile 

Also the current system has a drawback that if one editor bumps a 
package version, others don't pick up the command to rebuild that 
package (what happens is: the nev version of foo is downloaded, but 
/usr/bin/foo is in place, therefore the package doesn't get rebuilt). 
For ./configure arguments changing, the situation is even worse: nothing 
is done automatically to reflect that change.

Another drawback is that in order to forcibly rebuild a package, a file 
must be removed from the chroot. I already made a mistake and deleted my 
/bin/ls outside of chroot. I don't want to make this mistake again. 
There must be a safer method to forcibly rebuild a package.

Attached is a patch that adds a restructured Makefile for a sample 
package "byacc" (in fact I will need that package in /usr in the utf8 
branch soon, because it is a dependency for the OpenI18n testsuite). The 
only installed file is /usr/local/bin/yacc, so it is easy to delete.

This makefile checks the need to download and build the package by using 
make rules, not @if... constructs. Try changing the VRS variable and see 
how the package gets re-downloaded and re-built. Touch Makefile to 
forcibly rebuild byacc.

Drawback: this works reliably only if svn doesn't set timestamps on 
downloaded files. Is there any option for this?

Alexander E. Patrakov
-------------- next part --------------
Index: Makefile
--- Makefile	(revision 353)
+++ Makefile	(working copy)
@@ -176,6 +176,7 @@
 post-bash: ch-file ch-libtool ch-bzip2 ch-diffutils ch-kbd ch-e2fsprogs ch-grep ch-grub ch-gzip \
 	ch-hotplug ch-man ch-make ch-module-init-tools ch-patch ch-procps ch-psmisc ch-shadow \
+	ch-byacc \
 	ch-sysklogd ch-sysvinit ch-tar ch-udev ch-util-linux ch-environment
 blfs: ch-openssl ch-wget ch-reiserfsprogs ch-xfsprogs ch-nano ch-joe ch-screen ch-curl ch-zip \
@@ -552,6 +553,10 @@
 	make -C $(PKG)/$@ chroot
 	make unmount
+byacc: prep-chroot
+	make -C $(PKG)/$@ chroot
+	make unmount
 sysklogd: prep-chroot 
 	make -C $(PKG)/$@ chroot
 	make unmount
@@ -1153,6 +1158,9 @@
 ch-shadow: popdev
 	make -C $(PKG)/shadow stage2
+ch-byacc: popdev
+	make -C $(PKG)/byacc stage2
 ch-sysklogd: popdev
 	make -C $(PKG)/sysklogd stage2
Index: packages/byacc/Makefile
--- packages/byacc/Makefile	(revision 0)
+++ packages/byacc/Makefile	(revision 0)
@@ -0,0 +1,32 @@
+# byacc makefile
+	$(WGET) $(URL)
+	@chroot "$(MP)" $(chenv2) 'cd $(ROOT) && make ch-$(NM) $(chbash2)'
+stage2: Makefile $(FILE)
+	@echo ""
+	@echo "=====> Building $(NM) in chroot"
+	@echo ""
+	unpack $(FILE)
+	$(MAKE) -C $(DIR) -f ../Makefile compile-stage2
+	$(MAKE) clean
+	touch stage2
+	./configure --prefix=/usr/local
+	make
+	make install
+	rm -rf $(DIR)
+.PHONY: chroot compile-stage2 clean

More information about the livecd mailing list