1
0
mirror of git://sourceware.org/git/lvm2.git synced 2025-01-02 01:18:26 +03:00

Update makefiles (incl. cmdlib).

This commit is contained in:
Alasdair Kergon 2004-03-26 13:21:12 +00:00
parent 040cfcf89c
commit 84510264cd
3 changed files with 104 additions and 59 deletions

View File

@ -12,7 +12,7 @@ ifeq ("@LVM1@", "shared")
SUBDIRS = format1 SUBDIRS = format1
endif endif
SOURCES=\ SOURCES =\
activate/activate.c \ activate/activate.c \
cache/lvmcache.c \ cache/lvmcache.c \
commands/toolcontext.c \ commands/toolcontext.c \
@ -61,7 +61,7 @@ SOURCES=\
uuid/uuid.c uuid/uuid.c
ifeq ("@LVM1@", "internal") ifeq ("@LVM1@", "internal")
SOURCES+=\ SOURCES +=\
format1/disk-rep.c \ format1/disk-rep.c \
format1/format1.c \ format1/format1.c \
format1/import-export.c \ format1/import-export.c \
@ -72,28 +72,24 @@ ifeq ("@LVM1@", "internal")
endif endif
ifeq ("@DEBUG@", "yes") ifeq ("@DEBUG@", "yes")
SOURCES+=\ SOURCES += mm/dbg_malloc.c
mm/dbg_malloc.c
endif endif
ifeq ("@DEVMAPPER@", "yes") ifeq ("@DEVMAPPER@", "yes")
SOURCES+=\ SOURCES +=\
activate/dev_manager.c \ activate/dev_manager.c \
activate/fs.c activate/fs.c
endif endif
ifeq ("@HAVE_LIBDL@", "yes") ifeq ("@HAVE_LIBDL@", "yes")
SOURCES+=\ SOURCES +=\
locking/external_locking.c \ locking/external_locking.c \
misc/sharedlib.c misc/sharedlib.c
endif endif
TARGETS=liblvm.a LIB_STATIC = liblvm.a
TARGETS = $(LIB_STATIC)
include ../make.tmpl include ../make.tmpl
liblvm.a: $(OBJECTS)
$(RM) $@
$(AR) r $@ $(OBJECTS)
$(RANLIB) $@

View File

@ -29,11 +29,17 @@ MSGFMT = @MSGFMT@
LN_S = @LN_S@ LN_S = @LN_S@
LIBS = @LIBS@ LIBS = @LIBS@
CFLAGS += @CFLAGS@ CFLAGS += @CFLAGS@
CLDFLAGS += @CLDFLAGS@
CLDWHOLEARCHIVE += @CLDWHOLEARCHIVE@
CLDNOWHOLEARCHIVE += @CLDNOWHOLEARCHIVE@
LD_DEPS += @LD_DEPS@
SOFLAG += @SOFLAG@
# Setup directory variables # Setup directory variables
prefix = @prefix@ prefix = @prefix@
exec_prefix = @exec_prefix@ exec_prefix = @exec_prefix@
bindir = $(DESTDIR)@bindir@ bindir = $(DESTDIR)@bindir@
includedir = $(DESTDIR)@includedir@
libdir = $(DESTDIR)@libdir@ libdir = $(DESTDIR)@libdir@
sbindir = $(DESTDIR)@sbindir@ sbindir = $(DESTDIR)@sbindir@
infodir = $(DESTDIR)@infodir@ infodir = $(DESTDIR)@infodir@
@ -42,61 +48,68 @@ localedir = $(DESTDIR)@LOCALEDIR@
# setup misc variables # setup misc variables
# define the ownership variables for the binaries and man pages # define the ownership variables for the binaries and man pages
OWNER=@OWNER@ OWNER = @OWNER@
GROUP=@GROUP@ GROUP = @GROUP@
# The number of jobs to run, if blank, defaults to the make standard # The number of jobs to run, if blank, defaults to the make standard
ifndef MAKEFLAGS ifndef MAKEFLAGS
MAKEFLAGS = @JOBS@ MAKEFLAGS = @JOBS@
endif endif
SUFFIXES= SUFFIXES = .c .d .o .so .a .po .pot .mo
SUFFIXES=.c .d .o .so .po .pot .mo
CFLAGS+=-fPIC -Wall -Wundef -Wshadow -Wcast-align -Wwrite-strings -Wmissing-prototypes -Wmissing-declarations -Wnested-externs -Winline CFLAGS += -fPIC -Wall -Wundef -Wshadow -Wcast-align -Wwrite-strings -Wmissing-prototypes -Wmissing-declarations -Wnested-externs -Winline
#CFLAGS+=-W -Wconversion -Wpointer-arith -Wredundant-decls -Wbad-function-cast -Wcast-qual -Wmissing-noreturn #CFLAGS += -W -Wconversion -Wpointer-arith -Wredundant-decls -Wbad-function-cast -Wcast-qual -Wmissing-noreturn
ifeq ("@DEBUG@", "yes") ifeq ("@DEBUG@", "yes")
CFLAGS+=-g -fno-omit-frame-pointer -DDEBUG_MEM -DDEBUG CFLAGS += -g -fno-omit-frame-pointer -DDEBUG
CFLAGS += -DDEBUG_MEM
else else
CFLAGS+=-O2 CFLAGS += -O2
endif endif
ifeq ("@INTL@", "yes") ifeq ("@INTL@", "yes")
CFLAGS+=-DINTL_PACKAGE=\"@INTL_PACKAGE@\" -DLOCALEDIR=\"@LOCALEDIR@\" CFLAGS += -DINTL_PACKAGE=\"@INTL_PACKAGE@\" -DLOCALEDIR=\"@LOCALEDIR@\"
endif endif
#CFLAGS+=-DDEBUG_POOL LD_FLAGS += -L$(top_srcdir)/lib -L$(libdir)
#CFLAGS+=-DBOUNDS_CHECK
#CFLAGS+=-pg ifeq ("@STATIC_LINK@", "yes")
#LD_FLAGS=-pg LD_FLAGS += -static
endif
#CFLAGS += -DDEBUG_POOL
#CFLAGS += -DBOUNDS_CHECK
#CFLAGS += -pg
#LD_FLAGS += -pg
STRIP=
#STRIP = -s
LIB_VERSION := $(shell cat $(top_srcdir)/VERSION | \ LIB_VERSION := $(shell cat $(top_srcdir)/VERSION | \
awk -F '.' '{printf "%s.%s",$$1,$$2}') awk -F '.' '{printf "%s.%s",$$1,$$2}')
INCLUDES+=-I. -I$(top_srcdir)/include INCLUDES += -I. -I$(top_srcdir)/include
INC_LNS=$(top_srcdir)/include/.symlinks_created
ifdef DESTDIR ifdef DESTDIR
INCLUDES+=-I$(DESTDIR)/usr/include INCLUDES += -I$(DESTDIR)/usr/include
endif endif
STRIP= INC_LNS = $(top_srcdir)/include/.symlinks_created
#STRIP=-s
DEPS=$(top_srcdir)/make.tmpl Makefile $(INC_LNS) DEPS = $(top_srcdir)/make.tmpl $(top_srcdir)/VERSION Makefile $(INC_LNS)
OBJECTS=$(SOURCES:%.c=%.o) OBJECTS = $(SOURCES:%.c=%.o)
POTFILES=$(SOURCES:%.c=%.pot) POTFILES = $(SOURCES:%.c=%.pot)
SUBDIRS.install := $(SUBDIRS:=.install) SUBDIRS.install := $(SUBDIRS:=.install)
SUBDIRS.pofile := $(SUBDIRS:=.pofile) SUBDIRS.pofile := $(SUBDIRS:=.pofile)
SUBDIRS.clean := $(SUBDIRS:=.clean) SUBDIRS.clean := $(SUBDIRS:=.clean)
SUBDIRS.distclean := $(SUBDIRS:=.distclean) SUBDIRS.distclean := $(SUBDIRS:=.distclean)
.PHONY: all install pofile distclean clean .PHONY: all install pofile distclean clean
.PHONY: $(SUBDIRS) $(SUBDIRS.install) $(SUBDIRS.clean) $(SUBDIRS.distclean) .PHONY: $(SUBDIRS) $(SUBDIRS.install) $(SUBDIRS.clean) $(SUBDIRS.distclean)
.PHONY: $(SUBDIRS.pofile) .PHONY: $(SUBDIRS.pofile)
@ -123,11 +136,13 @@ $(SUBDIRS.pofile):
$(MAKE) -C $(@:.pofile=) pofile $(MAKE) -C $(@:.pofile=) pofile
endif endif
$(TARGETS): $(OBJECTS)
%.o: %.c %.o: %.c
$(CC) -c $(INCLUDES) $(CFLAGS) $< -o $@ $(CC) -c $(INCLUDES) $(CFLAGS) $< -o $@
%.pot: %.c %.pot: %.c
$(CC) -E -P $(INCLUDES) -include $(top_srcdir)/include/pogen.h \ $(CC) -E $(INCLUDES) -include $(top_srcdir)/include/pogen.h \
$(CFLAGS) $< > $@ $(CFLAGS) $< > $@
%.pot: Makefile %.pot: Makefile
@ -135,30 +150,40 @@ endif
%.so: %.o %.so: %.o
$(CC) -c $(INCLUDES) $(CFLAGS) %< -o $@ $(CC) -c $(INCLUDES) $(CFLAGS) %< -o $@
%.so: $(OBJECTS) %.so: $(OBJECTS) $(LD_DEPS)
$(CC) -shared -Wl,-soname,$(notdir $@).$(LIB_VERSION) \ $(CC) $(SOFLAG) -Wl,-soname,$(notdir $@).$(LIB_VERSION) \
-Wl,--version-script,.export.sym $(OBJECTS) -o $@ $(CLDFLAGS) $(OBJECTS) -o $@
$(LIB_STATIC): $(OBJECTS)
$(RM) $@
$(AR) rs $@ $(OBJECTS)
%.d: %.c %.d: %.c
set -e; FILE=`echo $@ | sed 's/\\//\\\\\\//g;s/\\.d//g'`; \ set -e; \
DEPS=`echo $(DEPS) | sed -e 's/\\//\\\\\\//g'`; \ FILE=`echo $@ | sed 's/\\//\\\\\\//g;s/\\.d//g'`; \
$(CC) -MM $(INCLUDES) $(CFLAGS) $< | \ DEPS=`echo $(DEPS) | sed -e 's/\\//\\\\\\//g'`; \
sed "s/\(.*\)\.o[ :]*/$$FILE.o $$FILE.d $$FILE.pot: $$DEPS /g" \ $(CC) -MM $(INCLUDES) $(CFLAGS) $< | \
> $@; \ sed "s/\(.*\)\.o[ :]*/$$FILE.o $$FILE.d $$FILE.pot: $$DEPS /g" > $@; \
[ -s $@ ] || $(RM) $@ [ -s $@ ] || $(RM) $@
%.mo: %.po %.mo: %.po
$(MSGFMT) -o $@ $< $(MSGFMT) -o $@ $<
clean: $(SUBDIRS.clean) clean: $(SUBDIRS.clean)
$(RM) $(OBJECTS) $(TARGETS) $(SOURCES:%.c=%.d) \ $(RM) $(OBJECTS) $(TARGETS) $(CLEAN_TARGETS) $(SOURCES:%.c=%.d) \
$(SOURCES:%.c=%.pot) $(SOURCES:%.c=%.pot) $(LD_DEPS)
distclean: $(SUBDIRS.distclean) distclean: $(SUBDIRS.distclean)
$(RM) $(OBJECTS) $(TARGETS) $(SOURCES:%.c=%.d) $(RM) $(OBJECTS) $(TARGETS) $(CLEAN_TARGETS) $(SOURCES:%.c=%.d) \
$(RM) $(SOURCES:%.c=%.pot) $(SOURCES:%.c=%.pot) $(LD_DEPS) \
$(RM) config.cache config.log config.status config.cache config.log config.status \
$(RM) Makefile make.tmpl version.h core lvm2.po Makefile make.tmpl core \
version.h lvm2.po
.export.sym: .exported_symbols
set -e; (echo "Base {"; echo " global:"; \
sed "s/^/ /;s/$$/;/" < $<; \
echo " local:"; echo " *;"; echo "};") > $@
ifneq ($(MAKECMDGOALS),clean) ifneq ($(MAKECMDGOALS),clean)
ifneq ($(MAKECMDGOALS),distclean) ifneq ($(MAKECMDGOALS),distclean)

View File

@ -1,5 +1,5 @@
# #
# Copyright (C) 2001 Sistina Software # Copyright (C) 2001-2003 Sistina Software
# #
# This LVM library is free software; you can redistribute it and/or # This LVM library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Library General Public # modify it under the terms of the GNU Library General Public
@ -27,8 +27,8 @@ SOURCES=\
lvcreate.c \ lvcreate.c \
lvdisplay.c \ lvdisplay.c \
lvextend.c \ lvextend.c \
lvmcmdline.c \
lvmchange.c \ lvmchange.c \
lvmcmdline.c \
lvmdiskscan.c \ lvmdiskscan.c \
lvreduce.c \ lvreduce.c \
lvremove.c \ lvremove.c \
@ -67,25 +67,47 @@ TARGETS=\
LVMLIBS=-llvm LVMLIBS=-llvm
INSTALL_TARGETS=\
install_lvm_tools
CLEAN_TARGETS = liblvm2cmd.so liblvm2cmd.a
ifeq ("@CMDLIB@", "yes")
TARGETS += liblvm2cmd.so
INSTALL_TARGETS += install_cmdlib
endif
ifeq ("@DEVMAPPER@", "yes") ifeq ("@DEVMAPPER@", "yes")
LVMLIBS += -ldevmapper LVMLIBS += -ldevmapper
endif endif
include ../make.tmpl include ../make.tmpl
ifeq ("@STATIC_LINK@", "no")
LVMLIBS += -rdynamic
endif
lvm: $(OBJECTS) lvm.o $(top_srcdir)/lib/liblvm.a lvm: $(OBJECTS) lvm.o $(top_srcdir)/lib/liblvm.a
$(CC) -o lvm $(OBJECTS) lvm.o $(LD_FLAGS) -L$(top_srcdir)/lib \ $(CC) -o lvm $(OBJECTS) lvm.o $(LD_FLAGS) $(LVMLIBS) $(LIBS)
-L$(DESTDIR)/lib $(LVMLIBS) $(LIBS)
liblvm2cmd.a: $(top_srcdir)/lib/liblvm.a $(OBJECTS)
cat $(top_srcdir)/lib/liblvm.a > $@
$(AR) rs $@ $(OBJECTS)
liblvm2cmd.so: liblvm2cmd.a $(LD_DEPS)
$(CC) -o liblvm2cmd.so $(SOFLAG) $(CLDFLAGS) \
$(CLDWHOLEARCHIVE) liblvm2cmd.a $(CLDNOWHOLEARCHIVE)
.commands: commands.h cmdnames.h Makefile .commands: commands.h cmdnames.h Makefile
$(CC) -E -P cmdnames.h 2> /dev/null | \ $(CC) -E -P cmdnames.h 2> /dev/null | \
egrep -v '^ *(|#.*|dumpconfig|help|pvdata|version) *$$' > .commands egrep -v '^ *(|#.*|dumpconfig|help|pvdata|version) *$$' > .commands
install: $(TARGETS) .PHONY: install_lvm_tools install_cmdlib
install_cmdlib: $(TARGETS)
$(INSTALL) -D -o $(OWNER) -g $(GROUP) -m 555 $(STRIP) liblvm2cmd.so \
$(libdir)/liblvm2cmd.so.$(LIB_VERSION)
$(LN_S) -f liblvm2cmd.so.$(LIB_VERSION) $(libdir)/liblvm2cmd.so
$(INSTALL) -D -o $(OWNER) -g $(GROUP) -m 444 lvm2cmd.h \
$(includedir)/lvm2cmd.h
install_lvm_tools: $(TARGETS)
$(INSTALL) -D -o $(OWNER) -g $(GROUP) -m 555 $(STRIP) lvm \ $(INSTALL) -D -o $(OWNER) -g $(GROUP) -m 555 $(STRIP) lvm \
$(sbindir)/lvm $(sbindir)/lvm
@echo Creating symbolic links for individual commands in $(sbindir) @echo Creating symbolic links for individual commands in $(sbindir)
@ -96,3 +118,5 @@ install: $(TARGETS)
done; \ done; \
) )
install: $(INSTALL_TARGETS)