/[baselayout]/trunk/src/Makefile
Gentoo

Contents of /trunk/src/Makefile

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2591 - (hide annotations) (download)
Fri Apr 13 12:55:43 2007 UTC (7 years, 8 months ago) by vapier
File size: 4807 byte(s)
dont create .so links as they arent needed for runtime
1 uberlord 2547 # Copyright 1999-2007 Gentoo Foundation
2     # Distributed under the terms of the GNU General Public License v2
3    
4     CC ?= gcc
5    
6     CFLAGS ?= -Wall -O2 -pipe
7 uberlord 2561
8     # Loads of nice flags to ensure our code is good
9 uberlord 2547 CFLAGS += -pedantic -std=c99 \
10 uberlord 2548 -Wall -Wunused -Wimplicit -Wshadow -Wformat=2 \
11 uberlord 2547 -Wmissing-declarations -Wno-missing-prototypes -Wwrite-strings \
12     -Wbad-function-cast -Wnested-externs -Wcomment -Winline \
13 uberlord 2561 -Wchar-subscripts -Wcast-align -Wno-format-nonliteral \
14     $(call check_gcc, -Wdeclaration-after-statement) \
15     $(call check_gcc, -Wsequence-point) \
16 uberlord 2573 $(call check_gcc, -Wextra)
17 uberlord 2547
18     # For debugging. -Werror is pointless due to ISO C issues with dlsym
19     #CFLAGS += -ggdb
20    
21     DESTDIR =
22     LIB = lib
23    
24     LIBEINFOSOVER = 0
25     LIBEINFOSO = libeinfo.so.$(LIBRCSOVER)
26     LIBEINFOOBJS= libeinfo.o
27    
28     LIBRCSOVER = 0
29     LIBRCSO = librc.so.$(LIBRCSOVER)
30     LIBRCOBJS= librc.o librc-depend.o librc-daemon.o librc-misc.o librc-strlist.o
31    
32     LIB_TARGETS = $(LIBEINFOSO) $(LIBRCSO)
33     BIN_TARGETS = rc-status
34 uberlord 2559 SBIN_TARGETS = env-update rc rc-update runscript start-stop-daemon
35     PRIV_BIN_TARGETS = fstabinfo mountinfo rc-depend
36 uberlord 2547 SYS_WHITELIST = env_whitelist
37    
38 uberlord 2550 TARGET = $(LIB_TARGETS) $(BIN_TARGETS) $(SBIN_TARGETS) $(PRIV_BIN_TARGETS)
39 uberlord 2547
40     RCLINKS = einfon einfo ewarnn ewarn eerrorn eerror ebegin eend ewend \
41     eindent eoutdent eflush color_terminal \
42     veinfo vewarn vebegin veend vewend veindent veoutdent \
43     service_starting service_inactive service_started \
44     service_stopping service_stopped \
45     service_inactive service_wasinactive \
46     service_coldplugged \
47     mark_service_starting mark_service_inactive mark_service_started \
48     mark_service_stopping mark_service_stopped \
49     mark_service_inactive mark_service_wasinactive \
50     mark_service_coldplugged \
51     get_options save_options \
52     is_runlevel_start is_runlevel_stop service_started_daemon
53    
54     # Quick hack to make my life easier on BSD and Linux
55     ifeq ($(OS),)
56     OS=$(shell uname -s)
57     ifneq ($(OS),Linux)
58     OS=BSD
59     endif
60     endif
61    
62     ifeq ($(OS),Linux)
63     LDLIBS_RC = -ldl
64     LDLIBS_RS = -ldl
65     # Shouldn't need this, but it's the easiest workaround for silly
66     # Linux headers that don't work with -std=c99
67     override CFLAGS += -D_GNU_SOURCE
68     endif
69     ifeq ($(OS),BSD)
70     override LDLIBS += -lkvm
71     endif
72    
73     HAVE_PAM =
74     ifdef HAVE_PAM
75     CFLAGS_SSD = -DHAVE_PAM
76     LDLIBS_SSD = -lpam
77     endif
78    
79     # We also define _BSD_SOURCE so both Linux and the BSDs get a few
80     # handy functions which makes our lives a lot easier
81 uberlord 2560 override CFLAGS += -DLIB=\"$(LIB)\"
82 uberlord 2547
83     # IMPORTANT!!!
84     # Remove this when releasing as it's a security risk
85     # However, this does save us using libtool when we're testing
86     # NOTE: The toplevel Makefile for baselayout will automatically
87     # disable then when doing `make dist`
88 uberlord 2563 override LDFLAGS += -Wl,-rpath .
89 uberlord 2547
90     all: $(TARGET)
91    
92     $(LIBEINFOOBJS): CFLAGS += -fPIC
93     $(LIBEINFOSO): LDLIBS =
94     $(LIBEINFOSO): $(LIBEINFOOBJS)
95     $(CC) -fPIC -shared -Wl,-soname,$(LIBEINFOSO) -o $(LIBEINFOSO) $(LIBEINFOOBJS)
96     ln -sf $(LIBEINFOSO) libeinfo.so
97    
98     $(LIBRCOBJS): CFLAGS += -fPIC
99     $(LIBRCSO): $(LIBRCOBJS)
100     $(CC) -fPIC -shared -Wl,-soname,$(LIBRCSO) -o $(LIBRCSO) $(LIBRCOBJS)
101     ln -sf $(LIBRCSO) librc.so
102    
103     env-update: $(LIBEINFOSO) $(LIBRCSO) env-update.o
104    
105     fstabinfo: $(LIBEINFOSO) fstabinfo.o
106    
107     mountinfo: $(LIBEINFOSO) $(LIBRCSO) mountinfo.o
108    
109     rc-depend: $(LIBEINFOSO) $(LIBRCSO) rc-depend.o
110    
111     rc-status: $(LIBEINFOSO) $(LIBRCSO) rc-status.o
112    
113     rc-update: $(LIBEINFOSO) $(LIBRCSO) rc-update.o
114    
115     rc: LDLIBS += $(LDLIBS_RC)
116     rc: $(LIBEINFOSO) $(LIBRCSO) rc-plugin.o rc.o
117    
118     runscript: LDLIBS += $(LDLIBS_RS)
119     runscript: $(LIBEINFOSO) $(LIBRCSO) rc-plugin.o runscript.o
120    
121     start-stop-daemon: CFLAGS += $(CFLAGS_SSD)
122     start-stop-daemon: LDLIBS += $(LDLIBS_SSD)
123     start-stop-daemon: $(LIBEINFOSO) $(LIBRCSO) start-stop-daemon.o
124    
125     links: rc
126     for x in $(RCLINKS) $(RCPRIVLINKS); do ln -sf rc $$x; done
127    
128     install: $(TARGET)
129     install -m 0755 -d $(DESTDIR)/$(LIB)
130     install -m 0755 $(LIB_TARGETS) $(DESTDIR)/$(LIB)
131     install -m 0755 -d $(DESTDIR)/usr/include
132     install -m 0644 einfo.h rc.h $(DESTDIR)/usr/include
133     install -m 0755 -d $(DESTDIR)/bin
134     install -m 0755 $(BIN_TARGETS) $(DESTDIR)/bin
135     install -m 0755 -d $(DESTDIR)/sbin
136     install -m 0755 $(SBIN_TARGETS) $(DESTDIR)/sbin
137 vapier 2590 ln -sf rc-update $(DESTDIR)/sbin/update-rc
138 uberlord 2547 install -m 0755 -d $(DESTDIR)/$(LIB)/rcscripts/conf.d
139     install -m 0644 $(SYS_WHITELIST) $(DESTDIR)/$(LIB)/rcscripts/conf.d
140     install -m 0755 -d $(DESTDIR)/$(LIB)/rcscripts/bin
141 uberlord 2550 install -m 0755 $(PRIV_BIN_TARGETS) $(DESTDIR)/$(LIB)/rcscripts/bin
142 uberlord 2547 for x in $(RCLINKS); do ln -sf $(DESTDIR)/sbin/rc $(DESTDIR)/$(LIB)/rcscripts/bin/$$x; done
143     if test "$(HAVE_PAM)" != "" ; then \
144     install -m 0755 -d $(DESTDIR)/etc/pam.d ; \
145     install -m 0644 start-stop-daemon.pam $(DESTDIR)/etc/pam.d/start-stop-daemon ; \
146     fi
147    
148     clean:
149     rm -f $(TARGET) $(RCLINKS) $(RCPRIVLINKS)
150     rm -f *.o *~ *.core *.so

  ViewVC Help
Powered by ViewVC 1.1.20