diff options
author | Roy Marples <roy@marples.name> | 2008-01-10 16:35:59 +0000 |
---|---|---|
committer | Roy Marples <roy@marples.name> | 2008-01-10 16:35:59 +0000 |
commit | 43147845209873b0776bd75d363913fe25611f49 (patch) | |
tree | ab3295c30664476d8d05b0fe5fe9ace702ade5ea /src | |
parent | 2643f2e605f102d2c2fa098d0cf5400d3795ed4a (diff) |
Allow for OS and SUBOS folders so we can introduce NetBSD scripts whilst keeping BSD for all BSD's.
Diffstat (limited to 'src')
-rw-r--r-- | src/.mk | 0 | ||||
-rw-r--r-- | src/Makefile | 4 | ||||
-rw-r--r-- | src/cc.mk | 27 | ||||
-rw-r--r-- | src/depend.mk | 11 | ||||
-rw-r--r-- | src/includes/hidden-visibility.h (renamed from src/hidden-visibility.h) | 0 | ||||
-rw-r--r-- | src/includes/rc-misc.h (renamed from src/rc-misc.h) | 0 | ||||
-rw-r--r-- | src/includes/strlist.h (renamed from src/strlist.h) | 0 | ||||
-rw-r--r-- | src/lib.mk | 65 | ||||
-rw-r--r-- | src/libeinfo/Makefile | 16 | ||||
-rw-r--r-- | src/librc/Makefile | 10 | ||||
-rw-r--r-- | src/ncurses.mk | 3 | ||||
-rw-r--r-- | src/os.mk | 24 | ||||
-rw-r--r-- | src/pam.mk | 6 | ||||
-rw-r--r-- | src/prog.mk | 19 | ||||
-rw-r--r-- | src/rc/Makefile | 21 | ||||
-rw-r--r-- | src/termcap.mk | 3 |
16 files changed, 25 insertions, 184 deletions
diff --git a/src/.mk b/src/.mk deleted file mode 100644 index e69de29b..00000000 --- a/src/.mk +++ /dev/null diff --git a/src/Makefile b/src/Makefile index 19922620..36a3b8e1 100644 --- a/src/Makefile +++ b/src/Makefile @@ -2,5 +2,5 @@ SUBDIR= libeinfo librc rc -TOPDIR= .. -include ${TOPDIR}/subdir.mk +MK= ../mk +include ${MK}/subdir.mk diff --git a/src/cc.mk b/src/cc.mk deleted file mode 100644 index 18eae7ee..00000000 --- a/src/cc.mk +++ /dev/null @@ -1,27 +0,0 @@ -# Copyright 2008 Roy Marples <roy@marples.name> - -# Setup some good default CFLAGS - -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) - -# 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; \ - then echo -n "$$x "; fi \ - done - -# Loads of nice flags to ensure our code is good -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 deleted file mode 100644 index a4d717ae..00000000 --- a/src/depend.mk +++ /dev/null @@ -1,11 +0,0 @@ -# This only works for make implementations that always include a .depend if -# it exists. Only GNU make does not do this. - -# Copyright 2008 Roy Marples <roy@marples.name> - -CLEANFILES+= .depend - -.depend: ${SRCS} - ${CC} ${CFLAGS} -MM ${SRCS} > .depend - -depend: .depend diff --git a/src/hidden-visibility.h b/src/includes/hidden-visibility.h index bc7e338a..bc7e338a 100644 --- a/src/hidden-visibility.h +++ b/src/includes/hidden-visibility.h diff --git a/src/rc-misc.h b/src/includes/rc-misc.h index b7208e67..b7208e67 100644 --- a/src/rc-misc.h +++ b/src/includes/rc-misc.h diff --git a/src/strlist.h b/src/includes/strlist.h index 3abe44ff..3abe44ff 100644 --- a/src/strlist.h +++ b/src/includes/strlist.h diff --git a/src/lib.mk b/src/lib.mk deleted file mode 100644 index e7759173..00000000 --- a/src/lib.mk +++ /dev/null @@ -1,65 +0,0 @@ -# rules to build a library -# based on FreeBSD's bsd.lib.mk - -# Copyright 2008 Roy Marples - -LIBNAME?= lib - -SHLIB_NAME= lib${LIB}.so.${SHLIB_MAJOR} -SHLIB_LINK= lib${LIB}.so -SHLIBDIR?= /${LIBNAME} -SONAME?= ${SHLIB_NAME} - -OBJS+= ${SRCS:.c=.o} -SOBJS+= ${OBJS:.o=.So} -_LIBS= lib${LIB}.a ${SHLIB_NAME} - -ECHO?= echo -AR?= ar -RANLIB?= ranlib -INSTALL?= install - -PICFLAG?= -fPIC - -INCDIR?= /usr/include -INCMODE?= 0444 - -LIBDIR?= /usr/${LIBNAME} -LIBMODE?= 0444 - -.SUFFIXES: .So - -.c.So: - ${CC} ${PICFLAG} -DPIC ${CFLAGS} -c $< -o $@ - -all: depend ${_LIBS} - -lib${LIB}.a: ${OBJS} ${STATICOBJS} - @${ECHO} building static library $@ - ${AR} rc $@ $^ - ${RANLIB} $@ - -${SHLIB_NAME}: ${VERSION_MAP} -LDFLAGS+= -Wl,--version-script=${VERSION_MAP} - -${SHLIB_NAME}: ${SOBJS} - @${ECHO} building shared library $@ - @rm -f $@ ${SHLIB_LINK} - @ln -fs $@ ${SHLIB_LINK} - ${CC} ${LDFLAGS} -shared -Wl,-x \ - -o $@ -Wl,-soname,${SONAME} \ - ${SOBJS} ${LDADD} - -install: all - ${INSTALL} -d ${DESTDIR}${LIBDIR} - ${INSTALL} -m ${LIBMODE} lib${LIB}.a ${DESTDIR}${LIBDIR} - ${INSTALL} -d ${DESTDIR}${SHLIBDIR} - ${INSTALL} -m ${LIBMODE} ${SHLIB_NAME} ${DESTDIR}${SHLIBDIR} - ln -fs ${SHLIB_NAME} ${DESTDIR}${SHLIBDIR}/${SHLIB_LINK} - ${INSTALL} -d ${DESTDIR}${INCDIR} - for x in ${INCS}; do ${INSTALL} -m ${INCMODE} $$x ${DESTDIR}${INCDIR}; done - -clean: - rm -f ${OBJS} ${SOBJS} ${_LIBS} ${SHLIB_LINK} ${CLEANFILES} - -include ${TOPDIR}/depend.mk diff --git a/src/libeinfo/Makefile b/src/libeinfo/Makefile index da12ef78..7ef84abb 100644 --- a/src/libeinfo/Makefile +++ b/src/libeinfo/Makefile @@ -1,16 +1,16 @@ -TOPDIR= .. -include ${TOPDIR}/os.mk +MK= ../../mk +include ${MK}/os.mk LIB= einfo -SHLIB_MAJOR= 1 +SHLIB_MAJOR= 1 SRCS= libeinfo.c INCS= einfo.h -VERSION_MAP= einfo.map +VERSION_MAP= einfo.map SHLIBDIR= /${LIBNAME} -CFLAGS+= -I${TOPDIR} +CFLAGS+= -I../includes -include ${TOPDIR}/cc.mk -include ${TOPDIR}/lib.mk -include ${TOPDIR}/${TERMCAP}.mk +include ${MK}/cc.mk +include ${MK}/lib.mk +include ${MK}/${TERMCAP}.mk diff --git a/src/librc/Makefile b/src/librc/Makefile index 095988b8..888155b8 100644 --- a/src/librc/Makefile +++ b/src/librc/Makefile @@ -1,5 +1,5 @@ -TOPDIR= .. -include ${TOPDIR}/os.mk +MK= ../../mk +include ${MK}/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../includes SHLIBDIR= /${LIBNAME} -include ${TOPDIR}/cc.mk -include ${TOPDIR}/lib.mk +include ${MK}/cc.mk +include ${MK}/lib.mk diff --git a/src/ncurses.mk b/src/ncurses.mk deleted file mode 100644 index 66573d61..00000000 --- a/src/ncurses.mk +++ /dev/null @@ -1,3 +0,0 @@ -LIBTERMCAP?= -lncurses -CFLAGS+= -DHAVE_TERMCAP -LDADD+= ${LIBTERMCAP} diff --git a/src/os.mk b/src/os.mk deleted file mode 100644 index a4bef109..00000000 --- a/src/os.mk +++ /dev/null @@ -1,24 +0,0 @@ -# Copyright 2008 Roy Marples - -# 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}) - -_LIBNAME_SH= l=`readlink /lib`; case "$$l" in /lib64|lib64) echo "lib64";; *) echo "lib";; esac -_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}) - -_LIBDL_SH= case `uname -s` in Linux) echo "-Wl,-Bdynamic -ldl";; *) echo;; esac -_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}) diff --git a/src/pam.mk b/src/pam.mk deleted file mode 100644 index 7d0f2ca0..00000000 --- a/src/pam.mk +++ /dev/null @@ -1,6 +0,0 @@ -LIBPAM?= -lpam -CFLAGS+= -DHAVE_PAM -LDADD+= ${LIBPAM} - -PAMDIR?= /etc/pam.d -PAMMODE?= 0644 diff --git a/src/prog.mk b/src/prog.mk deleted file mode 100644 index 5da7e75f..00000000 --- a/src/prog.mk +++ /dev/null @@ -1,19 +0,0 @@ -# rules to build a library -# based on FreeBSD's bsd.prog.mk - -# Copyright 2008 Roy Marples - -BINDIR?= /sbin -OBJS+= ${SRCS:.c=.o} - -INSTALL?= install - -all: depend ${PROG} - -${PROG}: ${SCRIPTS} ${OBJS} - ${CC} ${CFLAGS} ${LDFLAGS} ${PROGLDFLAGS} -o $@ ${OBJS} ${LDADD} - -clean: - rm -f ${OBJS} ${PROG} ${CLEANFILES} - -include ${TOPDIR}/depend.mk diff --git a/src/rc/Makefile b/src/rc/Makefile index b6ae45a2..e804ec98 100644 --- a/src/rc/Makefile +++ b/src/rc/Makefile @@ -5,11 +5,9 @@ SRCS= checkpath.c fstabinfo.c mountinfo.c rc.c rc-depend.c \ CLEANFILES= version.h -TOPDIR= .. - -LDFLAGS+= -L${TOPDIR}/librc -L${TOPDIR}/libeinfo +LDFLAGS+= -L../librc -L../libeinfo LDADD+= -lutil -lrc -leinfo -CFLAGS+= -I${TOPDIR} -I${TOPDIR}/librc -I${TOPDIR}/libeinfo +CFLAGS+= -I../includes -I../librc -I../libeinfo BINDIR?= /sbin @@ -32,18 +30,19 @@ RC_SBINLINKS= mark_service_starting mark_service_started \ mark_service_coldplugged mark_service_failed \ rc-abort -include ${TOPDIR}/os.mk +MK= ../../mk +include ${MK}/os.mk CFLAGS+= -DLIB=\"${LIBNAME}\" -include ${TOPDIR}/cc.mk -include ${TOPDIR}/prog.mk +include ${MK}/cc.mk +include ${MK}/prog.mk -include ${TOPDIR}/${TERMCAP}.mk +include ${MK}/${TERMCAP}.mk LDADD+= ${LIBDL} ${LIBKVM} -include ${TOPDIR}/${PAM}.mk +include ${MK}/${PAM}.mk ${SRCS}: version.h version.h: - sed -n -e 's/^VERSION =[[:space:]]*\([^[:space:]]*\).*/#define VERSION "\1\"/p' ../../Makefile > version.h + sed -n -e 's/^VERSION=[[:space:]]*\([^[:space:]]*\).*/#define VERSION "\1\"/p' ../../Makefile > version.h if test -n "${BRANDING}"; then \ echo "#define BRANDING \"${BRANDING}\"" >> version.h; \ fi @@ -54,7 +53,7 @@ install: all ${INSTALL} -d ${DESTDIR}/bin 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 + for x in ${SBINLINKS}; do ln -fs ${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 diff --git a/src/termcap.mk b/src/termcap.mk deleted file mode 100644 index 62a251ac..00000000 --- a/src/termcap.mk +++ /dev/null @@ -1,3 +0,0 @@ -LIBTERMCAP?= -ltermcap -CFLAGS+= -DHAVE_TERMCAP -LDADD+= ${LIBTERMCAP} |