initial commit
This commit is contained in:
44
mk/cc.mk
Normal file
44
mk/cc.mk
Normal file
@@ -0,0 +1,44 @@
|
||||
# Copyright (c) 2008-2015 The OpenRC Authors.
|
||||
# See the Authors file at the top-level directory of this distribution and
|
||||
# https://github.com/OpenRC/openrc/blob/master/AUTHORS
|
||||
#
|
||||
# This file is part of OpenRC. It is subject to the license terms in
|
||||
# the LICENSE file found in the top-level directory of this
|
||||
# distribution and at https://github.com/OpenRC/openrc/blob/master/LICENSE
|
||||
# This file may not be copied, modified, propagated, or distributed
|
||||
# except according to the terms contained in the LICENSE file.
|
||||
|
||||
# Setup some good default CFLAGS
|
||||
CFLAGS?= -O2 -g
|
||||
|
||||
# Default to using the C99 standard
|
||||
CSTD?= c99
|
||||
ifneq (${CSTD},)
|
||||
CFLAGS+= -std=${CSTD}
|
||||
endif
|
||||
|
||||
# Try and use some good cc flags if we're building from git
|
||||
# We don't use -pedantic as it will warn about our perfectly valid
|
||||
# use of %m in our logger.
|
||||
_CCFLAGS= -Wall -Wextra -Wimplicit -Wshadow -Wformat=2 \
|
||||
-Wmissing-prototypes -Wmissing-declarations \
|
||||
-Wmissing-noreturn -Wmissing-format-attribute \
|
||||
-Wnested-externs \
|
||||
-Winline -Wwrite-strings -Wcast-align -Wcast-qual \
|
||||
-Wpointer-arith \
|
||||
-Wdeclaration-after-statement -Wsequence-point \
|
||||
-Werror=implicit-function-declaration
|
||||
|
||||
# We should be using -Wredundant-decls, but our library hidden proto stuff
|
||||
# gives loads of warnings. I don't fully understand it (the hidden proto,
|
||||
# not the warning) so we just silence the warning.
|
||||
|
||||
_CC_FLAGS_SH= for f in ${_CCFLAGS}; do \
|
||||
if echo "int main(void) { return 0;} " | \
|
||||
${CC} $$f -S -xc -o /dev/null - ; \
|
||||
then printf "%s" "$$f "; fi \
|
||||
done;
|
||||
_CC_FLAGS:= $(shell ${_CC_FLAGS_SH})
|
||||
CFLAGS+= ${_CC_FLAGS}
|
||||
|
||||
include ${MK}/debug.mk
|
||||
23
mk/debug.mk
Normal file
23
mk/debug.mk
Normal file
@@ -0,0 +1,23 @@
|
||||
# rules to enable debugging support
|
||||
# Copyright (c) 2008-2015 The OpenRC Authors.
|
||||
# See the Authors file at the top-level directory of this distribution and
|
||||
# https://github.com/OpenRC/openrc/blob/master/AUTHORS
|
||||
#
|
||||
# This file is part of OpenRC. It is subject to the license terms in
|
||||
# the LICENSE file found in the top-level directory of this
|
||||
# distribution and at https://github.com/OpenRC/openrc/blob/master/LICENSE
|
||||
# This file may not be copied, modified, propagated, or distributed
|
||||
# except according to the terms contained in the LICENSE file.
|
||||
|
||||
_RC_DEBUG_SH= case "${DEBUG}" in "") echo "";; *) echo "-DRC_DEBUG";; esac
|
||||
_RC_DEBUG:= $(shell ${_RC_DEBUG_SH})
|
||||
CPPFLAGS+= ${_RC_DEBUG}
|
||||
|
||||
# Should we enable this with a different flag?
|
||||
_LD_DEBUG_SH= case "${DEBUG}" in "") echo "";; *) echo "-Wl,--rpath=../librc -Wl,--rpath=../libeinfo";; esac
|
||||
_LD_DEBUG:= $(shell ${_LD_DEBUG_SH})
|
||||
LDFLAGS+= ${_LD_DEBUG}
|
||||
|
||||
_GGDB_SH= case "${DEBUG}" in "") echo "";; *) echo "-ggdb";; esac
|
||||
_GGDB:= $(shell ${_GGDB_SH})
|
||||
CFLAGS+= ${_GGDB}
|
||||
21
mk/depend.mk
Normal file
21
mk/depend.mk
Normal file
@@ -0,0 +1,21 @@
|
||||
# Generate .depend
|
||||
# Copyright (c) 2008-2015 The OpenRC Authors.
|
||||
# See the Authors file at the top-level directory of this distribution and
|
||||
# https://github.com/OpenRC/openrc/blob/master/AUTHORS
|
||||
#
|
||||
# This file is part of OpenRC. It is subject to the license terms in
|
||||
# the LICENSE file found in the top-level directory of this
|
||||
# distribution and at https://github.com/OpenRC/openrc/blob/master/LICENSE
|
||||
# This file may not be copied, modified, propagated, or distributed
|
||||
# except according to the terms contained in the LICENSE file.
|
||||
|
||||
CLEANFILES+= .depend
|
||||
IGNOREFILES+= .depend
|
||||
|
||||
.depend: ${SRCS}
|
||||
rm -f .depend
|
||||
${CC} ${LOCAL_CPPFLAGS} ${CPPFLAGS} -MM ${SRCS} > .depend
|
||||
|
||||
depend: .depend extra_depend
|
||||
|
||||
-include .depend
|
||||
50
mk/dist.mk
Normal file
50
mk/dist.mk
Normal file
@@ -0,0 +1,50 @@
|
||||
# rules to make a distribution tarball from a git repo
|
||||
# Copyright (c) 2008-2015 The OpenRC Authors.
|
||||
# See the Authors file at the top-level directory of this distribution and
|
||||
# https://github.com/OpenRC/openrc/blob/master/AUTHORS
|
||||
#
|
||||
# This file is part of OpenRC. It is subject to the license terms in
|
||||
# the LICENSE file found in the top-level directory of this
|
||||
# distribution and at https://github.com/OpenRC/openrc/blob/master/LICENSE
|
||||
# This file may not be copied, modified, propagated, or distributed
|
||||
# except according to the terms contained in the LICENSE file.
|
||||
|
||||
GITREF?= ${VERSION}
|
||||
DISTPREFIX?= ${NAME}-${VERSION}
|
||||
DISTFILE?= ${DISTPREFIX}.tar.gz
|
||||
|
||||
CLEANFILES+= ${NAME}-*.tar.gz
|
||||
|
||||
CHANGELOG_LIMIT?= --after="1 year ago"
|
||||
|
||||
_SNAP_SH= date -u +%Y%m%d%H%M
|
||||
_SNAP:= $(shell ${_SNAP_SH})
|
||||
SNAP= ${_SNAP}
|
||||
SNAPDIR= ${DISTPREFIX}-${SNAP}
|
||||
SNAPFILE= ${SNAPDIR}.tar.gz
|
||||
|
||||
changelog:
|
||||
git log ${CHANGELOG_LIMIT} --format=full > ChangeLog
|
||||
|
||||
dist:
|
||||
git archive --prefix=${DISTPREFIX}/ ${GITREF} --output=${DISTFILE}
|
||||
|
||||
distcheck: dist
|
||||
rm -rf ${DISTPREFIX}
|
||||
tar xf ${DISTFILE}
|
||||
MAKEFLAGS= $(MAKE) -C ${DISTPREFIX}
|
||||
MAKEFLAGS= $(MAKE) -C ${DISTPREFIX} check
|
||||
rm -rf ${DISTPREFIX}
|
||||
|
||||
snapshot:
|
||||
rm -rf /tmp/${SNAPDIR}
|
||||
mkdir /tmp/${SNAPDIR}
|
||||
cp -RPp * /tmp/${SNAPDIR}
|
||||
(cd /tmp/${SNAPDIR}; make clean)
|
||||
rm -rf /tmp/${SNAPDIR}/.git 2>/dev/null || true
|
||||
tar -cvzpf ${SNAPFILE} -C /tmp ${SNAPDIR}
|
||||
rm -rf /tmp/${SNAPDIR}
|
||||
ls -l ${SNAPFILE}
|
||||
|
||||
snap: snapshot
|
||||
|
||||
22
mk/gitignore.mk
Normal file
22
mk/gitignore.mk
Normal file
@@ -0,0 +1,22 @@
|
||||
# rules to make .gitignore files
|
||||
# Copyright (c) 2008-2015 The OpenRC Authors.
|
||||
# See the Authors file at the top-level directory of this distribution and
|
||||
# https://github.com/OpenRC/openrc/blob/master/AUTHORS
|
||||
#
|
||||
# This file is part of OpenRC. It is subject to the license terms in
|
||||
# the LICENSE file found in the top-level directory of this
|
||||
# distribution and at https://github.com/OpenRC/openrc/blob/master/LICENSE
|
||||
# This file may not be copied, modified, propagated, or distributed
|
||||
# except according to the terms contained in the LICENSE file.
|
||||
|
||||
IGNOREFILES+= ${CLEANFILES}
|
||||
|
||||
.PHONY: .gitignore
|
||||
|
||||
.gitignore:
|
||||
@if test -n "${IGNOREFILES}"; then \
|
||||
echo "Ignoring ${IGNOREFILES}"; \
|
||||
echo ${IGNOREFILES} | tr ' ' '\n' > .gitignore; \
|
||||
fi
|
||||
|
||||
ignore: .gitignore
|
||||
8
mk/gitver.mk
Normal file
8
mk/gitver.mk
Normal file
@@ -0,0 +1,8 @@
|
||||
_GITVER_SH= if git rev-parse --short HEAD >/dev/null 2>&1; then \
|
||||
printf "."; \
|
||||
git rev-parse --short HEAD; \
|
||||
else \
|
||||
echo ""; \
|
||||
fi
|
||||
_GITVER:= $(shell ${_GITVER_SH})
|
||||
GITVER= ${_GITVER}
|
||||
78
mk/lib.mk
Normal file
78
mk/lib.mk
Normal file
@@ -0,0 +1,78 @@
|
||||
# rules to build a library
|
||||
# based on FreeBSD's bsd.lib.mk
|
||||
|
||||
# Copyright (c) 2008-2015 The OpenRC Authors.
|
||||
# See the Authors file at the top-level directory of this distribution and
|
||||
# https://github.com/OpenRC/openrc/blob/master/AUTHORS
|
||||
#
|
||||
# This file is part of OpenRC. It is subject to the license terms in
|
||||
# the LICENSE file found in the top-level directory of this
|
||||
# distribution and at https://github.com/OpenRC/openrc/blob/master/LICENSE
|
||||
# This file may not be copied, modified, propagated, or distributed
|
||||
# except according to the terms contained in the LICENSE file.
|
||||
|
||||
SHLIB_NAME= lib${LIB}.so.${SHLIB_MAJOR}
|
||||
SHLIB_LINK= lib${LIB}.so
|
||||
SONAME?= ${SHLIB_NAME}
|
||||
|
||||
SOBJS+= ${SRCS:.c=.So}
|
||||
|
||||
MKSTATICLIBS?= yes
|
||||
ifeq (${MKSTATICLIBS},yes)
|
||||
OBJS+= ${SRCS:.c=.o}
|
||||
_LIBS+= lib${LIB}.a
|
||||
endif
|
||||
|
||||
_LIBS+= ${SHLIB_NAME}
|
||||
|
||||
CLEANFILES+= ${OBJS} ${SOBJS} ${_LIBS} ${SHLIB_LINK}
|
||||
|
||||
%.o: %.c
|
||||
${CC} ${LOCAL_CFLAGS} ${LOCAL_CPPFLAGS} ${CFLAGS} ${CPPFLAGS} -c $< -o $@
|
||||
|
||||
%.So: %.c
|
||||
${CC} ${PICFLAG} -DPIC ${LOCAL_CFLAGS} ${LOCAL_CPPFLAGS} ${CPPFLAGS} ${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} ${LOCAL_CFLAGS} ${CFLAGS} ${LOCAL_LDFLAGS} ${LDFLAGS} -shared -Wl,-x \
|
||||
-o $@ -Wl,-soname,${SONAME} \
|
||||
${SOBJS} ${LDADD}
|
||||
|
||||
install: all
|
||||
ifeq (${MKSTATICLIBS},yes)
|
||||
${INSTALL} -d ${DESTDIR}${LIBDIR}
|
||||
${INSTALL} -m ${LIBMODE} lib${LIB}.a ${DESTDIR}${LIBDIR}
|
||||
endif
|
||||
${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
|
||||
|
||||
check test::
|
||||
|
||||
clean:
|
||||
rm -f ${OBJS} ${SOBJS} ${_LIBS} ${SHLIB_LINK} ${CLEANFILES}
|
||||
|
||||
extra_depend:
|
||||
@TMP=depend.$$$$; \
|
||||
${SED} -e 's/^\([^\.]*\).o[ ]*:/\1.o \1.So:/' .depend > $${TMP}; \
|
||||
mv $${TMP} .depend
|
||||
|
||||
include ${MK}/sys.mk
|
||||
include ${MK}/os.mk
|
||||
include ${MK}/depend.mk
|
||||
include ${MK}/gitignore.mk
|
||||
16
mk/os-BSD.mk
Normal file
16
mk/os-BSD.mk
Normal file
@@ -0,0 +1,16 @@
|
||||
# Copyright (c) 2008-2015 The OpenRC Authors.
|
||||
# See the Authors file at the top-level directory of this distribution and
|
||||
# https://github.com/OpenRC/openrc/blob/master/AUTHORS
|
||||
#
|
||||
# This file is part of OpenRC. It is subject to the license terms in
|
||||
# the LICENSE file found in the top-level directory of this
|
||||
# distribution and at https://github.com/OpenRC/openrc/blob/master/LICENSE
|
||||
# This file may not be copied, modified, propagated, or distributed
|
||||
# except according to the terms contained in the LICENSE file.
|
||||
|
||||
# Generic definitions
|
||||
|
||||
PKG_PREFIX?= /usr/local
|
||||
SFX= .BSD.in
|
||||
|
||||
LIBKVM?= -lkvm
|
||||
13
mk/os-DragonFly.mk
Normal file
13
mk/os-DragonFly.mk
Normal file
@@ -0,0 +1,13 @@
|
||||
# Copyright (c) 2013-2015 The OpenRC Authors.
|
||||
# See the Authors file at the top-level directory of this distribution and
|
||||
# https://github.com/OpenRC/openrc/blob/master/AUTHORS
|
||||
#
|
||||
# This file is part of OpenRC. It is subject to the license terms in
|
||||
# the LICENSE file found in the top-level directory of this
|
||||
# distribution and at https://github.com/OpenRC/openrc/blob/master/LICENSE
|
||||
# This file may not be copied, modified, propagated, or distributed
|
||||
# except according to the terms contained in the LICENSE file.
|
||||
|
||||
# Generic definitions
|
||||
|
||||
include ${MK}/os-BSD.mk
|
||||
13
mk/os-FreeBSD.mk
Normal file
13
mk/os-FreeBSD.mk
Normal file
@@ -0,0 +1,13 @@
|
||||
# Copyright (c) 2008-2015 The OpenRC Authors.
|
||||
# See the Authors file at the top-level directory of this distribution and
|
||||
# https://github.com/OpenRC/openrc/blob/master/AUTHORS
|
||||
#
|
||||
# This file is part of OpenRC. It is subject to the license terms in
|
||||
# the LICENSE file found in the top-level directory of this
|
||||
# distribution and at https://github.com/OpenRC/openrc/blob/master/LICENSE
|
||||
# This file may not be copied, modified, propagated, or distributed
|
||||
# except according to the terms contained in the LICENSE file.
|
||||
|
||||
# Generic definitions
|
||||
|
||||
include ${MK}/os-BSD.mk
|
||||
18
mk/os-GNU-kFreeBSD.mk
Normal file
18
mk/os-GNU-kFreeBSD.mk
Normal file
@@ -0,0 +1,18 @@
|
||||
# Copyright (c) 2013-2015 The OpenRC Authors.
|
||||
# See the Authors file at the top-level directory of this distribution and
|
||||
# https://github.com/OpenRC/openrc/blob/master/AUTHORS
|
||||
#
|
||||
# This file is part of OpenRC. It is subject to the license terms in
|
||||
# the LICENSE file found in the top-level directory of this
|
||||
# distribution and at https://github.com/OpenRC/openrc/blob/master/LICENSE
|
||||
# This file may not be copied, modified, propagated, or distributed
|
||||
# except according to the terms contained in the LICENSE file.
|
||||
|
||||
# Generic definitions
|
||||
|
||||
SFX= .GNU-kFreeBSD.in
|
||||
PKG_PREFIX?= /usr
|
||||
|
||||
CPPFLAGS+= -D_BSD_SOURCE -D_XOPEN_SOURCE=700
|
||||
LIBDL= -Wl,-Bdynamic -ldl
|
||||
LIBKVM?=
|
||||
15
mk/os-GNU.mk
Normal file
15
mk/os-GNU.mk
Normal file
@@ -0,0 +1,15 @@
|
||||
# Copyright (c) 2007-2015 The OpenRC Authors.
|
||||
# See the Authors file at the top-level directory of this distribution and
|
||||
# https://github.com/OpenRC/openrc/blob/master/AUTHORS
|
||||
#
|
||||
# This file is part of OpenRC. It is subject to the license terms in
|
||||
# the LICENSE file found in the top-level directory of this
|
||||
# distribution and at https://github.com/OpenRC/openrc/blob/master/LICENSE
|
||||
# This file may not be copied, modified, propagated, or distributed
|
||||
# except according to the terms contained in the LICENSE file.
|
||||
|
||||
SFX= .GNU.in
|
||||
PKG_PREFIX?= /usr
|
||||
|
||||
CPPFLAGS+= -D_DEFAULT_SOURCE -D_XOPEN_SOURCE=700 -DMAXPATHLEN=4096 -DPATH_MAX=4096
|
||||
LIBDL= -Wl,-Bdynamic -ldl
|
||||
34
mk/os-Linux.mk
Normal file
34
mk/os-Linux.mk
Normal file
@@ -0,0 +1,34 @@
|
||||
# Copyright (c) 2008-2015 The OpenRC Authors.
|
||||
# See the Authors file at the top-level directory of this distribution and
|
||||
# https://github.com/OpenRC/openrc/blob/master/AUTHORS
|
||||
#
|
||||
# This file is part of OpenRC. It is subject to the license terms in
|
||||
# the LICENSE file found in the top-level directory of this
|
||||
# distribution and at https://github.com/OpenRC/openrc/blob/master/LICENSE
|
||||
# This file may not be copied, modified, propagated, or distributed
|
||||
# except according to the terms contained in the LICENSE file.
|
||||
|
||||
SFX= .Linux.in
|
||||
PKG_PREFIX?= /usr
|
||||
|
||||
CPPFLAGS+= -D_DEFAULT_SOURCE -D_XOPEN_SOURCE=700
|
||||
LIBDL= -Wl,-Bdynamic -ldl
|
||||
|
||||
ifeq (${MKSELINUX},yes)
|
||||
CPPFLAGS+= -DHAVE_SELINUX
|
||||
LIBSELINUX?= -lselinux
|
||||
LDADD += $(LIBSELINUX)
|
||||
|
||||
ifneq (${MKPAM},pam)
|
||||
# if using selinux but not pam then we need crypt
|
||||
LIBCRYPT?= -lcrypt
|
||||
LDADD += $(LIBCRYPT)
|
||||
endif
|
||||
|
||||
endif
|
||||
|
||||
ifeq (${MKAUDIT},yes)
|
||||
LIBAUDIT?= -laudit
|
||||
CPPFLAGS+= -DHAVE_AUDIT
|
||||
LDADD+= ${LIBAUDIT}
|
||||
endif
|
||||
14
mk/os-NetBSD.mk
Normal file
14
mk/os-NetBSD.mk
Normal file
@@ -0,0 +1,14 @@
|
||||
# Copyright (c) 2008-2015 The OpenRC Authors.
|
||||
# See the Authors file at the top-level directory of this distribution and
|
||||
# https://github.com/OpenRC/openrc/blob/master/AUTHORS
|
||||
#
|
||||
# This file is part of OpenRC. It is subject to the license terms in
|
||||
# the LICENSE file found in the top-level directory of this
|
||||
# distribution and at https://github.com/OpenRC/openrc/blob/master/LICENSE
|
||||
# This file may not be copied, modified, propagated, or distributed
|
||||
# except according to the terms contained in the LICENSE file.
|
||||
|
||||
# Generic definitions
|
||||
|
||||
PKG_PREFIX?= /usr/pkg
|
||||
include ${MK}/os-BSD.mk
|
||||
8
mk/os-prefix.mk
Normal file
8
mk/os-prefix.mk
Normal file
@@ -0,0 +1,8 @@
|
||||
# Copyright (c) 2012 William Hubbs <w.d.hubbs@gmail.com>
|
||||
# Released under the 2-clause BSD license.
|
||||
|
||||
ifeq (${MKPREFIX},yes)
|
||||
CPPFLAGS+= -DPREFIX
|
||||
PKG_PREFIX?= $(PREFIX)/usr
|
||||
SED_EXTRA= -e '/_PATH=.*usr.bin/d'
|
||||
endif
|
||||
19
mk/os.mk
Normal file
19
mk/os.mk
Normal file
@@ -0,0 +1,19 @@
|
||||
# Copyright (c) 2008-2015 The OpenRC Authors.
|
||||
# See the Authors file at the top-level directory of this distribution and
|
||||
# https://github.com/OpenRC/openrc/blob/master/AUTHORS
|
||||
#
|
||||
# This file is part of OpenRC. It is subject to the license terms in
|
||||
# the LICENSE file found in the top-level directory of this
|
||||
# distribution and at https://github.com/OpenRC/openrc/blob/master/LICENSE
|
||||
# This file may not be copied, modified, propagated, or distributed
|
||||
# except according to the terms contained in the LICENSE file.
|
||||
|
||||
# Generic definitions
|
||||
|
||||
_OS_SH= uname -s | tr '/' '-'
|
||||
_OS:= $(shell ${_OS_SH})
|
||||
OS?= ${_OS}
|
||||
include ${MK}/os-prefix.mk
|
||||
include ${MK}/os-${OS}.mk
|
||||
|
||||
RC_LIB= /$(LIBNAME)/rc
|
||||
16
mk/pam.mk
Normal file
16
mk/pam.mk
Normal file
@@ -0,0 +1,16 @@
|
||||
ifeq (${MKPAM},pam)
|
||||
LIBPAM?= -lpam
|
||||
CPPFLAGS+= -DHAVE_PAM
|
||||
LDADD+= ${LIBPAM}
|
||||
|
||||
ifeq (${MKSELINUX},yes)
|
||||
# with selinux, pam_misc is needed too
|
||||
LIBPAM_MISC?= -lpam_misc
|
||||
LDADD+= ${LIBPAM_MISC}
|
||||
endif
|
||||
|
||||
PAMDIR?= /etc/pam.d
|
||||
PAMMODE?= 0644
|
||||
else ifneq (${MKPAM},)
|
||||
$(error if MKPAM is defined, it must be "pam")
|
||||
endif
|
||||
45
mk/prog.mk
Normal file
45
mk/prog.mk
Normal file
@@ -0,0 +1,45 @@
|
||||
# rules to build a program
|
||||
# based on FreeBSD's bsd.prog.mk
|
||||
|
||||
# Copyright (c) 2008-2015 The OpenRC Authors.
|
||||
# See the Authors file at the top-level directory of this distribution and
|
||||
# https://github.com/OpenRC/openrc/blob/master/AUTHORS
|
||||
#
|
||||
# This file is part of OpenRC. It is subject to the license terms in
|
||||
# the LICENSE file found in the top-level directory of this
|
||||
# distribution and at https://github.com/OpenRC/openrc/blob/master/LICENSE
|
||||
# This file may not be copied, modified, propagated, or distributed
|
||||
# except according to the terms contained in the LICENSE file.
|
||||
|
||||
OBJS+= ${SRCS:.c=.o}
|
||||
|
||||
# This is currently hardcoded for NetBSD which has two dynamic linkers
|
||||
# and we need to use the one in /libexec instead of /usr/libexec
|
||||
_DYNLINK_SH= if test "${PREFIX}" = "" && test -e /libexec/ld.elf_so; then \
|
||||
echo "-Wl,-dynamic-linker=/libexec/ld.elf_so"; \
|
||||
else \
|
||||
echo ""; \
|
||||
fi
|
||||
_DYNLINK:= $(shell ${_DYNLINK_SH})
|
||||
LDFLAGS+= ${_DYNLINK}
|
||||
LDFLAGS+= ${PROGLDFLAGS}
|
||||
|
||||
CLEANFILES+= ${OBJS} ${PROG}
|
||||
|
||||
all: depend ${PROG}
|
||||
|
||||
%.o: %.c
|
||||
${CC} ${LOCAL_CFLAGS} ${LOCAL_CPPFLAGS} ${CFLAGS} ${CPPFLAGS} -c $< -o $@
|
||||
|
||||
${PROG}: ${SCRIPTS} ${OBJS}
|
||||
${CC} ${LOCAL_CFLAGS} ${LOCAL_LDFLAGS} ${CFLAGS} ${LDFLAGS} -o $@ ${OBJS} ${LDADD}
|
||||
|
||||
clean:
|
||||
rm -f ${CLEANFILES}
|
||||
|
||||
extra_depend:
|
||||
|
||||
include ${MK}/sys.mk
|
||||
include ${MK}/os.mk
|
||||
include ${MK}/depend.mk
|
||||
include ${MK}/gitignore.mk
|
||||
65
mk/scripts.mk
Normal file
65
mk/scripts.mk
Normal file
@@ -0,0 +1,65 @@
|
||||
# Install rules for our scripts
|
||||
# Copyright (c) 2007-2015 The OpenRC Authors.
|
||||
# See the Authors file at the top-level directory of this distribution and
|
||||
# https://github.com/OpenRC/openrc/blob/master/AUTHORS
|
||||
#
|
||||
# This file is part of OpenRC. It is subject to the license terms in
|
||||
# the LICENSE file found in the top-level directory of this
|
||||
# distribution and at https://github.com/OpenRC/openrc/blob/master/LICENSE
|
||||
# This file may not be copied, modified, propagated, or distributed
|
||||
# except according to the terms contained in the LICENSE file.
|
||||
|
||||
include ${MK}/sys.mk
|
||||
include ${MK}/os.mk
|
||||
|
||||
OBJS+= ${SRCS:.in=}
|
||||
|
||||
_PKG_SED_SH= if test "${PREFIX}" = "${PKG_PREFIX}"; then echo "-e 's:@PKG_PREFIX@::g'"; else echo "-e 's:@PKG_PREFIX@:${PKG_PREFIX}:g'"; fi
|
||||
_PKG_SED:= $(shell ${_PKG_SED_SH})
|
||||
_LCL_SED_SH= if test "${PREFIX}" = "${LOCAL_PREFIX}"; then echo "-e 's:@LOCAL_PREFIX@::g'"; else echo "-e 's:@LOCAL_PREFIX@:${LOCAL_PREFIX}:g'"; fi
|
||||
_LCL_SED:= $(shell ${_LCL_SED_SH})
|
||||
|
||||
SED_REPLACE= -e 's:@SHELL@:${SH}:g' -e 's:@LIB@:${LIBNAME}:g' -e 's:@SYSCONFDIR@:${SYSCONFDIR}:g' -e 's:@LIBEXECDIR@:${LIBEXECDIR}:g' -e 's:@PREFIX@:${PREFIX}:g' -e 's:@BINDIR@:${BINDIR}:g' -e 's:@SBINDIR@:${SBINDIR}:g' ${_PKG_SED} ${_LCL_SED}
|
||||
|
||||
# Tweak our shell scripts
|
||||
%.sh: %.sh.in
|
||||
${SED} ${SED_REPLACE} ${SED_EXTRA} $< > $@
|
||||
|
||||
%: %.in
|
||||
${SED} ${SED_REPLACE} ${SED_EXTRA} $< > $@
|
||||
|
||||
all: ${OBJS} ${TARGETS}
|
||||
|
||||
realinstall: ${BIN} ${CONF} ${INC}
|
||||
@if test -n "${DIR}"; then \
|
||||
${ECHO} ${INSTALL} -d ${DESTDIR}/${DIR}; \
|
||||
${INSTALL} -d ${DESTDIR}/${DIR} || exit $$?; \
|
||||
fi
|
||||
@if test -n "${BIN}"; then \
|
||||
${ECHO} ${INSTALL} -m ${BINMODE} ${BIN} ${DESTDIR}/${DIR}; \
|
||||
${INSTALL} -m ${BINMODE} ${BIN} ${DESTDIR}/${DIR} || exit $$?; \
|
||||
fi
|
||||
@if test -n "${INC}"; then \
|
||||
${ECHO} ${INSTALL} -m ${INCMODE} ${INC} ${DESTDIR}/${DIR}; \
|
||||
${INSTALL} -m ${INCMODE} ${INC} ${DESTDIR}/${DIR} || exit $$?; \
|
||||
fi
|
||||
@for x in ${CONF}; do \
|
||||
if ! test -e ${DESTDIR}/${PREFIX}${DIR}/$$x; then \
|
||||
${ECHO} ${INSTALL} -m ${CONFMODE} $$x ${DESTDIR}/${DIR}; \
|
||||
${INSTALL} -m ${CONFMODE} $$x ${DESTDIR}/${DIR} || exit $$?; \
|
||||
fi; \
|
||||
done
|
||||
|
||||
install: all realinstall ${INSTALLAFTER}
|
||||
|
||||
check test::
|
||||
@if test -e runtests.sh ; then ./runtests.sh || exit $$? ; fi
|
||||
|
||||
# A lot of scripts don't have anything to clean
|
||||
# Also, some rm implentation require a file argument regardless of error
|
||||
# so we ensure that it has a bogus argument
|
||||
CLEANFILES+= ${OBJS}
|
||||
clean:
|
||||
@if test -n "${CLEANFILES}"; then echo "rm -f ${CLEANFILES}"; rm -f ${CLEANFILES}; fi
|
||||
|
||||
include ${MK}/gitignore.mk
|
||||
38
mk/subdir.mk
Normal file
38
mk/subdir.mk
Normal file
@@ -0,0 +1,38 @@
|
||||
# Recursive rules
|
||||
# Adapted from FreeBSDs bsd.subdir.mk
|
||||
# Copyright (c) 2007-2015 The OpenRC Authors.
|
||||
# See the Authors file at the top-level directory of this distribution and
|
||||
# https://github.com/OpenRC/openrc/blob/master/AUTHORS
|
||||
#
|
||||
# This file is part of OpenRC. It is subject to the license terms in
|
||||
# the LICENSE file found in the top-level directory of this
|
||||
# distribution and at https://github.com/OpenRC/openrc/blob/master/LICENSE
|
||||
# This file may not be copied, modified, propagated, or distributed
|
||||
# except according to the terms contained in the LICENSE file.
|
||||
|
||||
_+_ ?= +
|
||||
ECHODIR ?= echo
|
||||
_SUBDIR = @${_+_}for x in ${SUBDIR}; do \
|
||||
if test -d $$x; then \
|
||||
${ECHODIR} "===> ${DIRPRFX}$$x (${@:realinstall=install})"; \
|
||||
cd $$x; \
|
||||
${MAKE} ${@:realinstall=install} \
|
||||
DIRPRFX=${DIRPRFX}$$x/ || exit $$?; \
|
||||
cd ..; \
|
||||
fi; \
|
||||
done
|
||||
|
||||
all:
|
||||
${_SUBDIR}
|
||||
clean:
|
||||
@if test -n "${CLEANFILES}"; then echo "rm -f ${CLEANFILES}"; rm -f ${CLEANFILES}; fi
|
||||
${_SUBDIR}
|
||||
realinstall:
|
||||
${_SUBDIR}
|
||||
install: realinstall ${INSTALLAFTER}
|
||||
check test::
|
||||
${_SUBDIR}
|
||||
depend:
|
||||
${_SUBDIR}
|
||||
ignore:
|
||||
${_SUBDIR}
|
||||
67
mk/sys.mk
Normal file
67
mk/sys.mk
Normal file
@@ -0,0 +1,67 @@
|
||||
# Generic system definitions
|
||||
# Copyright (c) 2008-2015 The OpenRC Authors.
|
||||
# See the Authors file at the top-level directory of this distribution and
|
||||
# https://github.com/OpenRC/openrc/blob/master/AUTHORS
|
||||
#
|
||||
# This file is part of OpenRC. It is subject to the license terms in
|
||||
# the LICENSE file found in the top-level directory of this
|
||||
# distribution and at https://github.com/OpenRC/openrc/blob/master/LICENSE
|
||||
# This file may not be copied, modified, propagated, or distributed
|
||||
# except according to the terms contained in the LICENSE file.
|
||||
|
||||
AR?= ar
|
||||
CP?= cp
|
||||
PKG_CONFIG?= pkg-config
|
||||
ECHO?= echo
|
||||
INSTALL?= install
|
||||
RANLIB?= ranlib
|
||||
SED?= sed
|
||||
SH= /bin/sh
|
||||
|
||||
PREFIX?=
|
||||
ifeq (${PREFIX},)
|
||||
UPREFIX= /usr
|
||||
else
|
||||
UPREFIX= ${PREFIX}
|
||||
ifeq (${MKPREFIX},yes)
|
||||
UPREFIX= ${PREFIX}/usr
|
||||
endif
|
||||
endif
|
||||
LOCAL_PREFIX= $(UPREFIX)/local
|
||||
|
||||
PICFLAG?= -fPIC
|
||||
|
||||
SYSCONFDIR?= ${PREFIX}/etc
|
||||
INITDIR?= ${SYSCONFDIR}/init.d
|
||||
CONFDIR?= ${SYSCONFDIR}/conf.d
|
||||
SYSCTLDIR?= ${SYSCONFDIR}/sysctl.d
|
||||
|
||||
BINDIR?= ${PREFIX}/bin
|
||||
BINMODE?= 0755
|
||||
|
||||
SBINDIR?= ${PREFIX}/sbin
|
||||
SBINMODE?= 0755
|
||||
|
||||
INCDIR?= ${UPREFIX}/include
|
||||
INCMODE?= 0644
|
||||
|
||||
_LIBNAME_SH= case `readlink /lib` in /lib64|lib64) echo "lib64";; *) echo "lib";; esac
|
||||
_LIBNAME:= $(shell ${_LIBNAME_SH})
|
||||
LIBNAME?= ${_LIBNAME}
|
||||
LIBDIR?= ${UPREFIX}/${LIBNAME}
|
||||
LIBMODE?= 0644
|
||||
SHLIBDIR?= ${PREFIX}/${LIBNAME}
|
||||
|
||||
LIBEXECDIR?= ${PREFIX}/libexec/rc
|
||||
|
||||
MANPREFIX?= ${UPREFIX}/share
|
||||
MANDIR?= ${MANPREFIX}/man
|
||||
MANMODE?= 0644
|
||||
|
||||
DATADIR?= ${UPREFIX}/share/openrc
|
||||
DATAMODE?= 0644
|
||||
|
||||
DOCDIR?= ${UPREFIX}/share/doc
|
||||
DOCMODE?= 0644
|
||||
|
||||
CONFMODE?= 0644
|
||||
17
mk/termcap.mk
Normal file
17
mk/termcap.mk
Normal file
@@ -0,0 +1,17 @@
|
||||
ifeq (${MKTERMCAP},ncurses)
|
||||
TERMCAP_CFLAGS:= $(shell ${PKG_CONFIG} ncurses --cflags 2> /dev/null)
|
||||
LTERMCAP:= $(shell ${PKG_CONFIG} ncurses --libs 2> /dev/null)
|
||||
ifeq ($(LTERMCAP),)
|
||||
LIBTERMCAP?= -lncurses
|
||||
else
|
||||
LIBTERMCAP?= $(LTERMCAP)
|
||||
endif
|
||||
CPPFLAGS+= -DHAVE_TERMCAP ${TERMCAP_CFLAGS}
|
||||
LDADD+= ${LIBTERMCAP}
|
||||
else ifeq (${MKTERMCAP},termcap)
|
||||
LIBTERMCAP?= -ltermcap
|
||||
CPPFLAGS+= -DHAVE_TERMCAP
|
||||
LDADD+= ${LIBTERMCAP}
|
||||
else ifneq (${MKTERMCAP},)
|
||||
$(error If MKTERMCAP is defined, it must be ncurses or termcap)
|
||||
endif
|
||||
Reference in New Issue
Block a user