uterm: remove unused pciaccess 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 include_HEADERS =
10 EXTRA_DIST = \
11         README \
12         COPYING \
13         NEWS \
14         docs/kmscon.service \
15         docs/kmsconvt@.service
16 CLEANFILES =
17 pkgconfigdir = $(libdir)/pkgconfig
18 pkgconfig_DATA =
19 MANPAGES =
20 MANPAGES_ALIASES =
21 TPHONY =
22
23 bin_PROGRAMS =
24 check_PROGRAMS =
25 noinst_PROGRAMS = \
26         genshader \
27         genunifont
28 noinst_LTLIBRARIES =
29 lib_LTLIBRARIES =
30
31 moduledir = @libdir@/kmscon
32 module_LTLIBRARIES =
33
34 #
35 # Default CFlags
36 # Make all files include "config.h" by default. This shouldn't cause any
37 # problems and we cannot forget to include it anymore.
38 #
39 # Also make the linker discard all unused symbols.
40 #
41 # When compiling in debug mode, we enable debug symbols so debugging with gdb
42 # is easier. If optimizations are disabled, we pass -O0 to the compiler.
43 # Otherwise, we use standard optimizations -O2.
44 #
45
46 AM_CFLAGS = \
47         -Wall
48 AM_CPPFLAGS = \
49         -DBUILD_MODULE_DIR='"$(moduledir)"' \
50         -include $(top_builddir)/config.h \
51         -I $(srcdir)/src
52 AM_LDFLAGS = \
53         -Wl,--as-needed
54
55 if BUILD_ENABLE_DEBUG
56 AM_CFLAGS += -g
57 endif
58
59 if BUILD_ENABLE_OPTIMIZATIONS
60 AM_CFLAGS += -O2
61 else
62 AM_CFLAGS += -O0
63 endif
64
65 #
66 # SHL - Static Helper Library
67 # The SHL subsystem contains several small code pieces used all over kmscon and
68 # other applications.
69 #
70 # Simply include $(SHL_*) in your source-file list.
71 # SHL_MISC needs xkbcommon
72 # SHL_REGISTER needs pthread
73 #
74
75 SHL_DLIST = \
76         src/shl_dlist.h
77 SHL_ARRAY = \
78         src/shl_array.h
79 SHL_HASHTABLE = \
80         src/shl_hashtable.h \
81         external/htable.h \
82         external/htable.c
83 SHL_RING = \
84         src/shl_ring.h
85 SHL_TIMER = \
86         src/shl_timer.h
87 SHL_LLOG = \
88         src/shl_llog.h
89 SHL_HOOK = \
90         src/shl_hook.h \
91         $(SHL_DLIST)
92 SHL_MISC = \
93         src/shl_misc.h
94 SHL_REGISTER = \
95         src/shl_register.h \
96         $(SHL_DLIST)
97
98 #
99 # GIT-HEAD helper
100 # The file ./src/githead.h contains a constant BUILD_GIT_HEAD which is defined
101 # to the string returned by "git describe". We need to adjust this string for
102 # every build and correctly rebuild any sources that depend on it. Therefore,
103 # you should use this file rarely as it causes rebuilds on every git-commit.
104 #
105 # We have a helper-script ./src/genversion.sh that takes as argument the header
106 # file and creates it if necessary. It updates it only if the new git-describe
107 # string is different to the old one. So the file is only modified on changes.
108 # Hence, we can use it as normal dependency in this Makefile.
109 # However, we need to run this script on _every_ "make" invocation before any
110 # recipy is executed. To achieve this, we use $(shell ...) and assign it to a
111 # "simply expanded" variable (:=) so the shell command is executed on
112 # variable-declaration and not during expansion.
113 #
114 # Note that we must not clean ./src/githead.h ever! If we would, a distribution
115 # tarball might delete that file and have no way to recreate it.
116 # We could delete it on something like "make maintainerclean", but then again,
117 # it seems unnecessary so lets simply not clean it at all.
118 #
119 # If the helper-script is executed in a directory that is not a git-repository
120 # (like a distribution tarball) and githead.h exists, then it does nothing as it
121 # expects githead.h to be correctly written by "make dist".
122 # However, if githead.h does not exist, it will print a warning and write
123 # "<unknown>" as git-revision.
124 # This guarantees, that githead.h is always present and has the most correct
125 # value that we can get under any conditions.
126 #
127 # The $(emptyvariable) expansion below is used for broken $(shell ...)
128 # syntax-highlighting algorithms in many existing editors.
129 #
130
131 EXTRA_DIST += src/genversion.sh
132 GITHEAD:=$(shell $(emptyvariable)"$(srcdir)/src/genversion.sh" "$(srcdir)/src/githead.h")
133
134 #
135 # libeloop
136 # This library contains the whole event-loop implementation of kmscon. It is
137 # compiled into a separate object to allow using it in several other programs.
138 #
139
140 if BUILD_ENABLE_ELOOP
141 lib_LTLIBRARIES += libeloop.la
142 include_HEADERS += src/eloop.h
143 pkgconfig_DATA += docs/pc/libeloop.pc
144 endif
145
146 libeloop_la_SOURCES = \
147         $(SHL_DLIST) \
148         $(SHL_LLOG) \
149         $(SHL_HOOK) \
150         src/eloop.h \
151         src/eloop.c
152
153 libeloop_la_CPPFLAGS = \
154         $(AM_CPPFLAGS)
155 libeloop_la_LIBADD =
156 libeloop_la_LDFLAGS = \
157         -version-info 1:0:0
158
159
160 if BUILD_ENABLE_ELOOP_DBUS
161 libeloop_la_SOURCES += \
162         external/dbus-common.h \
163         external/dbus-loop.h \
164         external/dbus-loop.c
165 libeloop_la_CPPFLAGS += \
166         $(DBUS_CFLAGS)
167 libeloop_la_LIBADD += \
168         $(DBUS_LIBS)
169 endif
170
171 #
172 # libtsm
173 # The Terminal-emulator State Machine is a library that implements the whole VTE
174 # layer and everything related to it. It has no external dependencies so it can
175 # be used to implement any kind of terminal emulator or debugger.
176 #
177
178 if BUILD_ENABLE_TSM
179 lib_LTLIBRARIES += \
180         libtsm.la
181 include_HEADERS += \
182         src/tsm_screen.h \
183         src/tsm_unicode.h \
184         src/tsm_vte.h
185 pkgconfig_DATA += \
186         docs/pc/libtsm.pc
187 endif
188
189 libtsm_la_SOURCES = \
190         $(SHL_LLOG) \
191         $(SHL_TIMER) \
192         $(SHL_ARRAY) \
193         $(SHL_HASHTABLE) \
194         src/tsm_screen.h \
195         src/tsm_screen.c \
196         src/tsm_unicode.h \
197         src/tsm_unicode.c \
198         src/tsm_vte.h \
199         src/tsm_vte.c \
200         src/tsm_vte_charsets.c \
201         external/wcwidth.h \
202         external/wcwidth.c
203
204 libtsm_la_CPPFLAGS = \
205         $(AM_CPPFLAGS) \
206         $(XKBCOMMON_CFLAGS)
207 libtsm_la_LDFLAGS = \
208         $(XKBCOMMON_LIBS) \
209         -version-info 1:0:0
210
211 #
212 # libuterm
213 # The uterm library provides helpers to create terminals in user-space. They
214 # are not limited to text-based terminals but rather provide graphics contexts
215 # so arbitrary output can be displayed. Additionally, they provide VT
216 # abstractions and an input layer
217 #
218
219 if BUILD_ENABLE_UTERM
220 lib_LTLIBRARIES += libuterm.la
221 include_HEADERS += src/uterm.h
222 pkgconfig_DATA += docs/pc/libuterm.pc
223 endif
224
225 libuterm_la_SOURCES = \
226         $(SHL_DLIST) \
227         $(SHL_HOOK) \
228         $(SHL_MISC) \
229         src/uterm.h \
230         src/uterm_input_internal.h \
231         src/uterm_video_internal.h \
232         src/uterm_systemd_internal.h \
233         src/uterm_video.c \
234         src/uterm_monitor.c \
235         src/uterm_vt.c \
236         src/uterm_input.c \
237         src/uterm_input_uxkb.c
238
239 nodist_libuterm_la_SOURCES =
240
241 libuterm_la_CPPFLAGS = \
242         $(AM_CPPFLAGS) \
243         $(XKBCOMMON_CFLAGS)
244 libuterm_la_LIBADD = \
245         $(XKBCOMMON_LIBS) \
246         libeloop.la
247 libuterm_la_LDFLAGS = \
248         -version-info 1:0:0
249
250 if BUILD_ENABLE_MULTI_SEAT
251 libuterm_la_SOURCES += src/uterm_systemd.c
252 libuterm_la_CPPFLAGS += $(SYSTEMD_CFLAGS)
253 libuterm_la_LIBADD += $(SYSTEMD_LIBS)
254 endif
255
256 if BUILD_ENABLE_HOTPLUG
257 libuterm_la_CPPFLAGS += $(UDEV_CFLAGS)
258 libuterm_la_LIBADD += $(UDEV_LIBS)
259 endif
260
261 if BUILD_ENABLE_VIDEO_FBDEV
262 libuterm_la_SOURCES += src/uterm_video_fbdev.c
263 endif
264
265 if BUILD_ENABLE_VIDEO_DUMB
266 libuterm_la_SOURCES += src/uterm_video_dumb.c
267 libuterm_la_CPPFLAGS += $(DRM_CFLAGS)
268 libuterm_la_LIBADD += $(DRM_LIBS)
269 endif
270
271 if BUILD_ENABLE_VIDEO_DRM
272 libuterm_la_SOURCES += \
273         src/uterm_video_drm.c \
274         src/static_gl.h \
275         src/static_gl_math.c \
276         src/static_gl_shader.c
277 nodist_libuterm_la_SOURCES += \
278         src/static_shaders.c
279 libuterm_la_CPPFLAGS += \
280         $(DRM_CFLAGS) \
281         $(EGL_CFLAGS) \
282         $(GBM_CFLAGS) \
283         $(GLES2_CFLAGS)
284 libuterm_la_LIBADD += \
285         $(DRM_LIBS) \
286         $(EGL_LIBS) \
287         $(GBM_LIBS) \
288         $(GLES2_LIBS)
289 endif
290
291 #
292 # Shaders
293 # As there is no need to modify shaders at run-time, we statically compile them
294 # into object files. As autotools would ignore them, we need to add them to
295 # EXTRA_DIST.
296 # The program that converts the shaders into C-source files is "genshader". It's
297 # pretty simple and just creates a string with the shader source as content.
298 #
299
300 SHADERS = \
301         $(srcdir)/src/static_fill.vert \
302         $(srcdir)/src/static_fill.frag \
303         $(srcdir)/src/static_blend.vert \
304         $(srcdir)/src/static_blend.frag \
305         $(srcdir)/src/static_blit.vert \
306         $(srcdir)/src/static_blit.frag \
307         $(srcdir)/src/static_gltex.vert \
308         $(srcdir)/src/static_gltex.frag
309
310 EXTRA_DIST += $(SHADERS)
311 CLEANFILES += src/static_shaders.c
312 genshader_SOURCES = src/genshader.c
313
314 src/static_shaders.c: $(SHADERS) genshader$(EXEEXT)
315         $(AM_V_GEN)./genshader$(EXEEXT) src/static_shaders.c $(SHADERS)
316
317 #
318 # Unifont Generator
319 # This generates the unifont sources from raw hex-encoded font data.
320 #
321
322 UNIFONT = src/font_unifont_data.hex
323
324 EXTRA_DIST += $(UNIFONT)
325 CLEANFILES += src/font_unifont_data.c
326 genunifont_SOURCES = src/genunifont.c
327
328 src/font_unifont_data.c: $(UNIFONT) genunifont$(EXEEXT)
329         $(AM_V_GEN)./genunifont$(EXEEXT) src/font_unifont_data.c $(UNIFONT)
330
331 #
332 # Kmscon Modules
333 #
334
335 if BUILD_ENABLE_FONT_UNIFONT
336 module_LTLIBRARIES += mod-unifont.la
337 endif
338
339 mod_unifont_la_SOURCES = \
340         src/kmscon_module_interface.h \
341         src/githead.h \
342         src/font_unifont.c \
343         src/kmscon_mod_unifont.c
344 nodist_mod_unifont_la_SOURCES = \
345         src/font_unifont_data.c
346 mod_unifont_la_LDFLAGS = \
347         -module \
348         -avoid-version
349
350 if BUILD_ENABLE_FONT_FREETYPE2
351 module_LTLIBRARIES += mod-freetype2.la
352 endif
353
354 mod_freetype2_la_SOURCES = \
355         $(SHL_DLIST) \
356         $(SHL_HASHTABLE) \
357         src/kmscon_module_interface.h \
358         src/githead.h \
359         src/font_freetype2.c \
360         src/kmscon_mod_freetype2.c
361 mod_freetype2_la_CPPFLAGS = \
362         $(AM_CPPFLAGS) \
363         $(FREETYPE2_CFLAGS)
364 mod_freetype2_la_LIBADD = \
365         $(FREETYPE2_LIBS) \
366         -lpthread \
367         libtsm.la
368 mod_freetype2_la_LDFLAGS = \
369         -module \
370         -avoid-version
371
372 if BUILD_ENABLE_FONT_PANGO
373 module_LTLIBRARIES += mod-pango.la
374 endif
375
376 mod_pango_la_SOURCES = \
377         $(SHL_DLIST) \
378         $(SHL_HASHTABLE) \
379         src/kmscon_module_interface.h \
380         src/githead.h \
381         src/font_pango.c \
382         src/kmscon_mod_pango.c
383 mod_pango_la_CPPFLAGS = \
384         $(AM_CPPFLAGS) \
385         $(PANGO_CFLAGS)
386 mod_pango_la_LIBADD = \
387         $(PANGO_LIBS) \
388         -lpthread \
389         libtsm.la
390 mod_pango_la_LDFLAGS = \
391         -module \
392         -avoid-version
393
394 if BUILD_ENABLE_RENDERER_BBULK
395 module_LTLIBRARIES += mod-bbulk.la
396 endif
397
398 mod_bbulk_la_SOURCES = \
399         src/kmscon_module_interface.h \
400         src/githead.h \
401         src/text_bbulk.c \
402         src/kmscon_mod_bbulk.c
403 mod_bbulk_la_LDFLAGS = \
404         -module \
405         -avoid-version
406
407 if BUILD_ENABLE_RENDERER_GLTEX
408 module_LTLIBRARIES += mod-gltex.la
409 endif
410
411 mod_gltex_la_SOURCES = \
412         src/kmscon_module_interface.h \
413         src/githead.h \
414         src/text_gltex.c \
415         src/static_gl.h \
416         src/static_gl_math.c \
417         src/static_gl_shader.c \
418         src/kmscon_mod_gltex.c
419 nodist_mod_gltex_la_SOURCES = \
420         src/static_shaders.c
421 mod_gltex_la_CPPFLAGS = \
422         $(AM_CPPFLAGS) \
423         $(GLES2_CFLAGS)
424 mod_gltex_la_LIBADD = \
425         $(GLES2_LIBS)
426 mod_gltex_la_LDFLAGS = \
427         -module \
428         -avoid-version
429
430 #
431 # Binaries
432 # These are the sources for the main binaries and test programs. They mostly
433 # consists of a single source file only and include all the libraries that are
434 # built as part of kmscon.
435 #
436
437 if BUILD_ENABLE_KMSCON
438 bin_PROGRAMS += kmscon
439 check_PROGRAMS += \
440         test_output \
441         test_vt \
442         test_input \
443         test_key
444 MANPAGES += docs/man/kmscon.1
445 endif
446
447 kmscon_SOURCES = \
448         $(SHL_DLIST) \
449         $(SHL_MISC) \
450         $(SHL_ARRAY) \
451         $(SHL_HASHTABLE) \
452         $(SHL_RING) \
453         $(SHL_TIMER) \
454         $(SHL_HOOK) \
455         $(SHL_REGISTER) \
456         src/githead.h \
457         src/conf.h \
458         src/conf.c \
459         src/log.h \
460         src/log.c \
461         src/pty.h \
462         src/pty.c \
463         src/font.h \
464         src/font.c \
465         src/font_8x16.c \
466         src/text.h \
467         src/text.c \
468         src/text_bblit.c \
469         src/kmscon_module_interface.h \
470         src/kmscon_module.h \
471         src/kmscon_module.c \
472         src/kmscon_terminal.h \
473         src/kmscon_dummy.h \
474         src/kmscon_cdev.h \
475         src/kmscon_seat.h \
476         src/kmscon_seat.c \
477         src/kmscon_conf.h \
478         src/kmscon_conf.c \
479         src/kmscon_main.c
480 nodist_kmscon_SOURCES =
481
482 kmscon_CPPFLAGS = \
483         $(AM_CPPFLAGS) \
484         $(XKBCOMMON_CFLAGS)
485 kmscon_LDADD = \
486         $(XKBCOMMON_LIBS) \
487         libeloop.la \
488         libuterm.la \
489         -lpthread
490 kmscon_LDFLAGS = \
491         -rdynamic
492
493 if BUILD_ENABLE_SESSION_DUMMY
494 kmscon_SOURCES += src/kmscon_dummy.c
495 endif
496
497 if BUILD_ENABLE_SESSION_TERMINAL
498 kmscon_SOURCES += src/kmscon_terminal.c
499 kmscon_LDADD += libtsm.la
500 endif
501
502 if BUILD_ENABLE_SESSION_CDEV
503 kmscon_SOURCES += src/kmscon_cdev.c
504 kmscon_CPPFLAGS += $(FUSE_CFLAGS)
505 kmscon_LDADD += $(FUSE_LIBS)
506 endif
507
508 #
509 # Wayland Terminal
510 #
511
512 if BUILD_ENABLE_WLTERM
513 bin_PROGRAMS += wlterm
514 endif
515
516 wlterm_SOURCES = \
517         $(SHL_MISC) \
518         $(SHL_ARRAY) \
519         $(SHL_DLIST) \
520         $(SHL_HOOK) \
521         src/wlt_main.h \
522         src/wlt_main.c \
523         src/wlt_toolkit.h \
524         src/wlt_toolkit.c \
525         src/wlt_theme.h \
526         src/wlt_theme.c \
527         src/wlt_terminal.h \
528         src/wlt_terminal.c \
529         src/log.h \
530         src/log.c \
531         src/conf.h \
532         src/conf.c \
533         src/pty.h \
534         src/pty.c
535 wlterm_CPPFLAGS = \
536         $(AM_CPPFLAGS) \
537         $(WAYLAND_CFLAGS) \
538         $(XKBCOMMON_CFLAGS)
539 wlterm_LDADD = \
540         $(WAYLAND_LIBS) \
541         $(XKBCOMMON_LIBS) \
542         libeloop.la \
543         libtsm.la \
544         -lpthread
545
546 #
547 # Tests
548 #
549
550 test_sources = \
551         src/log.h \
552         src/log.c \
553         src/conf.h \
554         src/conf.c \
555         tests/test_include.h
556 test_cflags = \
557         $(XKBCOMMON_CFLAGS)
558 test_libs = \
559         $(XKBCOMMON_LIBS) \
560         libeloop.la
561
562 test_output_SOURCES = \
563         $(test_sources) \
564         tests/test_output.c
565 test_output_CPPFLAGS = \
566         $(AM_CPPFLAGS) \
567         $(test_cflags)
568 test_output_LDADD = \
569         $(test_libs) \
570         libuterm.la
571
572 test_vt_SOURCES = \
573         $(test_sources) \
574         tests/test_vt.c
575 test_vt_CPPFLAGS = \
576         $(AM_CPPFLAGS) \
577         $(test_cflags)
578 test_vt_LDADD = \
579         $(test_libs) \
580         libuterm.la
581
582 test_input_SOURCES = \
583         $(test_sources) \
584         tests/test_input.c
585 test_input_CPPFLAGS = \
586         $(AM_CPPFLAGS) \
587         $(test_cflags)
588 test_input_LDADD = \
589         $(test_libs) \
590         libuterm.la
591
592 test_key_SOURCES = \
593         $(test_sources) \
594         tests/test_key.c
595 test_key_CPPFLAGS = \
596         $(AM_CPPFLAGS) \
597         $(test_cflags)
598 test_key_LDADD = \
599         $(test_libs)
600
601 #
602 # Manpages
603 #
604
605 man_MANS =
606 EXTRA_DIST += ${patsubst %.1,%.xml,${patsubst %.3,%.xml,${patsubst %.5,%.xml,${patsubst %.7,%.xml,$(MANPAGES)}}}}
607 CLEANFILES += $(MANPAGES) $(MANPAGES_ALIASES) .man_fixup
608
609 if BUILD_HAVE_XSLTPROC
610 if BUILD_HAVE_MANPAGES_STYLESHEET
611
612 man_MANS += $(MANPAGES) $(MANPAGES_ALIASES)
613
614 XSLTPROC_FLAGS = \
615         --stringparam man.authors.section.enabled 0 \
616         --stringparam man.copyright.section.enabled 0 \
617         --stringparam funcsynopsis.style ansi \
618         --stringparam man.output.quietly 1 \
619         --nonet
620
621 XSLTPROC_PROCESS_MAN = \
622         $(AM_V_GEN)$(MKDIR_P) $(dir $@) && \
623         $(XSLTPROC) -o "$@" $(XSLTPROC_FLAGS) $(BUILD_MANPAGES_STYLESHEET) "$<" && \
624         touch .man_fixup
625
626 # Force .man_fixup if $(MANPAGES) are not built
627 .man_fixup: | $(MANPAGES)
628         @touch .man_fixup
629
630 $(MANPAGES_ALIASES): $(MANPAGES) .man_fixup
631         $(AM_V_GEN)if test -n "$@" ; then $(SED) -i -e 's/^\.so \([a-z_]\+\)\.\([0-9]\)$$/\.so man\2\/\1\.\2/' "$@" ; fi
632
633 docs/man/%.1: docs/man/%.xml
634         $(XSLTPROC_PROCESS_MAN)
635
636 docs/man/%.3: docs/man/%.xml
637         $(XSLTPROC_PROCESS_MAN)
638
639 docs/man/%.5: docs/man/%.xml
640         $(XSLTPROC_PROCESS_MAN)
641
642 docs/man/%.7: docs/man/%.xml
643         $(XSLTPROC_PROCESS_MAN)
644
645 endif # BUILD_HAVE_MANPAGES_STYLESHEET
646 endif # BUILD_HAVE_XSLTPROC
647
648 #
649 # Phony targets
650 #
651
652 .PHONY: $(TPHONY)