Debian Codegraph @

libstore/Makefile

raw
1 # Makefile for libstore
2 #
3 # Copyright (C) 1995, 1996, 1997, 1999, 2001, 2002, 2010, 2012, 2013, 2014,
4 # 2016 Free Software Foundation, Inc.
5 # Written by Miles Bader <[email protected]>
6 #
7 # This file is part of the GNU Hurd.
8 #
9 # The GNU Hurd is free software; you can redistribute it and/or
10 # modify it under the terms of the GNU General Public License as
11 # published by the Free Software Foundation; either version 2, or (at
12 # your option) any later version.
13 #
14 # The GNU Hurd is distributed in the hope that it will be useful, but
15 # WITHOUT ANY WARRANTY; without even the implied warranty of
16 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 # General Public License for more details.
18 #
19 # You should have received a copy of the GNU General Public License
20 # along with this program; if not, write to the Free Software
21 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
22
23 dir := libstore
24 makemode := library
25
26 libname = libstore
27 SRCS = create.c derive.c make.c rdwr.c set.c \
28 enc.c encode.c decode.c clone.c argp.c kids.c flags.c \
29 open.c xinl.c typed.c map.c url.c unknown.c \
30 stripe.c $(filter-out ileave.c concat.c,$(store-types:=.c))
31
32 store-types = \
33 concat \
34 copy \
35 device \
36 file \
37 ileave \
38 memobj \
39 module \
40 mvol \
41 nbd \
42 remap \
43 task \
44 zero
45
46 # This has to be evaluated after config.make has been included;
47 # as a consequence, using 'ifneq' or similar is not an option.
48 store-types += \
49 $(and $(PARTED_LIBS),part) \
50 $(and $(HAVE_LIBBZ2),bunzip2) \
51 $(and $(HAVE_LIBZ),gunzip) \
52
53 libstore.so-LDLIBS += $(PARTED_LIBS) -ldl
54 installhdrs=store.h
55
56 HURDLIBS = shouldbeinlibc
57 LDLIBS += -lpthread $(and $(HAVE_LIBBZ2),-lbz2) $(and $(HAVE_LIBZ),-lz)
58 GUNZIP_OBJS = do-gunzip.o util.o
59 BUNZIP2_OBJS = do-bunzip2.o
60 OBJS = $(SRCS:.c=.o) \
61 $(and $(HAVE_LIBZ),$(GUNZIP_OBJS)) \
62 $(and $(HAVE_LIBBZ2),$(BUNZIP2_OBJS))
63
64 include ../Makeconf
65
66 module-CPPFLAGS = -D'STORE_SONAME_SUFFIX=".so.$(hurd-version)"'
67 module-DEPS = $(..)config.make
68
69 libstore_gunzip.so.$(hurd-version): $(GUNZIP_OBJS:.o=_pic.o)
70 libstore_bunzip2.so.$(hurd-version): $(BUNZIP2_OBJS:.o=_pic.o)
71
72 # You can use this rule to make a dynamically-loadable version of any
73 # of the modules. We don't make any of these by default, since we
74 # just include all the standard store types in libstore.so itself.
75 libstore_%.so.$(hurd-version): %_pic.o libstore.so
76 $(CC) -shared -Wl,-soname=$@ -o $@ \
77 $(lpath) $(CFLAGS) $(LDFLAGS) $(libstore_$*.so-LDFLAGS) $^
78
79 # Each libstore_TYPE.a is in fact an object file script so that `-lstore_TYPE'
80 # just has the same effect as `-u store_TYPE_class'.
81 $(store-types:%=libstore_%.a): libstore_%.a: $(srcdir)/Makefile
82 $(CC) -r -nostdlib -nostartfiles -x c /dev/null \
83 -o $@ -u store_$*_class
84 cleantarg += $(store-types:%=libstore_%.a)
85
86 all: $(store-types:%=libstore_%.a)
87
88 install: $(addprefix $(DESTDIR),$(store-types:%=$(libdir)/libstore_%.a))
89 $(addprefix $(DESTDIR),$(store-types:%=$(libdir)/libstore_%.a)): $(DESTDIR)$(libdir)/%: %
90 $(INSTALL_DATA) $< $@