static: add gl math helpers
[platform/upstream/kmscon.git] / Makefile.am
1 #
2 # Kmscon - Global Makefile
3 # Copyright (c) 2012 David Herrmann <dh.herrmann@googlemail.com>
4 #
5
6 ACLOCAL_AMFLAGS = -I m4
7 SUBDIRS = \
8         . \
9         docs/reference
10 include_HEADERS =
11 EXTRA_DIST = \
12         README \
13         COPYING \
14         NEWS
15 CLEANFILES =
16
17 #
18 # Build targets
19 #
20 # kmscon: Main kmscon program
21 # test_output: Test program for the display graphics subsystem
22 # test_vt: Test program for the VT subsystem
23 # test_input: Test program for the input subsystem
24 # libkmscon-core: Static core library for kmscon and test programs
25 # libkmscon-static: Static library for all subsystems
26 # genshader: Program used to convert shaders into C-source files
27 #
28
29 bin_PROGRAMS = \
30         kmscon
31 check_PROGRAMS = \
32         test_output \
33         test_vt \
34         test_input
35 noinst_PROGRAMS = \
36         genshader
37 noinst_LTLIBRARIES = \
38         libkmscon-core.la \
39         libkmscon-static.la
40 lib_LTLIBRARIES = \
41         libeloop.la \
42         libuterm.la
43
44 #
45 # Default CFlags
46 # Make all files include "config.h" by default. This shouldn't cause any
47 # problems and we cannot forget to include it anymore.
48 #
49 # Also make the linker discard all unused symbols as we are not building a
50 # shared library.
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 AM_CPPFLAGS = \
60         -include $(top_builddir)/config.h \
61         -I $(srcdir)/src \
62         -I $(srcdir)/external
63 AM_LDFLAGS = \
64         -Wl,--as-needed
65
66 if DEBUG
67 AM_CFLAGS += -g
68 endif
69
70 if OPTIMIZATIONS
71 AM_CFLAGS += -O2
72 else
73 AM_CFLAGS += -O0
74 endif
75
76 #
77 # Shaders
78 # As there is no need to modify shaders at run-time, we statically compile them
79 # into object files. As autotools would ignore them, we need to add them to
80 # EXTRA_DIST.
81 # The program that converts the shaders into C-source files is "genshader". It's
82 # pretty simple and just creates a string with the shader source as content.
83 #
84
85 SHADERS = \
86         src/output_shader_def.vert \
87         src/output_shader_def.frag \
88         src/output_shader_tex.vert \
89         src/output_shader_tex.frag
90
91 EXTRA_DIST += \
92         $(SHADERS)
93 CLEANFILES += \
94         src/static_shaders.c
95
96 nodist_genshader_SOURCES = \
97         src/genshader.c
98
99 src/static_shaders.c: $(SHADERS) genshader$(EXEEXT)
100         ./genshader$(EXEEXT) src/static_shaders.c $(SHADERS)
101
102 #
103 # libkmscon-core
104 # This static library contains all the source files used in kmscon. We build
105 # them as separate library to allow linking them to the test programs.
106 # Only "main.c" is not included here as it contains the main() function.
107 #
108
109 libkmscon_core_la_SOURCES = \
110         src/conf.c src/conf.h \
111         src/ui.c src/ui.h \
112         src/console.c src/console.h \
113         src/unicode.c src/unicode.h \
114         src/log.c src/log.h \
115         src/vte.c src/vte.h \
116         src/vte_charsets.c \
117         src/terminal.c src/terminal.h \
118         src/pty.c src/pty.h \
119         src/text.h \
120         src/text.c \
121         src/text_bblit.c \
122         src/text_font.c
123
124 if KMSCON_HAVE_8X16
125 libkmscon_core_la_SOURCES += \
126         src/text_font_8x16.c
127 endif
128
129 if KMSCON_HAVE_FREETYPE2
130 libkmscon_core_la_SOURCES += \
131         src/text_font_freetype2.c
132 endif
133
134 if KMSCON_HAVE_PANGO
135 libkmscon_core_la_SOURCES += \
136         src/text_font_pango.c
137 endif
138
139 libkmscon_core_la_CPPFLAGS = \
140         $(AM_CPPFLAGS) \
141         $(GLES2_CFLAGS) \
142         $(PANGO_CFLAGS) \
143         $(FREETYPE2_CFLAGS)
144 libkmscon_core_la_LIBADD = \
145         $(GLES2_LIBS) \
146         $(PANGO_LIBS) \
147         $(FREETYPE2_LIBS) \
148         -lpthread \
149         libeloop.la \
150         libuterm.la
151
152 #
153 # libuterm
154 # The uterm library provides helpers to creater terminals in user-space. They
155 # are not limited to text-based terminals but rather provide graphics contexts
156 # so arbitrary output can be displayed. Additionally, they provide VT
157 # abstractions and an input layer
158 #
159
160 libuterm_la_SOURCES = \
161         src/uterm.h \
162         src/uterm_internal.h \
163         src/uterm_video.c \
164         src/uterm_monitor.c \
165         src/uterm_input.c \
166         src/uterm_input_plain.c \
167         external/imKStoUCS.h \
168         external/imKStoUCS.c \
169         src/uterm_vt.c \
170         src/vt.h \
171         src/vt.c
172
173 libuterm_la_CPPFLAGS = \
174         $(AM_CPPFLAGS) \
175         $(SYSTEMD_CFLAGS) \
176         $(DRM_CFLAGS) \
177         $(EGL_CFLAGS) \
178         $(GBM_CFLAGS) \
179         $(GLES2_CFLAGS) \
180         $(UDEV_CFLAGS) \
181         $(XKBCOMMON_CFLAGS)
182 libuterm_la_LIBADD = \
183         $(SYSTEMD_LIBS) \
184         $(DRM_LIBS) \
185         $(EGL_LIBS) \
186         $(GBM_LIBS) \
187         $(GLES2_LIBS) \
188         $(UDEV_LIBS) \
189         $(XKBCOMMON_LIBS) \
190         libkmscon-static.la \
191         libeloop.la
192 libuterm_la_LDFLAGS = \
193         -version-info 1:0:0
194
195 if UTERM_HAVE_FBDEV
196 libuterm_la_SOURCES += \
197         src/uterm_video_fbdev.c
198 endif
199
200 if UTERM_HAVE_DRM
201 libuterm_la_SOURCES += \
202         src/uterm_video_drm.c
203 endif
204
205 if UTERM_HAVE_DUMB
206 libuterm_la_SOURCES += \
207         src/uterm_video_dumb.c
208 endif
209
210 if UTERM_HAVE_XKBCOMMON
211 libuterm_la_SOURCES += \
212         src/uterm_input_uxkb.c
213 endif
214
215 include_HEADERS += \
216         src/uterm.h
217
218 #
219 # libeloop
220 # This library contains the whole event-loop implementation of kmscon. It is
221 # compiled into a separate object to allow using it in several other programs.
222 #
223
224 libeloop_la_SOURCES = \
225         src/eloop.h \
226         src/eloop.c
227
228 if EV_HAVE_DBUS
229 libeloop_la_SOURCES += \
230         external/dbus-loop.h \
231         external/dbus-loop.c
232 endif
233
234 libeloop_la_CPPFLAGS = \
235         $(AM_CPPFLAGS) \
236         $(DBUS_CFLAGS)
237 libeloop_la_LIBADD = \
238         libkmscon-static.la \
239         $(DBUS_LIBS)
240 libeloop_la_LDFLAGS = \
241         -version-info 1:0:0
242
243 include_HEADERS += \
244         src/eloop.h
245
246 #
247 # libkmscon-static
248 # This static library contains all small helpers that are used in several other
249 # libraries and programs that are part of kmscon. To avoid putting these small
250 # pieces into a library and thus having to keep backwards compatibility, we
251 # simply link them statically into all other libraries/programs.
252 #
253
254 libkmscon_static_la_SOURCES = \
255         src/static_llog.h \
256         src/static_misc.h \
257         src/static_misc.c \
258         external/htable.h \
259         external/htable.c
260
261 if KMSCON_HAVE_GLES2
262 nodist_libkmscon_static_la_SOURCES = \
263         src/static_gl.h \
264         src/static_gl_math.c \
265         src/static_shaders.c
266 endif
267
268 #
269 # Binaries
270 # These are the sources for the main binaries and test programs. They mostly
271 # consists of a single source file only and include all the libraries that are
272 # built as part of kmscon.
273 #
274
275 kmscon_SOURCES = src/main.c
276 kmscon_LDADD = \
277         libuterm.la \
278         libeloop.la \
279         libkmscon-core.la \
280         libkmscon-static.la
281
282 test_output_SOURCES = tests/test_output.c tests/test_include.h
283 test_output_LDADD = libkmscon-core.la
284
285 test_vt_SOURCES = tests/test_vt.c
286 test_vt_LDADD = libkmscon-core.la
287
288 test_input_SOURCES = tests/test_input.c
289 test_input_LDADD = libkmscon-core.la