Initial import of libtsm
[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 check_PROGRAMS =
42 lib_LTLIBRARIES =
43 noinst_LTLIBRARIES =
44
45 #
46 # Default CFlags
47 # Make all files include "config.h" by default. This shouldn't cause any
48 # problems and we cannot forget to include it anymore.
49 #
50 # Also make the linker discard all unused symbols.
51 #
52 # When compiling in debug mode, we enable debug symbols so debugging with gdb
53 # is easier. If optimizations are disabled, we pass -O0 to the compiler.
54 # Otherwise, we use standard optimizations -O2.
55 #
56
57 AM_CFLAGS = \
58         -Wall \
59         -pipe \
60         -fno-common \
61         -ffast-math \
62         -fdiagnostics-show-option \
63         -fno-strict-aliasing \
64         -fvisibility=hidden \
65         -ffunction-sections \
66         -fdata-sections \
67         -fstack-protector
68 AM_CPPFLAGS = \
69         -include $(top_builddir)/config.h \
70         -I $(srcdir)/src
71 AM_LDFLAGS = \
72         -Wl,--as-needed \
73         -Wl,--gc-sections \
74         -Wl,-z,relro \
75         -Wl,-z,now
76
77 if BUILD_ENABLE_DEBUG
78 AM_CFLAGS += -g
79 endif
80
81 if BUILD_ENABLE_OPTIMIZATIONS
82 AM_CFLAGS += -O2
83 else
84 AM_CFLAGS += -O0
85 endif
86
87 #
88 # SHL - Static Helper Library
89 # The SHL subsystem contains several small code pieces used all over libtsm and
90 # other applications.
91 #
92
93 noinst_LTLIBRARIES += libshl.la
94
95 libshl_la_SOURCES = \
96         src/shl_dlist.h \
97         src/shl_array.h \
98         src/shl_hashtable.h \
99         external/htable.h \
100         external/htable.c \
101         src/shl_timer.h \
102         src/shl_llog.h \
103         src/shl_misc.h
104 libshl_la_CPPFLAGS = $(AM_CPPFLAGS)
105 libshl_la_LDFLAGS = $(AM_LDFLAGS)
106 libshl_la_LIBADD = $(AM_LIBADD)
107
108 #
109 # libtsm
110 # Main library build instructions
111 #
112
113 lib_LTLIBRARIES += libtsm.la
114 include_HEADERS += \
115         src/tsm_screen.h \
116         src/tsm_unicode.h \
117         src/tsm_vte.h \
118         src/tsm.h
119 pkgconfig_DATA += docs/libtsm.pc
120
121 libtsm_la_SOURCES = \
122         src/tsm.h \
123         src/tsm_unicode.h \
124         src/tsm_unicode.c \
125         src/tsm_screen.h \
126         src/tsm_screen.c \
127         src/tsm_vte.h \
128         src/tsm_vte.c \
129         src/tsm_vte_charsets.c \
130         external/wcwidth.h \
131         external/wcwidth.c
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 # Phony targets
147 #
148
149 .PHONY: $(TPHONY)
150
151 #
152 # Empty .SECONDARY target causes alle intermediate files to be treated as
153 # secondary files. That is, they don't get deleted after make finished.
154 #
155
156 .SECONDARY: