]> git.zarvox.org Git - crbtree.git/blob - Makefile.am
build: install-tree - move to $builddir
[crbtree.git] / Makefile.am
1 # ------------------------------------------------------------------------------
2 # autotools
3
4 SHELL = bash
5 ACLOCAL_AMFLAGS = -I build/m4 ${ACLOCAL_FLAGS}
6 AM_MAKEFLAGS = --no-print-directory
7 AUTOMAKE_OPTIONS = color-tests parallel-tests
8
9 GCC_COLORS ?= 'ooh, shiny!'
10 export GCC_COLORS
11
12 # remove targets if the command fails
13 .DELETE_ON_ERROR:
14
15 # keep intermediate files
16 .SECONDARY:
17
18 # keep the test-suite.log and Makefile around at all times
19 .PRECIOUS: $(TEST_SUITE_LOG) Makefile
20
21 pkgincludedir=$(includedir)/org.bus1
22 pkgconfiglibdir=$(libdir)/pkgconfig
23
24 BUILT_SOURCES =
25 CLEANFILES = $(BUILT_SOURCES)
26 EXTRA_DIST =
27 pkginclude_HEADERS =
28 pkgconfiglib_DATA =
29 noinst_LIBRARIES =
30 check_PROGRAMS =
31 default_tests =
32 TESTS =
33
34 AM_CPPFLAGS = \
35         -include $(top_builddir)/build/config.h \
36         -I $(top_srcdir)/src \
37         -I $(top_builddir)/src \
38         $(OUR_CPPFLAGS)
39
40 AM_CFLAGS = $(OUR_CFLAGS)
41 AM_LDFLAGS = $(OUR_LDFLAGS)
42
43 # ------------------------------------------------------------------------------
44 # library archive
45
46 noinst_LIBRARIES += \
47         libcrbtree.a
48
49 libcrbtree_a_SOURCES = \
50         src/libcrbtree.sym \
51         src/c-rbtree-private.h \
52         src/c-rbtree.c \
53         src/org.bus1/c-rbtree.h
54
55 # ------------------------------------------------------------------------------
56 # shared library built from archive
57
58 all-local: libcrbtree.so.0
59
60 pkginclude_HEADERS += \
61         src/org.bus1/c-rbtree.h
62
63 libcrbtree.so.0: libcrbtree.a $(top_srcdir)/src/libcrbtree.sym
64         $(AM_V_CCLD)$(LINK) -shared \
65         -Wl,-soname=$@ \
66         -Wl,--version-script=$(top_srcdir)/src/libcrbtree.sym \
67         -Wl,--whole-archive libcrbtree.a -Wl,--no-whole-archive
68
69 CLEANFILES += \
70         libcrbtree.so.0
71
72 install-exec-local:
73         @echo " $(MKDIR_P) '$(DESTDIR)$(libdir)'"; \
74                 $(MKDIR_P) "$(DESTDIR)$(libdir)" || exit 1
75         @echo " $(INSTALL) libcrbtree.so.0 '$(DESTDIR)$(libdir)'"; \
76                 $(INSTALL) libcrbtree.so.0 "$(DESTDIR)$(libdir)" || exit $$?
77         @echo " $(LN_S) -f libcrbtree.so.0 '$(DESTDIR)$(libdir)/libcrbtree.so'"; \
78                 $(LN_S) -f libcrbtree.so.0 "$(DESTDIR)$(libdir)/libcrbtree.so" || exit $$?
79
80 uninstall-local:
81         @test ! -d "$(DESTDIR)$(libdir)" || \
82                 { echo " ( cd '$(DESTDIR)$(libdir)' && rm -f libcrbtree.so.0 )"; \
83                   rm -f "$(DESTDIR)$(libdir)/libcrbtree.so.0"; }
84
85 %.pc: %.pc.in
86         $(AM_V_GEN)$(SED) \
87                 -e 's,@includedir\@,$(includedir),g' \
88                 -e 's,@libdir\@,$(libdir),g' \
89                 -e 's,@VERSION\@,$(VERSION),g' \
90                 $< > $@
91
92 pkgconfiglib_DATA += \
93         src/crbtree.pc
94
95 EXTRA_DIST += \
96         src/crbtree.pc.in
97
98 CLEANFILES += \
99         src/crbtree.pc
100
101 # ------------------------------------------------------------------------------
102 # test-api
103
104 default_tests += \
105         test-api
106
107 test_api_SOURCES = \
108         src/test-api.c
109
110 test_api_LDADD = \
111         libcrbtree.so.0 # explicitly linked against public library
112
113 # ------------------------------------------------------------------------------
114 # test-basic
115
116 default_tests += \
117         test-basic
118
119 test_basic_SOURCES = \
120         src/test-basic.c
121
122 test_basic_LDADD = \
123         libcrbtree.a
124
125 # ------------------------------------------------------------------------------
126 # test-map
127
128 default_tests += \
129         test-map
130
131 test_map_SOURCES = \
132         src/test-map.c
133
134 test_map_LDADD = \
135         libcrbtree.a
136
137 # ------------------------------------------------------------------------------
138 # test suite
139
140 AM_TESTS_ENVIRONMENT = LD_LIBRARY_PATH=$(abs_builddir)
141 check_PROGRAMS += $(default_tests)
142 TESTS += $(default_tests)
143
144 # ------------------------------------------------------------------------------ΒΆ
145 # check "make install" directory tree
146
147 install-tree: all
148         rm -rf $(abs_builddir)/install-tree
149         $(MAKE) install DESTDIR=$(abs_builddir)/install-tree
150         tree $(abs_builddir)/install-tree
151 .PHONY: install-tree