d480820204199fefa45435937b2d4b80296f13dc
[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 = 1
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         NEWS \
34         docs/libtsm.pc.in \
35         docs/libtsm.sym
36 CLEANFILES =
37 pkgconfigdir = $(libdir)/pkgconfig
38 pkgconfig_DATA =
39 TPHONY =
40
41 TESTS =
42 check_PROGRAMS =
43 lib_LTLIBRARIES =
44 noinst_LTLIBRARIES =
45
46 #
47 # Default CFlags
48 # Make all files include "config.h" by default. This shouldn't cause any
49 # problems and we cannot forget to include it anymore.
50 #
51 # Also make the linker discard all unused symbols.
52 #
53 # When compiling in debug mode, we enable debug symbols so debugging with gdb
54 # is easier. If optimizations are disabled, we pass -O0 to the compiler.
55 # Otherwise, we use standard optimizations -O2.
56 #
57
58 AM_CFLAGS = \
59         -Wall \
60         -pipe \
61         -fno-common \
62         -ffast-math \
63         -fdiagnostics-show-option \
64         -fno-strict-aliasing \
65         -fvisibility=hidden \
66         -ffunction-sections \
67         -fdata-sections \
68         -fstack-protector
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 += \
112         src/tsm_screen.h \
113         src/tsm_unicode.h \
114         src/tsm_vte.h \
115         src/libtsm.h
116 pkgconfig_DATA += docs/libtsm.pc
117
118 libtsm_la_SOURCES = \
119         src/libtsm.h \
120         src/libtsm_int.h \
121         src/tsm_unicode.h \
122         src/tsm_unicode.c \
123         src/tsm_screen.h \
124         src/tsm_screen.c \
125         src/tsm_vte.h \
126         src/tsm_vte.c \
127         src/tsm_vte_charsets.c \
128         external/wcwidth.h \
129         external/wcwidth.c \
130         external/xkbcommon-keysyms.h
131
132 libtsm_la_CPPFLAGS = $(AM_CPPFLAGS)
133 libtsm_la_LIBADD = libshl.la
134 EXTRA_libtsm_la_DEPENDENCIES = $(top_srcdir)/docs/libtsm.sym
135 libtsm_la_LDFLAGS = \
136         $(AM_LDFLAGS) \
137         -version-info $(LIBTSM_CURRENT):$(LIBTSM_REVISION):$(LIBTSM_AGE) \
138         -Wl,--version-script="$(top_srcdir)/docs/libtsm.sym"
139
140 if BUILD_HAVE_XKBCOMMON
141 libtsm_la_CPPFLAGS += $(XKBCOMMON_CFLAGS)
142 endif
143
144 #
145 # Tests
146 #
147
148 if BUILD_HAVE_CHECK
149 check_PROGRAMS += test_hashtable
150 TESTS += test_hashtable
151 endif
152
153 test_sources = \
154         test/test_common.h
155 test_libs = \
156         libshl.la \
157         $(CHECK_LIBS)
158 test_cflags = \
159         $(AM_CPPFLAGS) \
160         $(CHECK_CFLAGS)
161 test_lflags = \
162         $(AM_LDFLAGS)
163
164 test_hashtable_SOURCES = test/test_hashtable.c $(test_sources)
165 test_hashtable_CPPFLAGS = $(test_cflags)
166 test_hashtable_LDADD = $(test_libs)
167 test_hashtable_LDFLAGS = $(test_lflags)
168
169 #
170 # Phony targets
171 #
172
173 .PHONY: $(TPHONY)
174
175 #
176 # Empty .SECONDARY target causes alle intermediate files to be treated as
177 # secondary files. That is, they don't get deleted after make finished.
178 #
179
180 .SECONDARY: