summaryrefslogtreecommitdiff
path: root/Makefile.am
blob: e6dfdb7129db3e732a1f317108a1a7f4986a2878 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
#
# libtsm - Global Makefile
# Copyright (c) 2012-2013 David Herrmann <dh.herrmann@gmail.com>
#

#
# Library Version Numbers
#

LIBTSM_CURRENT = 1
LIBTSM_REVISION = 0
LIBTSM_AGE = 0

#
# Global Configurations and Initializations
#

ACLOCAL_AMFLAGS = -I m4 ${ACLOCAL_FLAGS}
AM_MAKEFLAGS = --no-print-directory
AUTOMAKE_OPTIONS = color-tests
AM_DISTCHECK_CONFIGURE_FLAGS = \
	--enable-debug \
	--enable-optimizations

SUBDIRS = .

.DELETE_ON_ERROR:

include_HEADERS =
EXTRA_DIST = \
	README \
	COPYING \
	NEWS \
	docs/libtsm.pc.in \
	docs/libtsm.sym
CLEANFILES =
pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA =
TPHONY =

TESTS =
check_PROGRAMS =
lib_LTLIBRARIES =
noinst_LTLIBRARIES =

#
# Default CFlags
# Make all files include "config.h" by default. This shouldn't cause any
# problems and we cannot forget to include it anymore.
#
# Also make the linker discard all unused symbols.
#
# When compiling in debug mode, we enable debug symbols so debugging with gdb
# is easier. If optimizations are disabled, we pass -O0 to the compiler.
# Otherwise, we use standard optimizations -O2.
#

AM_CFLAGS = \
	-Wall \
	-pipe \
	-fno-common \
	-ffast-math \
	-fdiagnostics-show-option \
	-fno-strict-aliasing \
	-fvisibility=hidden \
	-ffunction-sections \
	-fdata-sections \
	-fstack-protector
AM_CPPFLAGS = \
	-include $(top_builddir)/config.h \
	-I $(srcdir)/src
AM_LDFLAGS = \
	-Wl,--as-needed \
	-Wl,--gc-sections \
	-Wl,-z,relro \
	-Wl,-z,now

if BUILD_ENABLE_DEBUG
AM_CFLAGS += -g
endif

if BUILD_ENABLE_OPTIMIZATIONS
AM_CFLAGS += -O2
else
AM_CFLAGS += -O0
endif

#
# SHL - Static Helper Library
# The SHL subsystem contains several small code pieces used all over libtsm and
# other applications.
#

noinst_LTLIBRARIES += libshl.la

libshl_la_SOURCES = \
	src/shl_array.h \
	src/shl_hashtable.h \
	external/htable.h \
	external/htable.c \
	src/shl_llog.h
libshl_la_CPPFLAGS = $(AM_CPPFLAGS)
libshl_la_LDFLAGS = $(AM_LDFLAGS)
libshl_la_LIBADD = $(AM_LIBADD)

#
# libtsm
# Main library build instructions
#

lib_LTLIBRARIES += libtsm.la
include_HEADERS += \
	src/tsm_screen.h \
	src/tsm_unicode.h \
	src/tsm_vte.h \
	src/libtsm.h
pkgconfig_DATA += docs/libtsm.pc

libtsm_la_SOURCES = \
	src/libtsm.h \
	src/libtsm_int.h \
	src/tsm_unicode.h \
	src/tsm_unicode.c \
	src/tsm_screen.h \
	src/tsm_screen.c \
	src/tsm_vte.h \
	src/tsm_vte.c \
	src/tsm_vte_charsets.c \
	external/wcwidth.h \
	external/wcwidth.c \
	external/xkbcommon-keysyms.h

libtsm_la_CPPFLAGS = $(AM_CPPFLAGS)
libtsm_la_LIBADD = libshl.la
EXTRA_libtsm_la_DEPENDENCIES = $(top_srcdir)/docs/libtsm.sym
libtsm_la_LDFLAGS = \
	$(AM_LDFLAGS) \
	-version-info $(LIBTSM_CURRENT):$(LIBTSM_REVISION):$(LIBTSM_AGE) \
	-Wl,--version-script="$(top_srcdir)/docs/libtsm.sym"

if BUILD_HAVE_XKBCOMMON
libtsm_la_CPPFLAGS += $(XKBCOMMON_CFLAGS)
endif

#
# Tests
#

if BUILD_HAVE_CHECK
check_PROGRAMS += test_hashtable
TESTS += test_hashtable
endif

test_sources = \
	test/test_common.h
test_libs = \
	libshl.la \
	$(CHECK_LIBS)
test_cflags = \
	$(AM_CPPFLAGS) \
	$(CHECK_CFLAGS)
test_lflags = \
	$(AM_LDFLAGS)

test_hashtable_SOURCES = test/test_hashtable.c $(test_sources)
test_hashtable_CPPFLAGS = $(test_cflags)
test_hashtable_LDADD = $(test_libs)
test_hashtable_LDFLAGS = $(test_lflags)

#
# Phony targets
#

.PHONY: $(TPHONY)

#
# Empty .SECONDARY target causes alle intermediate files to be treated as
# secondary files. That is, they don't get deleted after make finished.
#

.SECONDARY: