]> sourceware.org Git - lvm2.git/blob - make.tmpl.in
make -O2 optimisation flag configurable.
[lvm2.git] / make.tmpl.in
1 # @configure_input@
2 #
3 # Copyright (C) 2001-2004 Sistina Software, Inc. All rights reserved.
4 # Copyright (C) 2004 Red Hat, Inc. All rights reserved.
5 #
6 # This file is part of the LVM2.
7 #
8 # This copyrighted material is made available to anyone wishing to use,
9 # modify, copy, or redistribute it subject to the terms and conditions
10 # of the GNU General Public License v.2.
11 #
12 # You should have received a copy of the GNU General Public License
13 # along with this program; if not, write to the Free Software Foundation,
14 # Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
15
16 SHELL = /bin/sh
17
18 @SET_MAKE@
19
20 CC = @CC@
21 RANLIB = @RANLIB@
22 SHELL = /bin/sh
23 INSTALL = @INSTALL@
24 MSGFMT = @MSGFMT@
25 LN_S = @LN_S@
26 LIBS = @LIBS@
27 CFLAGS += @CFLAGS@
28 CLDFLAGS += @CLDFLAGS@
29 CLDWHOLEARCHIVE += @CLDWHOLEARCHIVE@
30 CLDNOWHOLEARCHIVE += @CLDNOWHOLEARCHIVE@
31 LDDEPS += @LDDEPS@
32 LDFLAGS += @LDFLAGS@
33 SOFLAG += @SOFLAG@
34
35 # Setup directory variables
36 prefix = @prefix@
37 exec_prefix = @exec_prefix@
38 bindir = $(DESTDIR)@bindir@
39 confdir = $(DESTDIR)@CONFDIR@/lvm
40 includedir = $(DESTDIR)@includedir@
41 libdir = $(DESTDIR)@libdir@
42 sbindir = $(DESTDIR)@sbindir@
43 infodir = $(DESTDIR)@infodir@
44 mandir = $(DESTDIR)@mandir@
45 localedir = $(DESTDIR)@LOCALEDIR@
46 staticdir = $(DESTDIR)@STATICDIR@
47
48 # setup misc variables
49 # define the ownership variables for the binaries and man pages
50 OWNER = @OWNER@
51 GROUP = @GROUP@
52
53 # The number of jobs to run, if blank, defaults to the make standard
54 ifndef MAKEFLAGS
55 MAKEFLAGS = @JOBS@
56 endif
57
58 SUFFIXES = .c .d .o .so .a .po .pot .mo
59
60 CFLAGS += -fPIC -Wall -Wundef -Wshadow -Wcast-align -Wwrite-strings -Wmissing-prototypes -Wmissing-declarations -Wnested-externs -Winline
61
62 #CFLAGS += -W -Wconversion -Wpointer-arith -Wredundant-decls -Wbad-function-cast -Wcast-qual -Wmissing-noreturn
63
64 CFLAGS += @COPTIMISE_FLAG@
65
66 ifeq ("@DEBUG@", "yes")
67 CFLAGS += -g -fno-omit-frame-pointer -DDEBUG
68 CFLAGS += -DDEBUG_MEM
69 endif
70
71 ifeq ("@INTL@", "yes")
72 CFLAGS += -DINTL_PACKAGE=\"@INTL_PACKAGE@\" -DLOCALEDIR=\"@LOCALEDIR@\"
73 endif
74
75 LDFLAGS += -L$(top_srcdir)/lib -L$(libdir)
76
77 #CFLAGS += -DDEBUG_POOL
78 #CFLAGS += -DBOUNDS_CHECK
79
80 #CFLAGS += -pg
81 #LDFLAGS += -pg
82
83 STRIP=
84 #STRIP = -s
85
86 LIB_VERSION := $(shell cat $(top_srcdir)/VERSION | \
87 awk -F '.' '{printf "%s.%s",$$1,$$2}')
88
89 INCLUDES += -I. -I$(top_srcdir)/include
90
91 ifdef DESTDIR
92 INCLUDES += -I$(DESTDIR)/usr/include
93 endif
94
95 INC_LNS = $(top_srcdir)/include/.symlinks_created
96
97 DEPS = $(top_srcdir)/make.tmpl $(top_srcdir)/VERSION Makefile $(INC_LNS)
98
99 OBJECTS = $(SOURCES:%.c=%.o)
100 POTFILES = $(SOURCES:%.c=%.pot)
101
102 SUBDIRS.install := $(SUBDIRS:=.install)
103 SUBDIRS.pofile := $(SUBDIRS:=.pofile)
104 SUBDIRS.clean := $(SUBDIRS:=.clean)
105 SUBDIRS.distclean := $(SUBDIRS:=.distclean)
106
107 .PHONY: all install pofile distclean clean
108 .PHONY: $(SUBDIRS) $(SUBDIRS.install) $(SUBDIRS.clean) $(SUBDIRS.distclean)
109 .PHONY: $(SUBDIRS.pofile)
110
111 TARGETS += $(LIB_SHARED) $(LIB_STATIC)
112
113 all: $(SUBDIRS) $(TARGETS)
114
115 install: all $(SUBDIRS.install)
116
117 $(SUBDIRS):
118 $(MAKE) -C $@
119
120 $(SUBDIRS.install): $(SUBDIRS)
121 $(MAKE) -C $(@:.install=) install
122
123 $(SUBDIRS.clean):
124 -$(MAKE) -C $(@:.clean=) clean
125
126 $(SUBDIRS.distclean):
127 -$(MAKE) -C $(@:.distclean=) distclean
128
129 ifeq ("@INTL@", "yes")
130 pofile: $(SUBDIRS.pofile) $(POTFILES)
131
132 $(SUBDIRS.pofile):
133 $(MAKE) -C $(@:.pofile=) pofile
134 endif
135
136 $(TARGETS): $(OBJECTS)
137
138 %.o: %.c
139 $(CC) -c $(INCLUDES) $(CFLAGS) $< -o $@
140
141 %.pot: %.c Makefile
142 $(CC) -E $(INCLUDES) -include $(top_srcdir)/include/pogen.h \
143 $(CFLAGS) $< > $@
144
145 %.so: %.o
146 $(CC) -c $(INCLUDES) $(CFLAGS) $< -o $@
147
148 $(LIB_SHARED): $(OBJECTS) $(LDDEPS)
149 $(CC) $(SOFLAG) -Wl,-soname,$(notdir $@).$(LIB_VERSION) \
150 $(CLDFLAGS) $(OBJECTS) -o $@
151
152 $(LIB_STATIC): $(OBJECTS)
153 $(RM) $@
154 $(AR) rs $@ $(OBJECTS)
155
156 %.d: %.c
157 set -e; \
158 FILE=`echo $@ | sed 's/\\//\\\\\\//g;s/\\.d//g'`; \
159 DEPS=`echo $(DEPS) | sed -e 's/\\//\\\\\\//g'`; \
160 $(CC) -MM $(INCLUDES) $(CFLAGS) $< | \
161 sed "s/\(.*\)\.o[ :]*/$$FILE.o $$FILE.d $$FILE.pot: $$DEPS /g" > $@; \
162 [ -s $@ ] || $(RM) $@
163
164 %.mo: %.po
165 $(MSGFMT) -o $@ $<
166
167 clean: $(SUBDIRS.clean)
168 $(RM) $(OBJECTS) $(TARGETS) $(CLEAN_TARGETS) $(SOURCES:%.c=%.d) \
169 $(SOURCES:%.c=%.pot) $(LDDEPS)
170
171 distclean: $(SUBDIRS.distclean)
172 $(RM) $(OBJECTS) $(TARGETS) $(CLEAN_TARGETS) $(SOURCES:%.c=%.d) \
173 $(SOURCES:%.c=%.pot) $(LDDEPS) \
174 config.cache config.log config.status \
175 Makefile make.tmpl core \
176 version.h lvm2.po
177
178 .export.sym: .exported_symbols
179 set -e; (echo "Base {"; echo " global:"; \
180 sed "s/^/ /;s/$$/;/" < $<; \
181 echo " local:"; echo " *;"; echo "};") > $@
182
183 ifneq ($(MAKECMDGOALS),clean)
184 ifneq ($(MAKECMDGOALS),distclean)
185 ifdef SOURCES
186 -include $(SOURCES:.c=.d)
187 endif
188 endif
189 endif
190
This page took 0.050364 seconds and 6 git commands to generate.