[arch-projects] [initscripts] [PATCH] Use a Makefile and clean up install file
Use a Makefile to compile, rather than a call to gcc in install.sh. This allows make's implict rules to take care of CFLAGS, LDFLAGS, CC, etc. Use `set -e` in the install file rather than needing '|| exit 1' on every single operation. Signed-off-by: Dan McGee <dan@archlinux.org> --- .gitignore | 2 ++ Makefile | 4 ++++ install.sh | 24 +++++++++++++----------- 3 files changed, 19 insertions(+), 11 deletions(-) create mode 100644 Makefile diff --git a/.gitignore b/.gitignore index 48f20c7..c601da6 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,4 @@ minilogd +minilogd.o +tags *.pkg.tar.* diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..520700b --- /dev/null +++ b/Makefile @@ -0,0 +1,4 @@ +minilogd: minilogd.o + +clean: + rm -f minilogd minilogd.o diff --git a/install.sh b/install.sh index c70a10e..e469577 100755 --- a/install.sh +++ b/install.sh @@ -1,25 +1,27 @@ #!/bin/sh -install -d -m755 ${DESTDIR}/etc/rc.d || exit 1 -install -d -m755 ${DESTDIR}/etc/conf.d || exit 1 -install -d -m755 ${DESTDIR}/etc/rc.d/functions.d/ || exit 1 -install -d -m755 ${DESTDIR}/etc/cron.hourly/ || exit 1 +set -e + +install -d -m755 ${DESTDIR}/etc/rc.d +install -d -m755 ${DESTDIR}/etc/conf.d +install -d -m755 ${DESTDIR}/etc/rc.d/functions.d/ +install -d -m755 ${DESTDIR}/etc/cron.hourly/ for i in inittab rc.conf; do - install -D -m644 $i ${DESTDIR}/etc/$i || exit 1 + install -D -m644 $i ${DESTDIR}/etc/$i done for i in rc.local rc.local.shutdown rc.multi rc.shutdown rc.single rc.sysinit; do - install -D -m755 $i ${DESTDIR}/etc/$i || exit 1 + install -D -m755 $i ${DESTDIR}/etc/$i done install -D -m755 adjtime.cron ${DESTDIR}/etc/cron.hourly/adjtime -install -D -m644 functions ${DESTDIR}/etc/rc.d/functions || exit 1 +install -D -m644 functions ${DESTDIR}/etc/rc.d/functions for i in hwclock network netfs; do - install -D -m755 $i ${DESTDIR}/etc/rc.d/$i || exit 1 + install -D -m755 $i ${DESTDIR}/etc/rc.d/$i done -gcc $CFLAGS -o minilogd minilogd.c || exit 1 -install -D -m755 minilogd ${DESTDIR}/sbin/minilogd || exit 1 +make minilogd +install -D -m755 minilogd ${DESTDIR}/sbin/minilogd -install -D -m755 rc ${DESTDIR}/sbin/rc || exit 1 +install -D -m755 rc ${DESTDIR}/sbin/rc -- 1.7.4.4
On Thu, Apr 21, 2011 at 9:05 PM, Dan McGee <dan@archlinux.org> wrote:
Use a Makefile to compile, rather than a call to gcc in install.sh. This allows make's implict rules to take care of CFLAGS, LDFLAGS, CC, etc.
Use `set -e` in the install file rather than needing '|| exit 1' on every single operation.
Thanks! Will apply this too.
diff --git a/.gitignore b/.gitignore index 48f20c7..c601da6 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,4 @@ minilogd +minilogd.o +tags
tags? should this be here?
On Thu, Apr 21, 2011 at 2:50 PM, Tom Gundersen <teg@jklm.no> wrote:
On Thu, Apr 21, 2011 at 9:05 PM, Dan McGee <dan@archlinux.org> wrote:
Use a Makefile to compile, rather than a call to gcc in install.sh. This allows make's implict rules to take care of CFLAGS, LDFLAGS, CC, etc.
Use `set -e` in the install file rather than needing '|| exit 1' on every single operation.
Thanks! Will apply this too.
diff --git a/.gitignore b/.gitignore index 48f20c7..c601da6 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,4 @@ minilogd +minilogd.o +tags
tags? should this be here?
Forgot to mention it in the commit message, but for those of us that use 'ctags' religiously to get vim tag navigation, yes. That is the name of the generated file. Demo: ctags -R vim -t fsck_reboot -Dan
On Thu, Apr 21, 2011 at 9:53 PM, Dan McGee <dpmcgee@gmail.com> wrote:
Forgot to mention it in the commit message, but for those of us that use 'ctags' religiously to get vim tag navigation, yes. That is the name of the generated file.
Demo: ctags -R vim -t fsck_reboot
Cool, I did not know about that. Patch applied. -t
participants (3)
-
Dan McGee
-
Dan McGee
-
Tom Gundersen