Move shl_misc.h into libtsm_int.h
[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_hashtable.h \
99         external/htable.h \
100         external/htable.c \
101         src/shl_llog.h
102 libshl_la_CPPFLAGS = $(AM_CPPFLAGS)
103 libshl_la_LDFLAGS = $(AM_LDFLAGS)
104 libshl_la_LIBADD = $(AM_LIBADD)
105
106 #
107 # libtsm
108 # Main library build instructions
109 #
110
111 lib_LTLIBRARIES += libtsm.la
112 include_HEADERS += \
113         src/tsm_screen.h \
114         src/tsm_unicode.h \
115         src/tsm_vte.h \
116         src/libtsm.h
117 pkgconfig_DATA += docs/libtsm.pc
118
119 libtsm_la_SOURCES = \
120         src/libtsm.h \
121         src/libtsm_int.h \
122         src/tsm_unicode.h \
123         src/tsm_unicode.c \
124         src/tsm_screen.h \
125         src/tsm_screen.c \
126         src/tsm_vte.h \
127         src/tsm_vte.c \
128         src/tsm_vte_charsets.c \
129         external/wcwidth.h \
130         external/wcwidth.c \
131         external/xkbcommon-keysyms.h
132
133 libtsm_la_CPPFLAGS = $(AM_CPPFLAGS)
134 libtsm_la_LIBADD = libshl.la
135 EXTRA_libtsm_la_DEPENDENCIES = $(top_srcdir)/docs/libtsm.sym
136 libtsm_la_LDFLAGS = \
137         $(AM_LDFLAGS) \
138         -version-info $(LIBTSM_CURRENT):$(LIBTSM_REVISION):$(LIBTSM_AGE) \
139         -Wl,--version-script="$(top_srcdir)/docs/libtsm.sym"
140
141 if BUILD_HAVE_XKBCOMMON
142 libtsm_la_CPPFLAGS += $(XKBCOMMON_CFLAGS)
143 endif
144
145 #
146 # Tests
147 #
148
149 if BUILD_HAVE_CHECK
150 check_PROGRAMS += test_hashtable
151 TESTS += test_hashtable
152 endif
153
154 test_sources = \
155         test/test_common.h
156 test_libs = \
157         libshl.la \
158         $(CHECK_LIBS)
159 test_cflags = \
160         $(AM_CPPFLAGS) \
161         $(CHECK_CFLAGS)
162 test_lflags = \
163         $(AM_LDFLAGS)
164
165 test_hashtable_SOURCES = test/test_hashtable.c $(test_sources)
166 test_hashtable_CPPFLAGS = $(test_cflags)
167 test_hashtable_LDADD = $(test_libs)
168 test_hashtable_LDFLAGS = $(test_lflags)
169
170 #
171 # Phony targets
172 #
173
174 .PHONY: $(TPHONY)
175
176 #
177 # Empty .SECONDARY target causes alle intermediate files to be treated as
178 # secondary files. That is, they don't get deleted after make finished.
179 #
180
181 .SECONDARY: