summaryrefslogtreecommitdiffstats
path: root/Makefile
diff options
context:
space:
mode:
authorDave Reisner <dreisner@archlinux.org>2012-09-28 19:54:10 +0200
committerDave Reisner <dreisner@archlinux.org>2012-10-07 02:38:02 +0200
commit367ac227f42ca9c8a7c050da0bcc04248fae29b1 (patch)
treef40bebd836e87a884b1995fac189d1da5edc6b42 /Makefile
parent4bbca4a841eb6810b003009838cb681fd7ace07a (diff)
downloadmkinitcpio-367ac227f42ca9c8a7c050da0bcc04248fae29b1.tar.gz
mkinitcpio-367ac227f42ca9c8a7c050da0bcc04248fae29b1.tar.xz
commit to some level of style in variable naming
This is an ugly patch, and probably does more than I'd like it to. The idea is that mkinitcpio adopts some sort of consistent style which I'm actually happy with. I define 3 kinds of variables: 1) local variables: all lower case, and scoped within functions. Use freely, as they're well contained. 2) global variables: these are known to mkinitcpio internally, but are global in scope. They mainly carry runtime configuration and collected data during the image generation process. These are always lower case, but carry a leading underscore to denote that they're global. 3) "API" variables: also global in scope, but exist "outside" of mkinitcpio -- either drawn in from the configuration file, or "exported" to the install hooks. These are always all upper case. When introducing new variables, extreme care must be taken to pick names that will not conflict with the environment inherited by mkinitcpio. A HACKING file is introduced with a similar description of the above, and more. Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile12
1 files changed, 6 insertions, 6 deletions
diff --git a/Makefile b/Makefile
index 398be6d..02b042c 100644
--- a/Makefile
+++ b/Makefile
@@ -22,15 +22,15 @@ install: all
mkdir -p ${DESTDIR}
$(foreach dir,${DIRS},install -dm755 ${DESTDIR}${dir};)
- sed -e 's|^CONFIG=.*|CONFIG=/etc/mkinitcpio.conf|' \
- -e 's|^FUNCTIONS=.*|FUNCTIONS=/usr/lib/initcpio/functions|' \
- -e 's|^HOOKDIR=.*|HOOKDIR=({/usr,}/lib/initcpio/hooks)|' \
- -e 's|^INSTDIR=.*|INSTDIR=({/usr,}/lib/initcpio/install)|' \
- -e 's|^PRESETDIR=.*|PRESETDIR=/etc/mkinitcpio.d|' \
+ sed -e 's|^_f_config=.*|_f_config=/etc/mkinitcpio.conf|' \
+ -e 's|^_f_functions=.*|_f_functions=/usr/lib/initcpio/functions|' \
+ -e 's|^_d_hooks=.*|_d_hooks=({/usr,}/lib/initcpio/hooks)|' \
+ -e 's|^_d_install=.*|_d_install=({/usr,}/lib/initcpio/install)|' \
+ -e 's|^_d_presets=.*|_d_presets=/etc/mkinitcpio.d|' \
-e 's|%VERSION%|${VERSION}|g' \
< mkinitcpio > ${DESTDIR}/usr/bin/mkinitcpio
- sed -e 's|\(^declare FUNCTIONS\)=.*|\1=/usr/lib/initcpio/functions|' \
+ sed -e 's|\(^_f_functions\)=.*|\1=/usr/lib/initcpio/functions|' \
-e 's|%VERSION%|${VERSION}|g' \
< lsinitcpio > ${DESTDIR}/usr/bin/lsinitcpio