1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-30 17:18:21 +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
endif
SOURCES=\
SOURCES =\
activate/activate.c \
cache/lvmcache.c \
commands/toolcontext.c \
@ -61,7 +61,7 @@ SOURCES=\
uuid/uuid.c
ifeq ("@LVM1@", "internal")
SOURCES+=\
SOURCES +=\
format1/disk-rep.c \
format1/format1.c \
format1/import-export.c \
@ -72,28 +72,24 @@ ifeq ("@LVM1@", "internal")
endif
ifeq ("@DEBUG@", "yes")
SOURCES+=\
mm/dbg_malloc.c
SOURCES += mm/dbg_malloc.c
endif
ifeq ("@DEVMAPPER@", "yes")
SOURCES+=\
SOURCES +=\
activate/dev_manager.c \
activate/fs.c
endif
ifeq ("@HAVE_LIBDL@", "yes")
SOURCES+=\
SOURCES +=\
locking/external_locking.c \
misc/sharedlib.c
endif
TARGETS=liblvm.a
LIB_STATIC = liblvm.a
TARGETS = $(LIB_STATIC)
include ../make.tmpl
liblvm.a: $(OBJECTS)
$(RM) $@
$(AR) r $@ $(OBJECTS)
$(RANLIB) $@

View File

@ -29,11 +29,17 @@ MSGFMT = @MSGFMT@
LN_S = @LN_S@
LIBS = @LIBS@
CFLAGS += @CFLAGS@
CLDFLAGS += @CLDFLAGS@
CLDWHOLEARCHIVE += @CLDWHOLEARCHIVE@
CLDNOWHOLEARCHIVE += @CLDNOWHOLEARCHIVE@
LD_DEPS += @LD_DEPS@
SOFLAG += @SOFLAG@
# Setup directory variables
prefix = @prefix@
exec_prefix = @exec_prefix@
bindir = $(DESTDIR)@bindir@
includedir = $(DESTDIR)@includedir@
libdir = $(DESTDIR)@libdir@
sbindir = $(DESTDIR)@sbindir@
infodir = $(DESTDIR)@infodir@
@ -42,61 +48,68 @@ localedir = $(DESTDIR)@LOCALEDIR@
# setup misc variables
# define the ownership variables for the binaries and man pages
OWNER=@OWNER@
GROUP=@GROUP@
OWNER = @OWNER@
GROUP = @GROUP@
# The number of jobs to run, if blank, defaults to the make standard
ifndef MAKEFLAGS
MAKEFLAGS = @JOBS@
endif
SUFFIXES=
SUFFIXES=.c .d .o .so .po .pot .mo
SUFFIXES = .c .d .o .so .a .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")
CFLAGS+=-g -fno-omit-frame-pointer -DDEBUG_MEM -DDEBUG
CFLAGS += -g -fno-omit-frame-pointer -DDEBUG
CFLAGS += -DDEBUG_MEM
else
CFLAGS+=-O2
CFLAGS += -O2
endif
ifeq ("@INTL@", "yes")
CFLAGS+=-DINTL_PACKAGE=\"@INTL_PACKAGE@\" -DLOCALEDIR=\"@LOCALEDIR@\"
CFLAGS += -DINTL_PACKAGE=\"@INTL_PACKAGE@\" -DLOCALEDIR=\"@LOCALEDIR@\"
endif
#CFLAGS+=-DDEBUG_POOL
#CFLAGS+=-DBOUNDS_CHECK
LD_FLAGS += -L$(top_srcdir)/lib -L$(libdir)
#CFLAGS+=-pg
#LD_FLAGS=-pg
ifeq ("@STATIC_LINK@", "yes")
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 | \
awk -F '.' '{printf "%s.%s",$$1,$$2}')
INCLUDES+=-I. -I$(top_srcdir)/include
INC_LNS=$(top_srcdir)/include/.symlinks_created
INCLUDES += -I. -I$(top_srcdir)/include
ifdef DESTDIR
INCLUDES+=-I$(DESTDIR)/usr/include
INCLUDES += -I$(DESTDIR)/usr/include
endif
STRIP=
#STRIP=-s
INC_LNS = $(top_srcdir)/include/.symlinks_created
DEPS=$(top_srcdir)/make.tmpl Makefile $(INC_LNS)
DEPS = $(top_srcdir)/make.tmpl $(top_srcdir)/VERSION Makefile $(INC_LNS)
OBJECTS=$(SOURCES:%.c=%.o)
POTFILES=$(SOURCES:%.c=%.pot)
OBJECTS = $(SOURCES:%.c=%.o)
POTFILES = $(SOURCES:%.c=%.pot)
SUBDIRS.install := $(SUBDIRS:=.install)
SUBDIRS.pofile := $(SUBDIRS:=.pofile)
SUBDIRS.clean := $(SUBDIRS:=.clean)
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.pofile)
@ -123,11 +136,13 @@ $(SUBDIRS.pofile):
$(MAKE) -C $(@:.pofile=) pofile
endif
$(TARGETS): $(OBJECTS)
%.o: %.c
$(CC) -c $(INCLUDES) $(CFLAGS) $< -o $@
%.pot: %.c
$(CC) -E -P $(INCLUDES) -include $(top_srcdir)/include/pogen.h \
$(CC) -E $(INCLUDES) -include $(top_srcdir)/include/pogen.h \
$(CFLAGS) $< > $@
%.pot: Makefile
@ -135,30 +150,40 @@ endif
%.so: %.o
$(CC) -c $(INCLUDES) $(CFLAGS) %< -o $@
%.so: $(OBJECTS)
$(CC) -shared -Wl,-soname,$(notdir $@).$(LIB_VERSION) \
-Wl,--version-script,.export.sym $(OBJECTS) -o $@
%.so: $(OBJECTS) $(LD_DEPS)
$(CC) $(SOFLAG) -Wl,-soname,$(notdir $@).$(LIB_VERSION) \
$(CLDFLAGS) $(OBJECTS) -o $@
$(LIB_STATIC): $(OBJECTS)
$(RM) $@
$(AR) rs $@ $(OBJECTS)
%.d: %.c
set -e; FILE=`echo $@ | sed 's/\\//\\\\\\//g;s/\\.d//g'`; \
DEPS=`echo $(DEPS) | sed -e 's/\\//\\\\\\//g'`; \
$(CC) -MM $(INCLUDES) $(CFLAGS) $< | \
sed "s/\(.*\)\.o[ :]*/$$FILE.o $$FILE.d $$FILE.pot: $$DEPS /g" \
> $@; \
[ -s $@ ] || $(RM) $@
set -e; \
FILE=`echo $@ | sed 's/\\//\\\\\\//g;s/\\.d//g'`; \
DEPS=`echo $(DEPS) | sed -e 's/\\//\\\\\\//g'`; \
$(CC) -MM $(INCLUDES) $(CFLAGS) $< | \
sed "s/\(.*\)\.o[ :]*/$$FILE.o $$FILE.d $$FILE.pot: $$DEPS /g" > $@; \
[ -s $@ ] || $(RM) $@
%.mo: %.po
$(MSGFMT) -o $@ $<
clean: $(SUBDIRS.clean)
$(RM) $(OBJECTS) $(TARGETS) $(SOURCES:%.c=%.d) \
$(SOURCES:%.c=%.pot)
$(RM) $(OBJECTS) $(TARGETS) $(CLEAN_TARGETS) $(SOURCES:%.c=%.d) \
$(SOURCES:%.c=%.pot) $(LD_DEPS)
distclean: $(SUBDIRS.distclean)
$(RM) $(OBJECTS) $(TARGETS) $(SOURCES:%.c=%.d)
$(RM) $(SOURCES:%.c=%.pot)
$(RM) config.cache config.log config.status
$(RM) Makefile make.tmpl version.h core lvm2.po
$(RM) $(OBJECTS) $(TARGETS) $(CLEAN_TARGETS) $(SOURCES:%.c=%.d) \
$(SOURCES:%.c=%.pot) $(LD_DEPS) \
config.cache config.log config.status \
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),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
# modify it under the terms of the GNU Library General Public
@ -27,8 +27,8 @@ SOURCES=\
lvcreate.c \
lvdisplay.c \
lvextend.c \
lvmcmdline.c \
lvmchange.c \
lvmcmdline.c \
lvmdiskscan.c \
lvreduce.c \
lvremove.c \
@ -67,25 +67,47 @@ TARGETS=\
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")
LVMLIBS += -ldevmapper
endif
include ../make.tmpl
ifeq ("@STATIC_LINK@", "no")
LVMLIBS += -rdynamic
endif
lvm: $(OBJECTS) lvm.o $(top_srcdir)/lib/liblvm.a
$(CC) -o lvm $(OBJECTS) lvm.o $(LD_FLAGS) -L$(top_srcdir)/lib \
-L$(DESTDIR)/lib $(LVMLIBS) $(LIBS)
$(CC) -o lvm $(OBJECTS) lvm.o $(LD_FLAGS) $(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
$(CC) -E -P cmdnames.h 2> /dev/null | \
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 \
$(sbindir)/lvm
@echo Creating symbolic links for individual commands in $(sbindir)
@ -96,3 +118,5 @@ install: $(TARGETS)
done; \
)
install: $(INSTALL_TARGETS)