aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoy Marples <roy@marples.name>2008-01-09 11:44:43 +0000
committerRoy Marples <roy@marples.name>2008-01-09 11:44:43 +0000
commit06634f6309f07613cd6a086a6b383daad65192c0 (patch)
tree11a18fa3c66ef97ad59806b667c798e55ec4ac8d
parent666be0faa0f94a7337662d6c00e3c0d78dd58df4 (diff)
Style updates.
-rw-r--r--src/Makefile2
-rw-r--r--src/cc.mk29
-rw-r--r--src/depend.mk11
-rw-r--r--src/lib.mk6
-rw-r--r--src/libeinfo/Makefile10
-rw-r--r--src/librc/Makefile8
-rw-r--r--src/os.mk20
-rw-r--r--src/prog.mk4
-rw-r--r--src/rc/Makefile36
9 files changed, 64 insertions, 62 deletions
diff --git a/src/Makefile b/src/Makefile
index f843a812..19922620 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -3,4 +3,4 @@
SUBDIR= libeinfo librc rc
TOPDIR= ..
-include $(TOPDIR)/subdir.mk
+include ${TOPDIR}/subdir.mk
diff --git a/src/cc.mk b/src/cc.mk
index 8b65627c..18eae7ee 100644
--- a/src/cc.mk
+++ b/src/cc.mk
@@ -1,26 +1,27 @@
-# Copyright 2008 Roy Marples
+# Copyright 2008 Roy Marples <roy@marples.name>
# Setup some good default CFLAGS
-CFLAGS ?= -O2 -pipe
+CFLAGS?= -O2 -pipe
+CSTD?= c99
# GNU Make way of detecting gcc flags we can use
-check_gcc=$(shell if $(CC) $(1) -S -o /dev/null -xc /dev/null >/dev/null 2>&1; \
- then echo "$(1)"; else echo "$(2)"; fi)
+check_gcc=$(shell if ${CC} $(1) -S -o /dev/null -xc /dev/null >/dev/null 2>&1; \
+ then echo "$(1)"; else echo "$(2)"; fi)
# pmake check for extra cflags
-WEXTRA != for x in -Wdeclaration-after-statement -Wsequence-point -Wextra; do \
- if $(CC) $$x -S -o /dev/null -xc /dev/null >/dev/null 2>&1; \
+WEXTRA!= for x in -Wdeclaration-after-statement -Wsequence-point -Wextra; do \
+ if ${CC} $$x -S -o /dev/null -xc /dev/null >/dev/null 2>&1; \
then echo -n "$$x "; fi \
done
# Loads of nice flags to ensure our code is good
-CFLAGS += -pedantic -std=c99 \
- -Wall -Wunused -Wimplicit -Wshadow -Wformat=2 \
- -Wmissing-declarations -Wno-missing-prototypes -Wwrite-strings \
- -Wbad-function-cast -Wnested-externs -Wcomment -Winline \
- -Wchar-subscripts -Wcast-align -Wno-format-nonliteral \
- $(call check_gcc, -Wdeclaration-after-statement) \
- $(call check_gcc, -Wsequence-point) \
- $(call check_gcc, -Wextra) $(WEXTRA)
+CFLAGS+= -pedantic -std=${CSTD} \
+ -Wall -Wunused -Wimplicit -Wshadow -Wformat=2 \
+ -Wmissing-declarations -Wno-missing-prototypes -Wwrite-strings \
+ -Wbad-function-cast -Wnested-externs -Wcomment -Winline \
+ -Wchar-subscripts -Wcast-align -Wno-format-nonliteral \
+ $(call check_gcc, -Wdeclaration-after-statement) \
+ $(call check_gcc, -Wsequence-point) \
+ $(call check_gcc, -Wextra) ${WEXTRA}
diff --git a/src/depend.mk b/src/depend.mk
index 5b2da6d2..a4d717ae 100644
--- a/src/depend.mk
+++ b/src/depend.mk
@@ -1,10 +1,11 @@
# This only works for make implementations that always include a .depend if
# it exists. Only GNU make does not do this.
-.depend: ${SCRIPTS} ${SRCS}
- $(CC) $(CFLAGS) -MM ${SRCS} > .depend
+# Copyright 2008 Roy Marples <roy@marples.name>
-depend: .depend
+CLEANFILES+= .depend
+
+.depend: ${SRCS}
+ ${CC} ${CFLAGS} -MM ${SRCS} > .depend
-clean-depend:
- rm -f .depend
+depend: .depend
diff --git a/src/lib.mk b/src/lib.mk
index c1b4558c..39a9454c 100644
--- a/src/lib.mk
+++ b/src/lib.mk
@@ -59,7 +59,7 @@ install: all
${INSTALL} -d ${DESTDIR}${INCDIR}
for x in ${INCS}; do ${INSTALL} -m ${INCMODE} $$x ${DESTDIR}${INCDIR}; done
-clean: clean-depend
- rm -f ${OBJS} ${SOBJS} ${_LIBS} ${SHLIB_LINK}
+clean:
+ rm -f ${OBJS} ${SOBJS} ${_LIBS} ${SHLIB_LINK} ${CLEANFILES}
-include $(TOPDIR)/depend.mk
+include ${TOPDIR}/depend.mk
diff --git a/src/libeinfo/Makefile b/src/libeinfo/Makefile
index de96f7f7..da12ef78 100644
--- a/src/libeinfo/Makefile
+++ b/src/libeinfo/Makefile
@@ -1,5 +1,5 @@
TOPDIR= ..
-include $(TOPDIR)/os.mk
+include ${TOPDIR}/os.mk
LIB= einfo
SHLIB_MAJOR= 1
@@ -9,8 +9,8 @@ VERSION_MAP= einfo.map
SHLIBDIR= /${LIBNAME}
-CFLAGS+= -I$(TOPDIR)
+CFLAGS+= -I${TOPDIR}
-include $(TOPDIR)/cc.mk
-include $(TOPDIR)/lib.mk
-include $(TOPDIR)/$(TERMCAP).mk
+include ${TOPDIR}/cc.mk
+include ${TOPDIR}/lib.mk
+include ${TOPDIR}/${TERMCAP}.mk
diff --git a/src/librc/Makefile b/src/librc/Makefile
index 741545e1..095988b8 100644
--- a/src/librc/Makefile
+++ b/src/librc/Makefile
@@ -1,5 +1,5 @@
TOPDIR= ..
-include $(TOPDIR)/os.mk
+include ${TOPDIR}/os.mk
LIB= rc
SHLIB_MAJOR= 1
@@ -11,9 +11,9 @@ VERSION_MAP= rc.map
CFLAGS+= -DLIB=\"${LIBNAME}\"
LDADD+= ${LIBKVM}
-CFLAGS+= -I$(TOPDIR)
+CFLAGS+= -I${TOPDIR}
SHLIBDIR= /${LIBNAME}
-include $(TOPDIR)/cc.mk
-include $(TOPDIR)/lib.mk
+include ${TOPDIR}/cc.mk
+include ${TOPDIR}/lib.mk
diff --git a/src/os.mk b/src/os.mk
index 9bfddb0c..a4bef109 100644
--- a/src/os.mk
+++ b/src/os.mk
@@ -3,22 +3,22 @@
# Generic definitions
_OS_SH= u=`uname -s`; case "$${u}" in *BSD|DragonFly) echo "BSD";; *) echo "$${u}";; esac
-_OS!= $(_OS_SH)
-OS?= $(_OS)$(shell $(_OS_SH))
+_OS!= ${_OS_SH}
+OS?= ${_OS}$(shell ${_OS_SH})
_LIBNAME_SH= l=`readlink /lib`; case "$$l" in /lib64|lib64) echo "lib64";; *) echo "lib";; esac
-_LIBNAME!= $(_LIBNAME_SH)
-LIBNAME?= $(_LIBNAME)$(shell $(_LIBNAME_SH))
+_LIBNAME!= ${_LIBNAME_SH}
+LIBNAME?= ${_LIBNAME}$(shell ${_LIBNAME_SH})
RC_LIB= /$(LIB)/rc
_DEF_SH= case `uname -s` in Linux) echo "-D_XOPEN_SOURCE=600 -D_BSD_SOURCE";; *) echo;; esac
-_DEF!= $(_DEF_SH)
-CFLAGS+= $(_DEF)$(shell $(_DEF_SH))
+_DEF!= ${_DEF_SH}
+CFLAGS+= ${_DEF}$(shell ${_DEF_SH})
_LIBDL_SH= case `uname -s` in Linux) echo "-Wl,-Bdynamic -ldl";; *) echo;; esac
-_LIBDL!= $(_LIBDL_SH)
-LIBDL?= $(_LIBDL)$(shell $(_LIBDL_SH))
+_LIBDL!= ${_LIBDL_SH}
+LIBDL?= ${_LIBDL}$(shell ${_LIBDL_SH})
_LIBKVM_SH= case `uname -s` in *BSD) echo "-lkvm";; *) echo;; esac
-_LIBKVM!= $(_LIBKVM_SH)
-LIBKVM?= $(_LIBKVM)$(shell $(_LIBKVM_SH))
+_LIBKVM!= ${_LIBKVM_SH}
+LIBKVM?= ${_LIBKVM}$(shell ${_LIBKVM_SH})
diff --git a/src/prog.mk b/src/prog.mk
index 9a222e7d..5da7e75f 100644
--- a/src/prog.mk
+++ b/src/prog.mk
@@ -13,7 +13,7 @@ all: depend ${PROG}
${PROG}: ${SCRIPTS} ${OBJS}
${CC} ${CFLAGS} ${LDFLAGS} ${PROGLDFLAGS} -o $@ ${OBJS} ${LDADD}
-clean: clean-depend
+clean:
rm -f ${OBJS} ${PROG} ${CLEANFILES}
-include $(TOPDIR)/depend.mk
+include ${TOPDIR}/depend.mk
diff --git a/src/rc/Makefile b/src/rc/Makefile
index 2f1c4ca4..b6ae45a2 100644
--- a/src/rc/Makefile
+++ b/src/rc/Makefile
@@ -3,18 +3,17 @@ SRCS= checkpath.c fstabinfo.c mountinfo.c rc.c rc-depend.c \
rc-logger.c rc-misc.c rc-plugin.c rc-status.c rc-update.c \
runscript.c start-stop-daemon.c
-SCRIPTS= version.h
CLEANFILES= version.h
TOPDIR= ..
-LDFLAGS+= -L$(TOPDIR)/librc -L$(TOPDIR)/libeinfo
+LDFLAGS+= -L${TOPDIR}/librc -L${TOPDIR}/libeinfo
LDADD+= -lutil -lrc -leinfo
-CFLAGS+= -I$(TOPDIR) -I$(TOPDIR)/librc -I$(TOPDIR)/libeinfo
+CFLAGS+= -I${TOPDIR} -I${TOPDIR}/librc -I${TOPDIR}/libeinfo
BINDIR?= /sbin
-LINKDIR= $(LIBNAME)/$(PROG)
+LINKDIR= ${LIBNAME}/${PROG}
BINLINKS= rc-status
SBINLINKS= rc-update runscript start-stop-daemon
RC_BINLINKS= einfon einfo ewarnn ewarn eerrorn eerror ebegin eend ewend \
@@ -33,15 +32,16 @@ RC_SBINLINKS= mark_service_starting mark_service_started \
mark_service_coldplugged mark_service_failed \
rc-abort
-include $(TOPDIR)/os.mk
-CFLAGS+= -DLIB=\"$(LIBNAME)\"
-include $(TOPDIR)/cc.mk
-include $(TOPDIR)/prog.mk
+include ${TOPDIR}/os.mk
+CFLAGS+= -DLIB=\"${LIBNAME}\"
+include ${TOPDIR}/cc.mk
+include ${TOPDIR}/prog.mk
-include $(TOPDIR)/$(TERMCAP).mk
+include ${TOPDIR}/${TERMCAP}.mk
LDADD+= ${LIBDL} ${LIBKVM}
-include $(TOPDIR)/$(PAM).mk
+include ${TOPDIR}/${PAM}.mk
+${SRCS}: version.h
version.h:
sed -n -e 's/^VERSION =[[:space:]]*\([^[:space:]]*\).*/#define VERSION "\1\"/p' ../../Makefile > version.h
if test -n "${BRANDING}"; then \
@@ -52,14 +52,14 @@ install: all
${INSTALL} -d ${DESTDIR}${BINDIR}
${INSTALL} ${PROG} ${DESTDIR}${BINDIR}
${INSTALL} -d ${DESTDIR}/bin
- for x in $(BINLINKS); do ln -fs ${BINDIR}/${PROG} $(DESTDIR)/bin/$$x; done
+ for x in ${BINLINKS}; do ln -fs ${BINDIR}/${PROG} ${DESTDIR}/bin/$$x; done
${INSTALL} -d ${DESTDIR}/bin
- for x in $(SBINLINKS); do ln -fs ${BINDIR}/${PROG} $(DESTDIR)${BINDIR}/$$x; done
- $(INSTALL) -d $(DESTDIR)/$(LIBNAME)/$(PROG)/bin
- for x in $(RC_BINLINKS); do ln -fs ${BINDIR}/${PROG} $(DESTDIR)/$(LIBNAME)/$(PROG)/bin/$$x; done
- $(INSTALL) -d $(DESTDIR)/$(LIBNAME)/$(PROG)/sbin
- for x in $(RC_SBINLINKS); do ln -fs ${BINDIR}/${PROG} $(DESTDIR)/$(LIBNAME)/$(PROG)/sbin/$$x; done
- if test "$(PAM)" = pam; then \
+ for x in ${SBINLINKS}; do ln -fs ${BINDIR}/${PROG} ${DESTDIR}${BINDIR}/$$x; done
+ ${INSTALL} -d ${DESTDIR}/${LIBNAME}/${PROG}/bin
+ for x in $(RC_BINLINKS); do ln -fs ${BINDIR}/${PROG} $(DESTDIR)/${LIBNAME}/${PROG}/bin/$$x; done
+ ${INSTALL} -d ${DESTDIR}/${LIBNAME}/${PROG}/sbin
+ for x in ${RC_SBINLINKS}; do ln -fs ${BINDIR}/${PROG} ${DESTDIR}/${LIBNAME}/${PROG}/sbin/$$x; done
+ if test "${PAM}" = pam; then \
${INSTALL} -d ${DESTDIR}${PAMDIR}; \
- ${INSTALL} -m ${PAMMODE} start-stop-daemon.pam $(DESTDIR)${PAMDIR}/start-stop-daemon; \
+ ${INSTALL} -m ${PAMMODE} start-stop-daemon.pam ${DESTDIR}${PAMDIR}/start-stop-daemon; \
fi