build: add systemd service files to EXTRA_DIST
[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 include_HEADERS =
10 EXTRA_DIST = \
11         README \
12         COPYING \
13         NEWS \
14         docs/kmscon.service \
15         docs/kmscon@.service \
16         docs/getty@.service
17 CLEANFILES =
18 pkgconfigdir = $(libdir)/pkgconfig
19 pkgconfig_DATA =
20 MANPAGES =
21 MANPAGES_ALIASES =
22
23 bin_PROGRAMS =
24 check_PROGRAMS =
25 noinst_PROGRAMS = \
26         genshader \
27         genunifont
28 noinst_LTLIBRARIES =
29 lib_LTLIBRARIES =
30
31 #
32 # Default CFlags
33 # Make all files include "config.h" by default. This shouldn't cause any
34 # problems and we cannot forget to include it anymore.
35 #
36 # Also make the linker discard all unused symbols.
37 #
38 # When compiling in debug mode, we enable debug symbols so debugging with gdb
39 # is easier. If optimizations are disabled, we pass -O0 to the compiler.
40 # Otherwise, we use standard optimizations -O2.
41 #
42
43 AM_CFLAGS = \
44         -Wall
45 AM_CPPFLAGS = \
46         -include $(top_builddir)/config.h \
47         -I $(srcdir)/src
48 AM_LDFLAGS = \
49         -Wl,--as-needed
50
51 if BUILD_ENABLE_DEBUG
52 AM_CFLAGS += -g
53 endif
54
55 if BUILD_ENABLE_OPTIMIZATIONS
56 AM_CFLAGS += -O2
57 else
58 AM_CFLAGS += -O0
59 endif
60
61 #
62 # SHL - Static Helper Library
63 # The SHL subsystem contains several small code pieces used all over kmscon and
64 # other applications.
65 #
66 # Simply include $(SHL_*) in your source-file list. Except for SHL_MISC none of
67 # these have external dependencies. SHL_MISC needs xkbcommon.
68 #
69
70 SHL_DLIST = \
71         src/shl_dlist.h
72 SHL_ARRAY = \
73         src/shl_array.h
74 SHL_HASHTABLE = \
75         src/shl_hashtable.h \
76         external/htable.h \
77         external/htable.c
78 SHL_RING = \
79         src/shl_ring.h
80 SHL_TIMER = \
81         src/shl_timer.h
82 SHL_LLOG = \
83         src/shl_llog.h
84 SHL_HOOK = \
85         src/shl_hook.h \
86         $(SHL_DLIST)
87 SHL_MISC = \
88         src/shl_misc.h
89
90 #
91 # libeloop
92 # This library contains the whole event-loop implementation of kmscon. It is
93 # compiled into a separate object to allow using it in several other programs.
94 #
95
96 if BUILD_ENABLE_ELOOP
97 lib_LTLIBRARIES += libeloop.la
98 include_HEADERS += src/eloop.h
99 pkgconfig_DATA += docs/pc/libeloop.pc
100 endif
101
102 libeloop_la_SOURCES = \
103         $(SHL_DLIST) \
104         $(SHL_LLOG) \
105         $(SHL_HOOK) \
106         src/eloop.h \
107         src/eloop.c
108
109 libeloop_la_CPPFLAGS = \
110         $(AM_CPPFLAGS)
111 libeloop_la_LIBADD =
112 libeloop_la_LDFLAGS = \
113         -version-info 1:0:0
114
115
116 if BUILD_ENABLE_ELOOP_DBUS
117 libeloop_la_SOURCES += \
118         external/dbus-common.h \
119         external/dbus-loop.h \
120         external/dbus-loop.c
121 libeloop_la_CPPFLAGS += \
122         $(DBUS_CFLAGS)
123 libeloop_la_LIBADD += \
124         $(DBUS_LIBS)
125 endif
126
127 #
128 # libtsm
129 # The Terminal-emulator State Machine is a library that implements the whole VTE
130 # layer and everything related to it. It has no external dependencies so it can
131 # be used to implement any kind of terminal emulator or debugger.
132 #
133
134 if BUILD_ENABLE_TSM
135 lib_LTLIBRARIES += \
136         libtsm.la
137 include_HEADERS += \
138         src/tsm_screen.h \
139         src/tsm_unicode.h \
140         src/tsm_vte.h
141 pkgconfig_DATA += \
142         docs/pc/libtsm.pc
143 endif
144
145 libtsm_la_SOURCES = \
146         $(SHL_LLOG) \
147         $(SHL_TIMER) \
148         $(SHL_ARRAY) \
149         $(SHL_HASHTABLE) \
150         src/tsm_screen.h \
151         src/tsm_screen.c \
152         src/tsm_unicode.h \
153         src/tsm_unicode.c \
154         src/tsm_vte.h \
155         src/tsm_vte.c \
156         src/tsm_vte_charsets.c
157
158 libtsm_la_CPPFLAGS = \
159         $(AM_CPPFLAGS) \
160         $(XKBCOMMON_CFLAGS)
161 libtsm_la_LDFLAGS = \
162         $(XKBCOMMON_LIBS) \
163         -version-info 1:0:0
164
165 #
166 # libuterm
167 # The uterm library provides helpers to create terminals in user-space. They
168 # are not limited to text-based terminals but rather provide graphics contexts
169 # so arbitrary output can be displayed. Additionally, they provide VT
170 # abstractions and an input layer
171 #
172
173 if BUILD_ENABLE_UTERM
174 lib_LTLIBRARIES += libuterm.la
175 include_HEADERS += src/uterm.h
176 pkgconfig_DATA += docs/pc/libuterm.pc
177 endif
178
179 libuterm_la_SOURCES = \
180         $(SHL_DLIST) \
181         $(SHL_HOOK) \
182         $(SHL_MISC) \
183         src/uterm.h \
184         src/uterm_input.h \
185         src/uterm_video.h \
186         src/uterm_pci.h \
187         src/uterm_systemd.h \
188         src/uterm_video.c \
189         src/uterm_monitor.c \
190         src/uterm_vt.c \
191         src/uterm_input.c \
192         src/uterm_input_uxkb.c
193
194 nodist_libuterm_la_SOURCES =
195
196 libuterm_la_CPPFLAGS = \
197         $(AM_CPPFLAGS) \
198         $(XKBCOMMON_CFLAGS)
199 libuterm_la_LIBADD =
200         $(XKBCOMMON_LIBS) \
201         libeloop.la
202 libuterm_la_LDFLAGS = \
203         -version-info 1:0:0
204
205 if BUILD_ENABLE_MULTI_SEAT
206 libuterm_la_SOURCES += src/uterm_systemd.c
207 libuterm_la_CPPFLAGS += $(SYSTEMD_CFLAGS)
208 libuterm_la_LIBADD += $(SYSTEMD_LIBS)
209 endif
210
211 if BUILD_ENABLE_HOTPLUG
212 libuterm_la_CPPFLAGS += $(UDEV_CFLAGS)
213 libuterm_la_LIBADD += $(UDEV_LIBS)
214 endif
215
216 if BUILD_ENABLE_PCIACCESS
217 libuterm_la_CPPFLAGS += $(PCIACCESS_CFLAGS)
218 libuterm_la_LIBADD += $(PCIACCESS_LIBS)
219 libuterm_la_SOURCES += src/uterm_pci.c
220 endif
221
222 if BUILD_ENABLE_VIDEO_FBDEV
223 libuterm_la_SOURCES += src/uterm_video_fbdev.c
224 endif
225
226 if BUILD_ENABLE_VIDEO_DUMB
227 libuterm_la_SOURCES += src/uterm_video_dumb.c
228 libuterm_la_CPPFLAGS += $(DRM_CFLAGS)
229 libuterm_la_LIBADD += $(DRM_LIBS)
230 endif
231
232 if BUILD_ENABLE_VIDEO_DRM
233 libuterm_la_SOURCES += \
234         src/uterm_video_drm.c \
235         src/static_gl.h \
236         src/static_gl_math.c \
237         src/static_gl_shader.c
238 nodist_libuterm_la_SOURCES += \
239         src/static_shaders.c
240 libuterm_la_CPPFLAGS += \
241         $(DRM_CFLAGS) \
242         $(EGL_CFLAGS) \
243         $(GBM_CFLAGS) \
244         $(GLES2_CFLAGS)
245 libuterm_la_LIBADD += \
246         $(DRM_LIBS) \
247         $(EGL_LIBS) \
248         $(GBM_LIBS) \
249         $(GLES2_LIBS)
250 endif
251
252 #
253 # Shaders
254 # As there is no need to modify shaders at run-time, we statically compile them
255 # into object files. As autotools would ignore them, we need to add them to
256 # EXTRA_DIST.
257 # The program that converts the shaders into C-source files is "genshader". It's
258 # pretty simple and just creates a string with the shader source as content.
259 #
260
261 SHADERS = \
262         $(srcdir)/src/static_fill.vert \
263         $(srcdir)/src/static_fill.frag \
264         $(srcdir)/src/static_blend.vert \
265         $(srcdir)/src/static_blend.frag \
266         $(srcdir)/src/static_blit.vert \
267         $(srcdir)/src/static_blit.frag \
268         $(srcdir)/src/static_gltex.vert \
269         $(srcdir)/src/static_gltex.frag
270
271 EXTRA_DIST += $(SHADERS)
272 CLEANFILES += src/static_shaders.c
273 genshader_SOURCES = src/genshader.c
274
275 src/static_shaders.c: $(SHADERS) genshader$(EXEEXT)
276         $(AM_V_GEN)./genshader$(EXEEXT) src/static_shaders.c $(SHADERS)
277
278 #
279 # Unifont Generator
280 # This generates the unifont sources from raw hex-encoded font data.
281 #
282
283 UNIFONT = src/text_font_unifont_data.hex
284
285 EXTRA_DIST += $(UNIFONT)
286 CLEANFILES += src/text_font_unifont_data.c
287 genunifont_SOURCES = src/genunifont.c
288
289 src/text_font_unifont_data.c: $(UNIFONT) genunifont$(EXEEXT)
290         $(AM_V_GEN)./genunifont$(EXEEXT) src/text_font_unifont_data.c $(UNIFONT)
291
292 #
293 # Text-font library
294 # The text-font library is used by kmscon _and_ wlterm but is currently linked
295 # statically as it hasn't been cleaned up entirely.
296 # It has a build-time dependency to UTERM and runtime dependencies to TSM.
297 #
298
299 if BUILD_ENABLE_KMSCON
300 noinst_LTLIBRARIES += libtext-font.la
301 else
302 if BUILD_ENABLE_WLTERM
303 noinst_LTLIBRARIES += libtext-font.la
304 endif
305 endif
306
307 libtext_font_la_SOURCES = \
308         $(SHL_DLIST) \
309         $(SHL_HASHTABLE) \
310         $(SHL_HOOK) \
311         src/text.h \
312         src/text_font.c
313 nodist_libtext_font_la_SOURCES =
314
315 libtext_font_la_CPPFLAGS = \
316         $(AM_CPPFLAGS)
317 libtext_font_la_LIBADD = \
318         -lpthread \
319         libtsm.la
320
321 if BUILD_ENABLE_FONT_8X16
322 libtext_font_la_SOURCES += src/text_font_8x16.c
323 endif
324
325 if BUILD_ENABLE_FONT_UNIFONT
326 libtext_font_la_SOURCES += src/text_font_unifont.c
327 nodist_libtext_font_la_SOURCES += src/text_font_unifont_data.c
328 endif
329
330 if BUILD_ENABLE_FONT_FREETYPE2
331 libtext_font_la_SOURCES += src/text_font_freetype2.c
332 libtext_font_la_CPPFLAGS += $(FREETYPE2_CFLAGS)
333 libtext_font_la_LIBADD += $(FREETYPE2_LIBS)
334 endif
335
336 if BUILD_ENABLE_FONT_PANGO
337 libtext_font_la_SOURCES += src/text_font_pango.c
338 libtext_font_la_CPPFLAGS += $(PANGO_CFLAGS)
339 libtext_font_la_LIBADD += $(PANGO_LIBS)
340 endif
341
342 #
343 # Binaries
344 # These are the sources for the main binaries and test programs. They mostly
345 # consists of a single source file only and include all the libraries that are
346 # built as part of kmscon.
347 #
348
349 if BUILD_ENABLE_KMSCON
350 bin_PROGRAMS += kmscon
351 check_PROGRAMS += \
352         test_output \
353         test_vt \
354         test_input \
355         test_key
356 endif
357
358 kmscon_SOURCES = \
359         $(SHL_DLIST) \
360         $(SHL_MISC) \
361         $(SHL_ARRAY) \
362         $(SHL_HASHTABLE) \
363         $(SHL_RING) \
364         $(SHL_TIMER) \
365         $(SHL_HOOK) \
366         src/conf.h \
367         src/conf.c \
368         src/log.h \
369         src/log.c \
370         src/pty.h \
371         src/pty.c \
372         src/text.h \
373         src/text.c \
374         src/kmscon_terminal.h \
375         src/kmscon_dummy.h \
376         src/kmscon_cdev.h \
377         src/kmscon_seat.h \
378         src/kmscon_seat.c \
379         src/kmscon_conf.h \
380         src/kmscon_conf.c \
381         src/kmscon_main.c
382 nodist_kmscon_SOURCES =
383
384 kmscon_CPPFLAGS = \
385         $(AM_CPPFLAGS) \
386         $(XKBCOMMON_CFLAGS)
387 kmscon_LDADD = \
388         $(XKBCOMMON_LIBS) \
389         libeloop.la \
390         libuterm.la \
391         libtext-font.la \
392         -lpthread
393
394 if BUILD_ENABLE_SESSION_DUMMY
395 kmscon_SOURCES += src/kmscon_dummy.c
396 endif
397
398 if BUILD_ENABLE_SESSION_TERMINAL
399 kmscon_SOURCES += src/kmscon_terminal.c
400 kmscon_LDADD += libtsm.la
401 endif
402
403 if BUILD_ENABLE_SESSION_CDEV
404 kmscon_SOURCES += src/kmscon_cdev.c
405 kmscon_CPPFLAGS += $(FUSE_CFLAGS)
406 kmscon_LDADD += $(FUSE_LIBS)
407 endif
408
409 if BUILD_ENABLE_RENDERER_BBLIT
410 kmscon_SOURCES += src/text_bblit.c
411 endif
412
413 if BUILD_ENABLE_RENDERER_BBULK
414 kmscon_SOURCES += src/text_bbulk.c
415 endif
416
417 if BUILD_ENABLE_RENDERER_GLTEX
418 kmscon_SOURCES += \
419         src/text_gltex.c \
420         src/static_gl.h \
421         src/static_gl_math.c \
422         src/static_gl_shader.c
423 nodist_kmscon_SOURCES += src/static_shaders.c
424 kmscon_CPPFLAGS += $(GLES2_CFLAGS)
425 kmscon_LDADD += $(GLES2_LIBS)
426 MANPAGES += docs/man/kmscon.1
427 endif
428
429 #
430 # Wayland Terminal
431 #
432
433 if BUILD_ENABLE_WLTERM
434 bin_PROGRAMS += wlterm
435 endif
436
437 wlterm_SOURCES = \
438         $(SHL_MISC) \
439         $(SHL_ARRAY) \
440         $(SHL_DLIST) \
441         $(SHL_HOOK) \
442         src/wlt_main.h \
443         src/wlt_main.c \
444         src/wlt_toolkit.h \
445         src/wlt_toolkit.c \
446         src/wlt_theme.h \
447         src/wlt_theme.c \
448         src/wlt_terminal.h \
449         src/wlt_terminal.c \
450         src/log.h \
451         src/log.c \
452         src/conf.h \
453         src/conf.c \
454         src/pty.h \
455         src/pty.c
456 wlterm_CPPFLAGS = \
457         $(AM_CPPFLAGS) \
458         $(WAYLAND_CFLAGS) \
459         $(XKBCOMMON_CFLAGS)
460 wlterm_LDADD = \
461         $(WAYLAND_LIBS) \
462         $(XKBCOMMON_LIBS) \
463         libeloop.la \
464         libtsm.la \
465         libtext-font.la \
466         -lpthread
467
468 #
469 # Tests
470 #
471
472 test_sources = \
473         src/log.h \
474         src/log.c \
475         src/conf.h \
476         src/conf.c \
477         tests/test_include.h
478 test_cflags = \
479         $(XKBCOMMON_CFLAGS)
480 test_libs = \
481         $(XKBCOMMON_LIBS) \
482         libeloop.la
483
484 test_output_SOURCES = \
485         $(test_sources) \
486         tests/test_output.c
487 test_output_CPPFLAGS = \
488         $(AM_CPPFLAGS) \
489         $(test_cflags)
490 test_output_LDADD = \
491         $(test_libs) \
492         libuterm.la
493
494 test_vt_SOURCES = \
495         $(test_sources) \
496         tests/test_vt.c
497 test_vt_CPPFLAGS = \
498         $(AM_CPPFLAGS) \
499         $(test_cflags)
500 test_vt_LDADD = \
501         $(test_libs) \
502         libuterm.la
503
504 test_input_SOURCES = \
505         $(test_sources) \
506         tests/test_input.c
507 test_input_CPPFLAGS = \
508         $(AM_CPPFLAGS) \
509         $(test_cflags)
510 test_input_LDADD = \
511         $(test_libs) \
512         libuterm.la
513
514 test_key_SOURCES = \
515         $(test_sources) \
516         tests/test_key.c
517 test_key_CPPFLAGS = \
518         $(AM_CPPFLAGS) \
519         $(test_cflags)
520 test_key_LDADD = \
521         $(test_libs)
522
523 #
524 # Manpages
525 #
526
527 MAN_XML_FILES = ${patsubst %.1,%.xml,${patsubst %.3,%.xml,${patsubst %.5,%.xml,${patsubst %.7,%.xml,$(MANPAGES)}}}}
528 man_MANS =
529 EXTRA_DIST += $(MAN_XML_FILES)
530
531 if BUILD_HAVE_XSLTPROC
532 if BUILD_HAVE_MANPAGES_STYLESHEET
533
534 CLEANFILES += $(MANPAGES) $(MANPAGES_ALIASES)
535 EXTRA_DIST += $(MANPAGES) $(MANPAGES_ALIASES)
536 man_MANS += $(MANPAGES) $(MANPAGES_ALIASES) man_fixup_aliases
537
538 XSLTPROC_FLAGS = \
539         --stringparam man.authors.section.enabled 0 \
540         --stringparam man.copyright.section.enabled 0 \
541         --stringparam funcsynopsis.style ansi \
542         --stringparam man.output.quietly 1 \
543         --nonet
544
545 XSLTPROC_PROCESS_MAN = \
546         $(AM_V_GEN)$(MKDIR_P) $(dir $@) && \
547         $(XSLTPROC) -o $@ $(XSLTPROC_FLAGS) $(BUILD_MANPAGES_STYLESHEET) $<
548
549 man_fixup_aliases: $(MANPAGES) $(MANPAGES_ALIASES)
550         $(AM_V_GEN)if test -n "$(MANPAGES_ALIASES)" ; then $(SED) -i -e 's/^\.so \([a-z_]\+\)\.\([0-9]\)$$/\.so man\2\/\1\.\2/' $(MANPAGES_ALIASES) ; fi
551
552 docs/man/%.1: docs/man/%.xml
553         $(XSLTPROC_PROCESS_MAN)
554
555 docs/man/%.3: docs/man/%.xml
556         $(XSLTPROC_PROCESS_MAN)
557
558 docs/man/%.5: docs/man/%.xml
559         $(XSLTPROC_PROCESS_MAN)
560
561 docs/man/%.7: docs/man/%.xml
562         $(XSLTPROC_PROCESS_MAN)
563
564 endif # BUILD_HAVE_MANPAGES_STYLESHEET
565 endif # BUILD_HAVE_XSLTPROC