summaryrefslogtreecommitdiff
path: root/Makefile.am
blob: f2eabf4f67ebe0bef0194d49bfd979eee087b80f (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
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
#
# Kmscon - Global Makefile
# Copyright (c) 2012 David Herrmann <dh.herrmann@googlemail.com>
#

ACLOCAL_AMFLAGS = -I m4
SUBDIRS = \
	.
include_HEADERS =
EXTRA_DIST = \
	README \
	COPYING \
	NEWS
CLEANFILES =
pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA =

#
# Build targets
#
# kmscon: Main kmscon program
# test_output: Test program for the display graphics subsystem
# test_vt: Test program for the VT subsystem
# test_input: Test program for the input subsystem
# libkmscon-core: Static core library for kmscon and test programs
# libkmscon-static: Static library for all subsystems
# genshader: Program used to convert shaders into C-source files
#

bin_PROGRAMS = \
	kmscon \
	fakevt
check_PROGRAMS = \
	test_output \
	test_vt \
	test_input
noinst_PROGRAMS = \
	genshader \
	genunifont
noinst_LTLIBRARIES = \
	libkmscon-core.la \
	libkmscon-static.la
lib_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 as we are not building a
# shared library.
#
# 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
AM_CPPFLAGS = \
	-include $(top_builddir)/config.h \
	-I $(srcdir)/src \
	-I $(srcdir)/external
AM_LDFLAGS = \
	-Wl,--as-needed

if DEBUG
AM_CFLAGS += -g
endif

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

#
# libeloop
# This library contains the whole event-loop implementation of kmscon. It is
# compiled into a separate object to allow using it in several other programs.
#

lib_LTLIBRARIES += \
	libeloop.la

libeloop_la_SOURCES = \
	src/static_llog.h \
	src/static_dlist.h \
	src/static_hook.h \
	src/eloop.h \
	src/eloop.c

if EV_HAVE_DBUS
libeloop_la_SOURCES += \
	external/dbus-common.h \
	external/dbus-loop.h \
	external/dbus-loop.c
endif

libeloop_la_CPPFLAGS = \
	$(AM_CPPFLAGS) \
	$(DBUS_CFLAGS)
libeloop_la_LIBADD = \
	$(DBUS_LIBS)
libeloop_la_LDFLAGS = \
	-version-info 1:0:0

include_HEADERS += \
	src/eloop.h

pkgconfig_DATA += libeloop.pc

#
# libuterm
# The uterm library provides helpers to create terminals in user-space. They
# are not limited to text-based terminals but rather provide graphics contexts
# so arbitrary output can be displayed. Additionally, they provide VT
# abstractions and an input layer
#

lib_LTLIBRARIES += \
	libuterm.la

libuterm_la_SOURCES = \
	src/uterm.h \
	src/uterm_internal.h \
	src/uterm_video.c \
	src/uterm_monitor.c \
	src/uterm_vt.c \
	src/uterm_input.c \
	src/uterm_input_plain.c \
	external/imKStoUCS.h \
	external/imKStoUCS.c

libuterm_la_CPPFLAGS = \
	$(AM_CPPFLAGS) \
	$(SYSTEMD_CFLAGS) \
	$(DRM_CFLAGS) \
	$(EGL_CFLAGS) \
	$(GBM_CFLAGS) \
	$(GLES2_CFLAGS) \
	$(UDEV_CFLAGS) \
	$(XKBCOMMON_CFLAGS)
libuterm_la_LIBADD = \
	$(SYSTEMD_LIBS) \
	$(DRM_LIBS) \
	$(EGL_LIBS) \
	$(GBM_LIBS) \
	$(GLES2_LIBS) \
	$(UDEV_LIBS) \
	$(XKBCOMMON_LIBS) \
	libkmscon-static.la \
	libeloop.la
libuterm_la_LDFLAGS = \
	-version-info 1:0:0

if UTERM_HAVE_FBDEV
libuterm_la_SOURCES += \
	src/uterm_video_fbdev.c
endif

if UTERM_HAVE_DRM
libuterm_la_SOURCES += \
	src/uterm_video_drm.c
endif

if UTERM_HAVE_DUMB
libuterm_la_SOURCES += \
	src/uterm_video_dumb.c
endif

if UTERM_HAVE_XKBCOMMON
libuterm_la_SOURCES += \
	src/uterm_input_uxkb.c
endif

include_HEADERS += \
	src/uterm.h

pkgconfig_DATA += libuterm.pc

#
# Shaders
# As there is no need to modify shaders at run-time, we statically compile them
# into object files. As autotools would ignore them, we need to add them to
# EXTRA_DIST.
# The program that converts the shaders into C-source files is "genshader". It's
# pretty simple and just creates a string with the shader source as content.
#

SHADERS = \
	$(srcdir)/src/static_fill.vert \
	$(srcdir)/src/static_fill.frag \
	$(srcdir)/src/static_blend.vert \
	$(srcdir)/src/static_blend.frag \
	$(srcdir)/src/static_blit.vert \
	$(srcdir)/src/static_blit.frag \
	$(srcdir)/src/static_gltex.vert \
	$(srcdir)/src/static_gltex.frag

EXTRA_DIST += \
	$(SHADERS)
CLEANFILES += \
	src/static_shaders.c

genshader_SOURCES = \
	src/genshader.c

src/static_shaders.c: $(SHADERS) genshader$(EXEEXT)
	./genshader$(EXEEXT) src/static_shaders.c $(SHADERS)

#
# Unifont Generator
# This generates the unifont sources from raw hex-encoded font data.
#

UNIFONT = \
	src/text_font_unifont_data.hex

EXTRA_DIST += \
	$(UNIFONT)
CLEANFILES += \
	src/text_font_unifont_data.c

genunifont_SOURCES = \
	src/genunifont.c

src/text_font_unifont_data.c: $(UNIFONT) genunifont$(EXEEXT)
	./genunifont$(EXEEXT) src/text_font_unifont_data.c $(UNIFONT)

#
# libkmscon-core
# This static library contains all the source files used in kmscon. We build
# them as separate library to allow linking them to the test programs.
# Only "main.c" is not included here as it contains the main() function.
#

libkmscon_core_la_SOURCES = \
	src/main.h \
	src/conf.c src/conf.h \
	src/ui.c src/ui.h \
	src/console.c src/console.h \
	src/unicode.c src/unicode.h \
	src/log.c src/log.h \
	src/vte.c src/vte.h \
	src/vte_charsets.c \
	src/terminal.c src/terminal.h \
	src/pty.c src/pty.h \
	src/text.h \
	src/text.c \
	src/text_font.c
nodist_libkmscon_core_la_SOURCES =

if KMSCON_HAVE_UNIFONT
libkmscon_core_la_SOURCES += \
	src/text_font_unifont.c
nodist_libkmscon_core_la_SOURCES += \
	src/text_font_unifont_data.c
endif

if KMSCON_HAVE_8X16
libkmscon_core_la_SOURCES += \
	src/text_font_8x16.c
endif

if KMSCON_HAVE_FREETYPE2
libkmscon_core_la_SOURCES += \
	src/text_font_freetype2.c
endif

if KMSCON_HAVE_PANGO
libkmscon_core_la_SOURCES += \
	src/text_font_pango.c
endif

if KMSCON_HAVE_BBLIT
libkmscon_core_la_SOURCES += \
	src/text_bblit.c
endif

if KMSCON_HAVE_BBULK
libkmscon_core_la_SOURCES += \
	src/text_bbulk.c
endif

if KMSCON_HAVE_GLES2
libkmscon_core_la_SOURCES += \
	src/text_gltex.c
endif

libkmscon_core_la_CPPFLAGS = \
	$(AM_CPPFLAGS) \
	$(GLES2_CFLAGS) \
	$(PANGO_CFLAGS) \
	$(FREETYPE2_CFLAGS)
libkmscon_core_la_LIBADD = \
	$(GLES2_LIBS) \
	$(PANGO_LIBS) \
	$(FREETYPE2_LIBS) \
	-lpthread \
	libeloop.la \
	libuterm.la

#
# libkmscon-static
# This static library contains all small helpers that are used in several other
# libraries and programs that are part of kmscon. To avoid putting these small
# pieces into a library and thus having to keep backwards compatibility, we
# simply link them statically into all other libraries/programs.
#

libkmscon_static_la_SOURCES = \
	src/static_llog.h \
	src/static_dlist.h \
	src/static_hook.h \
	src/static_misc.h \
	src/static_misc.c \
	external/htable.h \
	external/htable.c
nodist_libkmscon_static_la_SOURCES =

libkmscon_static_la_CPPFLAGS = \
	$(AM_CPPFLAGS) \
	$(GLES2_CFLAGS)

libkmscon_static_la_LIBADD = \
	$(GLES2_LIBS)

if KMSCON_HAVE_GLES2
libkmscon_static_la_SOURCES += \
	src/static_gl.h \
	src/static_gl_math.c \
	src/static_gl_shader.c
nodist_libkmscon_static_la_SOURCES += \
	src/static_shaders.c
endif

#
# Binaries
# These are the sources for the main binaries and test programs. They mostly
# consists of a single source file only and include all the libraries that are
# built as part of kmscon.
#

kmscon_SOURCES = src/main.c
kmscon_LDADD = \
	libuterm.la \
	libeloop.la \
	libkmscon-core.la \
	libkmscon-static.la

test_output_SOURCES = tests/test_output.c tests/test_include.h
test_output_LDADD = libkmscon-core.la

test_vt_SOURCES = tests/test_vt.c
test_vt_LDADD = libkmscon-core.la

test_input_SOURCES = tests/test_input.c
test_input_LDADD = libkmscon-core.la

fakevt_SOURCES = tools/fakevt.c
fakevt_LDADD = libkmscon-core.la