[28455] in Source-Commits
installer commit: Makefile: Tweaks to install target; variable names
daemon@ATHENA.MIT.EDU (Jonathan D Reed)
Mon Sep 29 11:14:22 2014
Date: Mon, 29 Sep 2014 11:14:15 -0400
From: Jonathan D Reed <jdreed@mit.edu>
Message-Id: <201409291514.s8TFEFQx010545@drugstore.mit.edu>
To: source-commits@mit.edu
https://github.com/mit-athena/installer/commit/0618486b1e598331521987a5d5812448208afecb
commit 0618486b1e598331521987a5d5812448208afecb
Author: Jonathan Reed <jdreed@mit.edu>
Date: Fri Sep 12 12:53:33 2014 -0400
Makefile: Tweaks to install target; variable names
- Switch from "d" to "DESTDIR" to better align with convention.
- Rename "INSTALLER" to "SUITE", which makes more sense.
- Add a target for DESTDIR which errors out if it doesn't exist.
- Modify the install target to depend on the DESTDIR target
- Cause the build to fail if DESTDIR isn't writable
- Add "-f" to "rm debathena.preseed" in clean
- Standardize on parens for variable expansion
- Simplify the arch-specific "host" target.
- Add LIBEXECDIR to define where in the tarball binaries go,
and add a target for it (and roll the kexec/host targets
into it)
- Drop some unused phony targets
pxe/stage1/Makefile | 49 +++++++++++++++++++++++++++----------------------
1 files changed, 27 insertions(+), 22 deletions(-)
diff --git a/pxe/stage1/Makefile b/pxe/stage1/Makefile
index 22b8690..d24b3e4 100644
--- a/pxe/stage1/Makefile
+++ b/pxe/stage1/Makefile
@@ -1,39 +1,44 @@
# This is pretty dangerous in a bunch of ways. Approach with caution.
-d=/afs/athena.mit.edu/system/athena10/installer/stage1
+DESTDIR=/afs/athena.mit.edu/system/athena10/installer/$(SUITE)
+
+# You only want to change these if testing something.
SERVERIP=18.9.60.73
-INSTALLER=stage1
+SUITE=stage1
+
+# Where, within the tarball, the binaries go.
+LIBEXECDIR=debathena/lib
default:
: Use "make install" to move this from where the installer will fetch it.
-install: host kexec ${d}/debathena.tar.gz
-
-kexec: kexec/kexec
- mkdir -p debathena/lib
- install -m 755 kexec/kexec debathena/lib
+install: $(DESTDIR) $(DESTDIR)/debathena.tar.gz
-host: host.amd64 host.i386
- mkdir -p debathena/lib
- install -m 755 host.amd64 debathena/lib
- install -m 755 host.i386 debathena/lib
+$(DESTDIR):
+ $(error $(DESTDIR) does not exist)
-host.amd64: host/host.c
- gcc -m64 -static host/host.c -lcares -o $@
+host.amd64 host.i386: host/host.c
+ gcc $(if $(subst .amd64,,$(suffix $@)),-m32,-m64) -static $< -lcares -o $@
-host.i386: host/host.c
- gcc -m32 -static host/host.c -lcares -o $@
+$(LIBEXECDIR): host.amd64 host.i386 kexec/kexec
+ mkdir -p $@
+ install -m 755 $^ $@
debathena.preseed:
- @echo "d-i preseed/include_command string wget -q http://$(SERVERIP)/installer/$(INSTALLER)/debathena-loader.sh ; sh debathena-loader.sh" > $@
+ @echo "d-i preseed/include_command string wget -q http://$(SERVERIP)/installer/$(SUITE)/debathena-loader.sh ; sh debathena-loader.sh" > $@
-${d}/debathena.tar.gz: debathena.preseed debathena-loader.sh debathena
+$(DESTDIR)/debathena.tar.gz: debathena.preseed debathena-loader.sh debathena $(LIBEXECDIR)
+ test -w "$(DESTDIR)"
git rev-parse --short HEAD > debathena/version
- tar czvf ${d}/debathena.tar.gz --exclude "*~" debathena
- cp debathena.preseed debathena-loader.sh ${d}
+ tar czvf $(DESTDIR)/debathena.tar.gz --exclude "*~" debathena
+ cp debathena.preseed debathena-loader.sh $(DESTDIR)
rm debathena/version
+ rm -f host.amd64 host.i386
+ rm -f debathena.preseed
+ rm -rf $(LIBEXECDIR)
+
clean:
+ rm -rf $(LIBEXECDIR)
+ rm -f debathena.preseed
rm -f host.amd64 host.i386
- rm -rf debathena/lib
- rm debathena.preseed
-.PHONY: clean install host kexec debathena.preseed
+.PHONY: clean install debathena.preseed