On 08/18/2012 06:48 AM, Lukas Fleischer wrote:
Move all hooks into a list and create shell commands dynamically instead of specifying all of them in every recipe.
Signed-off-by: Lukas Fleischer<archlinux@cryptocrack.de> --- Makefile | 57 +++++++++++++++++++++++---------------------------------- 1 file changed, 23 insertions(+), 34 deletions(-)
diff --git a/Makefile b/Makefile index 309f890..552d8cc 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,24 @@ V=1
+HOOKS = \ + hooks/archiso \ + install/archiso \ + archiso_shutdown \ + hooks/archiso_shutdown \ + install/archiso_shutdown \ + archiso_pxe_nbd \ + hooks/archiso_pxe_common \ + install/archiso_pxe_common \ + hooks/archiso_pxe_nbd \ + install/archiso_pxe_nbd \ + hooks/archiso_pxe_http \ + install/archiso_pxe_http \ + hooks/archiso_pxe_nfs \ + install/archiso_pxe_nfs \ + hooks/archiso_loop_mnt \ + install/archiso_loop_mnt \ + install/archiso_kms + all:
install: install-program install-hooks install-examples install-doc @@ -9,23 +28,9 @@ install-program:
install-hooks: # hooks/install are needed by mkinitcpio - install -D -m 644 archiso/hooks/archiso $(DESTDIR)/usr/lib/initcpio/hooks/archiso - install -D -m 644 archiso/install/archiso $(DESTDIR)/usr/lib/initcpio/install/archiso - install -D -m 755 archiso/archiso_shutdown $(DESTDIR)/usr/lib/initcpio/archiso_shutdown - install -D -m 644 archiso/hooks/archiso_shutdown $(DESTDIR)/usr/lib/initcpio/hooks/archiso_shutdown - install -D -m 644 archiso/install/archiso_shutdown $(DESTDIR)/usr/lib/initcpio/install/archiso_shutdown - install -D -m 644 archiso/archiso_pxe_nbd $(DESTDIR)/usr/lib/initcpio/archiso_pxe_nbd - install -D -m 644 archiso/hooks/archiso_pxe_common $(DESTDIR)/usr/lib/initcpio/hooks/archiso_pxe_common - install -D -m 644 archiso/install/archiso_pxe_common $(DESTDIR)/usr/lib/initcpio/install/archiso_pxe_common - install -D -m 644 archiso/hooks/archiso_pxe_nbd $(DESTDIR)/usr/lib/initcpio/hooks/archiso_pxe_nbd - install -D -m 644 archiso/install/archiso_pxe_nbd $(DESTDIR)/usr/lib/initcpio/install/archiso_pxe_nbd - install -D -m 644 archiso/hooks/archiso_pxe_http $(DESTDIR)/usr/lib/initcpio/hooks/archiso_pxe_http - install -D -m 644 archiso/install/archiso_pxe_http $(DESTDIR)/usr/lib/initcpio/install/archiso_pxe_http - install -D -m 644 archiso/hooks/archiso_pxe_nfs $(DESTDIR)/usr/lib/initcpio/hooks/archiso_pxe_nfs - install -D -m 644 archiso/install/archiso_pxe_nfs $(DESTDIR)/usr/lib/initcpio/install/archiso_pxe_nfs - install -D -m 644 archiso/hooks/archiso_loop_mnt $(DESTDIR)/usr/lib/initcpio/hooks/archiso_loop_mnt - install -D -m 644 archiso/install/archiso_loop_mnt $(DESTDIR)/usr/lib/initcpio/install/archiso_loop_mnt - install -D -m 644 archiso/install/archiso_kms $(DESTDIR)/usr/lib/initcpio/install/archiso_kms + $(foreach hook,$(HOOKS), \ + install -D -m 644 archiso/$(hook) $(DESTDIR)/usr/lib/initcpio/$(hook) ; \ + ) Warning, not all files are 644, look... ;)
install-examples: install -d -m 755 $(DESTDIR)/usr/share/archiso/ @@ -37,23 +42,7 @@ install-doc:
uninstall: rm -f $(DESTDIR)/usr/sbin/mkarchiso - rm -f $(DESTDIR)/usr/lib/initcpio/hooks/archiso - rm -f $(DESTDIR)/usr/lib/initcpio/install/archiso - rm -f $(DESTDIR)/usr/lib/initcpio/archiso_shutdown - rm -f $(DESTDIR)/usr/lib/initcpio/hooks/archiso_shutdown - rm -f $(DESTDIR)/usr/lib/initcpio/install/archiso_shutdown - rm -f $(DESTDIR)/usr/lib/initcpio/archiso_pxe_nbd - rm -f $(DESTDIR)/usr/lib/initcpio/hooks/archiso_pxe_common - rm -f $(DESTDIR)/usr/lib/initcpio/install/archiso_pxe_common - rm -f $(DESTDIR)/usr/lib/initcpio/hooks/archiso_pxe_nbd - rm -f $(DESTDIR)/usr/lib/initcpio/install/archiso_pxe_nbd - rm -f $(DESTDIR)/usr/lib/initcpio/hooks/archiso_pxe_http - rm -f $(DESTDIR)/usr/lib/initcpio/install/archiso_pxe_http - rm -f $(DESTDIR)/usr/lib/initcpio/hooks/archiso_pxe_nfs - rm -f $(DESTDIR)/usr/lib/initcpio/install/archiso_pxe_nfs - rm -f $(DESTDIR)/usr/lib/initcpio/hooks/archiso_loop_mnt - rm -f $(DESTDIR)/usr/lib/initcpio/install/archiso_loop_mnt - rm -f $(DESTDIR)/usr/lib/initcpio/install/archiso_kms + $(foreach hook,$(HOOKS),rm -f $(DESTDIR)/usr/lib/initcpio/$(hook) ; ) rm -rf $(DESTDIR)/usr/share/archiso/ rm -f $(DESTDIR)/usr/share/doc/archiso/README
Thanks you, but If this will be refactored, I prefer to do in a more "makefile way" if possible. -- Gerardo Exequiel Pozzi \cos^2\alpha + \sin^2\alpha = 1