2c5388bbb91d5d6685ad289902d24a63eb5c1d53
[platform/upstream/libtsm.git] / Makefile.am
1 #
2 # libtsm - Global Makefile
3 # Copyright (c) 2012-2013 David Herrmann <dh.herrmann@gmail.com>
4 #
5
6 #
7 # Library Version Numbers
8 #
9
10 LIBTSM_CURRENT = 3
11 LIBTSM_REVISION = 0
12 LIBTSM_AGE = 0
13
14 #
15 # Global Configurations and Initializations
16 #
17
18 ACLOCAL_AMFLAGS = -I m4 ${ACLOCAL_FLAGS}
19 AM_MAKEFLAGS = --no-print-directory
20 AUTOMAKE_OPTIONS = color-tests
21 AM_DISTCHECK_CONFIGURE_FLAGS = \
22         --enable-debug \
23         --enable-optimizations
24
25 SUBDIRS = .
26
27 .DELETE_ON_ERROR:
28
29 include_HEADERS =
30 EXTRA_DIST = \
31         README \
32         COPYING \
33         LICENSE_htable \
34         NEWS \
35         docs/libtsm.pc.in \
36         docs/libtsm.sym
37 CLEANFILES =
38 pkgconfigdir = $(libdir)/pkgconfig
39 pkgconfig_DATA =
40 TPHONY =
41
42 TESTS =
43 check_PROGRAMS =
44 lib_LTLIBRARIES =
45 noinst_LTLIBRARIES =
46
47 #
48 # Default CFlags
49 # Make all files include "config.h" by default. This shouldn't cause any
50 # problems and we cannot forget to include it anymore.
51 #
52 # Also make the linker discard all unused symbols.
53 #
54 # When compiling in debug mode, we enable debug symbols so debugging with gdb
55 # is easier. If optimizations are disabled, we pass -O0 to the compiler.
56 # Otherwise, we use standard optimizations -O2.
57 #
58
59 AM_CFLAGS = \
60         -Wall \
61         -pipe \
62         -fno-common \
63         -ffast-math \
64         -fdiagnostics-show-option \
65         -fno-strict-aliasing \
66         -fvisibility=hidden \
67         -ffunction-sections \
68         -fdata-sections
69 AM_CPPFLAGS = \
70         -include $(top_builddir)/config.h \
71         -I $(srcdir)/src
72 AM_LDFLAGS = \
73         -Wl,--as-needed \
74         -Wl,--gc-sections \
75         -Wl,-z,relro \
76         -Wl,-z,now
77
78 if BUILD_ENABLE_DEBUG
79 AM_CFLAGS += -g
80 endif
81
82 if BUILD_ENABLE_OPTIMIZATIONS
83 AM_CFLAGS += -O2
84 else
85 AM_CFLAGS += -O0
86 endif
87
88 #
89 # SHL - Static Helper Library
90 # The SHL subsystem contains several small code pieces used all over libtsm and
91 # other applications.
92 #
93
94 noinst_LTLIBRARIES += libshl.la
95
96 libshl_la_SOURCES = \
97         src/shl_array.h \
98         src/shl_htable.h \
99         src/shl_htable.c \
100         src/shl_llog.h
101 libshl_la_CPPFLAGS = $(AM_CPPFLAGS)
102 libshl_la_LDFLAGS = $(AM_LDFLAGS)
103 libshl_la_LIBADD = $(AM_LIBADD)
104
105 #
106 # libtsm
107 # Main library build instructions
108 #
109
110 lib_LTLIBRARIES += libtsm.la
111 include_HEADERS += src/libtsm.h
112 pkgconfig_DATA += docs/libtsm.pc
113
114 libtsm_la_SOURCES = \
115         src/libtsm.h \
116         src/libtsm_int.h \
117         src/tsm_unicode.c \
118         src/tsm_screen.c \
119         src/tsm_vte.c \
120         src/tsm_vte_charsets.c \
121         external/wcwidth.h \
122         external/wcwidth.c \
123         external/xkbcommon-keysyms.h
124
125 libtsm_la_CPPFLAGS = $(AM_CPPFLAGS)
126 libtsm_la_LIBADD = libshl.la
127 EXTRA_libtsm_la_DEPENDENCIES = $(top_srcdir)/docs/libtsm.sym
128 libtsm_la_LDFLAGS = \
129         $(AM_LDFLAGS) \
130         -version-info $(LIBTSM_CURRENT):$(LIBTSM_REVISION):$(LIBTSM_AGE) \
131         -Wl,--version-script="$(top_srcdir)/docs/libtsm.sym"
132
133 if BUILD_HAVE_XKBCOMMON
134 libtsm_la_CPPFLAGS += $(XKBCOMMON_CFLAGS)
135 endif
136
137 #
138 # Tests
139 #
140
141 if BUILD_HAVE_CHECK
142 check_PROGRAMS += \
143         test_htable
144 TESTS += \
145         test_htable
146 endif
147
148 test_sources = \
149         test/test_common.h
150 test_libs = \
151         libshl.la \
152         $(CHECK_LIBS)
153 test_cflags = \
154         $(AM_CPPFLAGS) \
155         $(CHECK_CFLAGS)
156 test_lflags = \
157         $(AM_LDFLAGS)
158
159 test_htable_SOURCES = test/test_htable.c $(test_sources)
160 test_htable_CPPFLAGS = $(test_cflags)
161 test_htable_LDADD = $(test_libs)
162 test_htable_LDFLAGS = $(test_lflags)
163
164 #
165 # Phony targets
166 #
167
168 .PHONY: $(TPHONY)
169
170 #
171 # Empty .SECONDARY target causes alle intermediate files to be treated as
172 # secondary files. That is, they don't get deleted after make finished.
173 #
174
175 .SECONDARY: