aboutsummaryrefslogtreecommitdiff
path: root/Makefile
blob: 28fca01436417d7543ada4aeff6d1e053bda9c0c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
# Open Run Control Makefile
# Copyright 2006-2007 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2

NAME = openrc
VERSION = 1.0pre1
PKG = $(NAME)-$(VERSION)

SUBDIRS = conf.d init.d man net sh src

ifeq ($(OS),)
OS=$(shell uname -s)
ifneq ($(OS),Linux)
OS=BSD
endif
endif

NET_LO = net.lo0
ifeq ($(OS),Linux)
	NET_LO = net.lo
endif

TOPDIR = .
include $(TOPDIR)/default.mk

install::
	# Don't install runlevels if they already exist
	if ! test -d $(DESTDIR)/etc/runlevels ; then \
		(cd runlevels; $(MAKE) install) ; \
		test -d runlevels.$(OS) && (cd runlevels.$(OS); $(MAKE) install) ; \
		$(INSTALL_DIR) $(DESTDIR)/etc/runlevels/single || exit $$? ; \
		$(INSTALL_DIR) $(DESTDIR)/etc/runlevels/nonetwork || exit $$? ; \
	fi
	ln -snf ../../$(RC_LIB)/sh/net.sh $(DESTDIR)/etc/init.d/$(NET_LO) || exit $$?
	ln -snf ../../$(RC_LIB)/sh/functions.sh $(DESTDIR)/etc/init.d || exit $$?
	# Handle lib correctly
	if test $(LIB) != "lib" ; then \
		sed -i'.bak' -e 's,/lib/,/$(LIB)/,g' $(DESTDIR)/$(RC_LIB)/sh/functions.sh || exit $$? ; \
		rm -f $(DESTDIR)/$(RC_LIB)/sh/functions.sh.bak ; \
		sed -i'.bak' -e 's,/lib/,/$(LIB)/,g' $(DESTDIR)/$(RC_LIB)/sh/rc-functions.sh || exit $$? ; \
		rm -f $(DESTDIR)/$(RC_LIB)/sh/rc-functions.sh.bak ; \
	fi

diststatus:
	if test -d .svn ; then \
		svnfiles=`svn status 2>&1 | egrep -v '^(U|P)'` ; \
		if test "x$$svnfiles" != "x" ; then \
			echo "Refusing to package tarball until svn is in sync:" ; \
			echo "$$svnfiles" ; \
			echo "make distforce to force packaging" ; \
			exit 1 ; \
		fi \
	fi 

distit:
	rm -rf /tmp/$(PKG)
	svn export . /tmp/$(PKG)
	$(MAKE) -C /tmp/$(PKG) clean
	tar -C /tmp -cvjpf /tmp/$(PKG).tar.bz2 $(PKG)
	rm -rf /tmp/$(PKG)
	ls -l /tmp/$(PKG).tar.bz2

dist: diststatus distit

.PHONY: layout dist distit diststatus

# vim: set ts=4 :