Style updates.
This commit is contained in:
parent
666be0faa0
commit
06634f6309
@ -3,4 +3,4 @@
|
||||
SUBDIR= libeinfo librc rc
|
||||
|
||||
TOPDIR= ..
|
||||
include $(TOPDIR)/subdir.mk
|
||||
include ${TOPDIR}/subdir.mk
|
||||
|
29
src/cc.mk
29
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}
|
||||
|
||||
|
@ -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>
|
||||
|
||||
CLEANFILES+= .depend
|
||||
|
||||
.depend: ${SRCS}
|
||||
${CC} ${CFLAGS} -MM ${SRCS} > .depend
|
||||
|
||||
depend: .depend
|
||||
|
||||
clean-depend:
|
||||
rm -f .depend
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
20
src/os.mk
20
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})
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user