/[baselayout]/trunk/Makefile
Gentoo

Contents of /trunk/Makefile

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2576 - (hide annotations) (download)
Wed Apr 11 10:47:35 2007 UTC (7 years, 6 months ago) by uberlord
File size: 3247 byte(s)
Correct version
1 uberlord 2547 # baselayout Makefile
2     # Copyright 2006-2007 Gentoo Foundation
3     # Distributed under the terms of the GNU General Public License v2
4     #
5     # We've moved the installation logic from Gentoo ebuild into a generic
6     # Makefile so that the ebuild is much smaller and more simple.
7     # It also has the added bonus of being easier to install on systems
8     # without an ebuild style package manager.
9    
10     SUBDIRS = conf.d etc init.d man net sh share src
11    
12     NAME = baselayout
13 uberlord 2576 VERSION = 2.0.0_alpha1
14 uberlord 2547
15     PKG = $(NAME)-$(VERSION)
16    
17     ARCH = x86
18     ifeq ($(OS),)
19     OS=$(shell uname -s)
20     ifneq ($(OS),Linux)
21     OS=BSD
22     endif
23     endif
24    
25     BASE_DIRS = /$(LIB)/rcscripts/init.d /$(LIB)/rcscripts/tmp
26     KEEP_DIRS = /boot /home /mnt /root \
27     /usr/local/bin /usr/local/sbin /usr/local/share/doc /usr/local/share/man \
28     /var/lock /var/run
29    
30     ifeq ($(OS),Linux)
31     KEEP_DIRS += /dev /sys
32     NET_LO = net.lo
33     endif
34     ifneq ($(OS),Linux)
35     NET_LO = net.lo0
36     endif
37    
38     TOPDIR = .
39     include $(TOPDIR)/default.mk
40    
41     install::
42     # These dirs may not exist from prior versions
43     for x in $(BASE_DIRS) ; do \
44     $(INSTALL_DIR) $(DESTDIR)$$x || exit $$? ; \
45     touch $(DESTDIR)$$x/.keep || exit $$? ; \
46     done
47     # Don't install runlevels if they already exist
48     if ! test -d $(DESTDIR)/etc/runlevels ; then \
49     (cd runlevels; $(MAKE) install) ; \
50     test -d runlevels.$(OS) && (cd runlevels.$(OS); $(MAKE) install) ; \
51     $(INSTALL_DIR) $(DESTDIR)/etc/runlevels/single || exit $$? ; \
52     $(INSTALL_DIR) $(DESTDIR)/etc/runlevels/nonetwork || exit $$? ; \
53     fi
54     ln -snf ../../$(LIB)/rcscripts/sh/net.sh $(DESTDIR)/etc/init.d/$(NET_LO) || exit $$?
55     ln -snf ../../$(LIB)/rcscripts/sh/functions.sh $(DESTDIR)/etc/init.d || exit $$?
56     # Handle lib correctly
57     if test $(LIB) != "lib" ; then \
58     sed -i'.bak' -e 's,/lib/,/$(LIB)/,g' $(DESTDIR)/$(LIB)/rcscripts/sh/functions.sh || exit $$? ; \
59     rm -f $(DESTDIR)/$(LIB)/rcscripts/sh/functions.sh.bak ; \
60     fi
61    
62     .PHONY: all clean install
63    
64     layout:
65     # Create base filesytem layout
66     for x in $(KEEP_DIRS) ; do \
67     $(INSTALL_DIR) $(DESTDIR)$$x || exit $$? ; \
68     touch $(DESTDIR)$$x/.keep || exit $$? ; \
69     done
70     # Special dirs
71     install -m 0700 -d $(DESTDIR)/root || exit $$?
72     touch $(DESTDIR)/root/.keep || exit $$?
73     install -m 1777 -d $(DESTDIR)/var/tmp || exit $$?
74     touch $(DESTDIR)/var/tmp/.keep || exit $$?
75     install -m 1777 -d $(DESTDIR)/tmp || exit $$?
76     touch $(DESTDIR)/tmp/.keep || exit $$?
77     # FHS compatibility symlinks stuff
78     ln -snf /var/tmp $(DESTDIR)/usr/tmp || exit $$?
79     ln -snf share/man $(DESTDIR)/usr/local/man || exit $$?
80    
81     distcheck:
82     if test -d .svn ; then \
83     svnfiles=`svn status 2>&1 | egrep -v '^(U|P)'` ; \
84     if test "x$$svnfiles" != "x" ; then \
85     echo "Refusing to package tarball until svn is in sync:" ; \
86     echo "$$svnfiles" ; \
87     echo "make distforce to force packaging" ; \
88     exit 1 ; \
89     fi \
90     fi
91    
92     distforce:
93     install -d /tmp/$(PKG)
94     cp -PRp . /tmp/$(PKG)
95     `which find` /tmp/$(PKG) -depth -path "*/.svn/*" -delete
96     `which find` /tmp/$(PKG) -depth -path "*/.svn" -delete
97     rm -rf /tmp/$(PKG)/src/core /tmp/$(PKG)/po
98     $(MAKE) -C /tmp/$(PKG) clean
99     sed -i'.bak' -e '/-Wl,-rpath ./ s/^/#/g' /tmp/$(PKG)/src/Makefile
100     rm -f /tmp/$(PKG)/src/Makefile.bak
101     tar -C /tmp -cvjpf /tmp/$(PKG).tar.bz2 $(PKG)
102     rm -Rf /tmp/$(PKG)
103     du /tmp/$(PKG).tar.bz2
104    
105     dist: distcheck distforce
106    
107     # vim: set ts=4 :

  ViewVC Help
Powered by ViewVC 1.1.20