commit ca9010a
Michael Forney
·
2013-12-31 03:28:04 +0000 UTC
parent 3a508b1
Switch to using Makefiles directly
9 files changed,
+209,
-247
A
Makefile
+4,
-23
1@@ -1,29 +1,10 @@
2 *.o
3 *.lo
4-.*.swp
5+.*.sw*
6
7-.deps/
8-.libs/
9-
10-Makefile
11-Makefile.in
12-
13-/aclocal.m4
14-/ar-lib
15-/autom4te.cache/
16-/config.guess
17-/config.log
18-/config.status
19-/config.sub
20-/configure
21-/depcomp
22-/install-sh
23-/libtool
24-/ltmain.sh
25-/m4/
26-/missing
27-
28-/libwld.la
29+/.deps/
30+/libwld.a
31+/libwld.so*
32 /wld.pc
33 /protocol/wayland-drm-client-protocol.h
34 /protocol/wayland-drm-protocol.c
A
Makefile
+148,
-0
1@@ -0,0 +1,148 @@
2+# wld: Makefile
3+
4+include config.mk
5+
6+VERSION_MAJOR := 0
7+VERSION_MINOR := 0
8+VERSION := $(VERSION_MAJOR).$(VERSION_MINOR)
9+
10+WLD_LIB := libwld.so
11+WLD_LIB_MAJOR := $(WLD_LIB).$(VERSION_MAJOR)
12+WLD_LIB_MINOR := $(WLD_LIB_MAJOR).$(VERSION_MINOR)
13+
14+TARGETS := wld.pc libwld.a $(WLD_LIB) $(WLD_LIB_MAJOR) $(WLD_LIB_MINOR)
15+CLEAN_FILES := $(TARGETS)
16+
17+WLD_REQUIRES = fontconfig pixman-1
18+WLD_REQUIRES_PRIVATE = freetype2
19+WLD_SOURCES = drawable.c color.c font.c
20+WLD_HEADERS = wld.h
21+
22+ifeq ($(ENABLE_DEBUG),1)
23+ WLD_CPPFLAGS += -DENABLE_DEBUG=1
24+endif
25+
26+ifeq ($(ENABLE_DRM),1)
27+ WLD_REQUIRES_PRIVATE += libdrm
28+ WLD_SOURCES += drm.c dumb.c
29+ WLD_HEADERS += drm.h
30+endif
31+
32+ifeq ($(ENABLE_PIXMAN),1)
33+ WLD_SOURCES += pixman.c
34+ WLD_HEADERS += pixman.h
35+endif
36+
37+ifeq ($(ENABLE_WAYLAND),1)
38+ WLD_REQUIRES_PRIVATE += wayland-client
39+ WLD_SOURCES += wayland.c
40+ WLD_HEADERS += wayland.h
41+
42+ ifneq ($(findstring shm,$(WAYLAND_INTERFACES)),)
43+ WLD_SOURCES += wayland-shm.c
44+ WLD_HEADERS += wayland-shm.h
45+ WLD_CPPFLAGS += -DWITH_WAYLAND_SHM=1
46+ endif
47+
48+ ifneq ($(findstring drm,$(WAYLAND_INTERFACES)),)
49+ WLD_SOURCES += wayland-drm.c protocol/wayland-drm-protocol.c
50+ WLD_HEADERS += wayland-drm.h
51+ WLD_CPPFLAGS += -DWITH_WAYLAND_DRM=1
52+ endif
53+endif
54+
55+ifneq ($(findstring intel,$(DRM_DRIVERS)),)
56+ WLD_REQUIRES_PRIVATE += libdrm_intel intelbatch
57+ WLD_SOURCES += intel.c
58+ WLD_CPPFLAGS += -DWITH_DRM_INTEL=1
59+endif
60+
61+ifeq ($(if $(V),$(V),0), 0)
62+ define quiet
63+ @echo " $1 $@"
64+ @$(if $2,$2,$($1))
65+ endef
66+else
67+ quiet = $(if $2,$2,$($1))
68+endif
69+
70+WLD_STATIC_OBJECTS = $(WLD_SOURCES:%.c=%.o)
71+WLD_SHARED_OBJECTS = $(WLD_SOURCES:%.c=%.lo)
72+WLD_PACKAGES = $(WLD_REQUIRES) $(WLD_REQUIRES_PRIVATE)
73+WLD_PACKAGE_CFLAGS ?= $(call pkgconfig,$(WLD_PACKAGES),cflags,CFLAGS)
74+WLD_PACKAGE_LIBS ?= $(call pkgconfig,$(WLD_PACKAGES),libs,LIBS)
75+
76+CLEAN_FILES += $(WLD_STATIC_OBJECTS) $(WLD_SHARED_OBJECTS)
77+
78+FINAL_CFLAGS = $(CFLAGS) -std=c99
79+FINAL_CPPFLAGS = $(CPPFLAGS) -D_XOPEN_SOURCE=700 -D_BSD_SOURCE
80+
81+# Warning/error flags
82+FINAL_CFLAGS += -Werror=implicit-function-declaration -Werror=implicit-int \
83+ -Werror=pointer-sign -Werror=pointer-arith \
84+ -Wall -Wno-missing-braces
85+
86+ifeq ($(ENABLE_DEBUG),1)
87+ FINAL_CPPFLAGS += -DENABLE_DEBUG=1
88+ FINAL_CFLAGS += -g
89+endif
90+
91+compile = $(call quiet,CC) $(FINAL_CPPFLAGS) $(FINAL_CFLAGS) -c -o $@ $< \
92+ -MMD -MP -MF .deps/$(basename $<).d -MT $(basename $@).o -MT $(basename $@).lo
93+link = $(call quiet,CCLD,$(CC)) $(FINAL_CFLAGS) -o $@ $^
94+pkgconfig = $(sort $(foreach pkg,$(1),$(if $($(pkg)_$(3)),$($(pkg)_$(3)), \
95+ $(shell $(PKG_CONFIG) --$(2) $(pkg)))))
96+
97+.PHONY: all
98+all: $(TARGETS)
99+
100+include protocol/local.mk
101+
102+.deps:
103+ @mkdir "$@"
104+
105+%.o: %.c | .deps
106+ $(compile) $(WLD_CPPFLAGS) $(WLD_PACKAGE_CFLAGS)
107+
108+%.lo: %.c | .deps
109+ $(compile) $(WLD_CPPFLAGS) $(WLD_PACKAGE_CFLAGS) -fPIC
110+
111+wayland-drm.o wayland-drm.lo: protocol/wayland-drm-client-protocol.h
112+
113+wld.pc: wld.pc.in
114+ $(call quiet,GEN,sed) \
115+ -e "s:@VERSION@:$(VERSION):" \
116+ -e "s:@PREFIX@:$(PREFIX):" \
117+ -e "s:@LIBDIR@:$(LIBDIR):" \
118+ -e "s:@INCLUDEDIR@:$(INCLUDEDIR):" \
119+ -e "s:@WLD_REQUIRES@:$(WLD_REQUIRES):" \
120+ -e "s:@WLD_REQUIRES_PRIVATE@:$(WLD_REQUIRES_PRIVATE):" \
121+ $< > $@
122+
123+libwld.a: $(WLD_STATIC_OBJECTS)
124+ $(call quiet,AR) cr $@ $^
125+
126+$(WLD_LIB_MINOR): $(WLD_SHARED_OBJECTS)
127+ $(link) $(WLD_PACKAGE_LIBS) -shared -Wl,-soname,$(WLD_LIB_MAJOR),-no-undefined
128+
129+$(WLD_LIB_MAJOR) $(WLD_LIB): $(WLD_LIB_MINOR)
130+ $(call quiet,SYM,ln -sf) $< $@
131+
132+$(foreach dir,LIB PKGCONFIG,$(DESTDIR)$($(dir)DIR)) $(DESTDIR)$(INCLUDEDIR)/wld:
133+ mkdir -p "$@"
134+
135+.PHONY: install
136+install: $(TARGETS) | $(foreach dir,LIB PKGCONFIG,$(DESTDIR)$($(dir)DIR)) $(DESTDIR)$(INCLUDEDIR)/wld
137+ install -m0644 wld.pc "$(DESTDIR)$(PKGCONFIGDIR)"
138+ install -m0644 $(WLD_HEADERS) "$(DESTDIR)$(INCLUDEDIR)/wld"
139+ install -m0644 libwld.a "$(DESTDIR)$(LIBDIR)"
140+ install -m0755 $(WLD_LIB_MINOR) "$(DESTDIR)$(LIBDIR)"
141+ ln -sf $(WLD_LIB_MINOR) "$(DESTDIR)$(LIBDIR)/$(WLD_LIB_MAJOR)"
142+ ln -sf $(WLD_LIB_MINOR) "$(DESTDIR)$(LIBDIR)/$(WLD_LIB)"
143+
144+.PHONY: clean
145+clean:
146+ rm -rf $(CLEAN_FILES)
147+
148+-include .deps/*.d
149+
+0,
-53
1@@ -1,53 +0,0 @@
2-# wld: Makefile.am
3-
4-ACLOCAL_AMFLAGS = -I m4
5-AM_CFLAGS = $(fontconfig_CFLAGS) $(freetype_CFLAGS) $(pixman_CFLAGS)
6-
7-lib_LTLIBRARIES = libwld.la
8-pkginclude_HEADERS = wld.h
9-
10-pkgconfigdir = $(libdir)/pkgconfig
11-pkgconfig_DATA = wld.pc
12-
13-libwld_la_SOURCES = color.c drawable.c font.c
14-libwld_la_LIBADD = $(fontconfig_LIBS) $(freetype_LIBS) $(pixman_LIBS)
15-
16-if ENABLE_DRM
17- AM_CFLAGS += $(libdrm_CFLAGS)
18- libwld_la_SOURCES += drm.c dumb.c
19- pkginclude_HEADERS += drm.h
20-endif
21-
22-if WITH_DRM_INTEL
23- AM_CFLAGS += $(drm_intel_CFLAGS) $(intelbatch_CFLAGS)
24- libwld_la_SOURCES += intel.c
25- libwld_la_LIBADD += $(drm_intel_LIBS) $(intelbatch_LIBS)
26-endif
27-
28-if ENABLE_PIXMAN
29- libwld_la_SOURCES += pixman.c
30- pkginclude_HEADERS += pixman.h
31-endif
32-
33-if ENABLE_WAYLAND
34- AM_CFLAGS += $(wayland_client_CFLAGS)
35- libwld_la_SOURCES += wayland.c
36- libwld_la_LIBADD += $(wayland_client_LIBS)
37- pkginclude_HEADERS += wayland.h
38-endif
39-
40-if WITH_WAYLAND_DRM
41- AM_CPPFLAGS = -I$(top_builddir)/protocol
42- AM_CFLAGS += $(drm_CFLAGS)
43- libwld_la_SOURCES += wayland-drm.c protocol/wayland-drm-protocol.c
44- libwld_la_LIBADD += $(drm_LIBS)
45- pkginclude_HEADERS += wayland-drm.h
46-endif
47-
48-if WITH_WAYLAND_SHM
49- libwld_la_SOURCES += wayland-shm.c
50- pkginclude_HEADERS += wayland-shm.h
51-endif
52-
53-SUBDIRS = protocol
54-
+0,
-13
1@@ -1,13 +0,0 @@
2-#!/bin/sh
3-
4-set -ex
5-
6-rm -rf autom4te.cache
7-
8-libtoolize
9-aclocal -I m4 --force
10-autoconf -f -W all
11-automake -f -a -c -W all
12-
13-rm -rf autom4te.cache
14-
+25,
-0
1@@ -0,0 +1,25 @@
2+# wld: config.mk
3+
4+PREFIX = /usr/local
5+LIBDIR = $(PREFIX)/lib
6+INCLUDEDIR = $(PREFIX)/include
7+PKGCONFIGDIR = $(LIBDIR)/pkgconfig
8+
9+CC = gcc
10+CFLAGS = -pipe
11+PKG_CONFIG ?= pkg-config
12+WAYLAND_SCANNER ?= wayland-scanner
13+
14+ENABLE_DEBUG = 1
15+
16+ENABLE_PIXMAN = 1
17+ENABLE_DRM = 1
18+ENABLE_WAYLAND = 0
19+
20+DRM_DRIVERS = intel
21+WAYLAND_INTERFACES = shm
22+
23+ifeq ($(ENABLE_DRM),1)
24+ WAYLAND_INTERFACES += drm
25+endif
26+
+0,
-150
1@@ -1,150 +0,0 @@
2-dnl wld: configure.ac
3-
4-AC_PREREQ([2.59])
5-
6-AC_INIT([wld], [0.0.1], [mforney@mforney.org])
7-AM_INIT_AUTOMAKE([foreign nostdinc subdir-objects -Wall -Werror])
8-AC_LANG([C])
9-
10-m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
11-
12-AC_PROG_CC_C99
13-AC_USE_SYSTEM_EXTENSIONS
14-
15-AM_PROG_AR
16-LT_INIT
17-
18-AC_CONFIG_SRCDIR([wld.h])
19-
20-PKG_PROG_PKG_CONFIG([0.9.0])
21-
22-dnl Options {{{
23-# Debugging
24-AC_ARG_ENABLE([debug],
25- AS_HELP_STRING([--enable-debug],
26- [enable debugging messages]),
27- enable_debug=$enableval,
28- enable_debug=no)
29-if test "x$enable_debug" = "xyes" ; then
30- AC_DEFINE([ENABLE_DEBUG], [1], [Enable debug messages])
31-fi
32-
33-# DRM
34-AC_ARG_ENABLE([drm],
35- AS_HELP_STRING([--disable-drm],
36- [disable DRM support]),
37- enable_drm=$enableval,
38- enable_drm=yes)
39-AM_CONDITIONAL([ENABLE_DRM], [test "x$enable_drm" = "xyes"])
40-
41-# DRM drivers
42-DEFAULT_DRM_DRIVERS=intel
43-AC_ARG_WITH([drm-drivers],
44- AS_HELP_STRING([--with-drm-drivers=DRIVERS],
45- [specify DRM drivers (comma separated)]),
46- with_drm_drivers=$withval,
47- with_drm_drivers=$DEFAULT_DRM_DRIVERS)
48-case "x$with_drm_drivers" in
49- xyes) with_drm_drivers=$DEFAULT_DRM_DRIVERS ;;
50- xno) with_drm_drivers= ;;
51-esac
52-if test "x$drm_drivers" != "x" -a "x$enable_drm" != "xyes"; then
53- AC_MSG_ERROR([--with-drm-drivers requires --enable-drm])
54-fi
55-drm_drivers=`IFS=','; echo $with_drm_drivers`
56-for driver in $drm_drivers ; do
57- case "x$driver" in
58- xintel)
59- AC_DEFINE([WITH_DRM_INTEL], [1], [Build Intel DRM driver])
60- PKG_CHECK_MODULES([drm_intel], [libdrm_intel],,
61- AC_MSG_ERROR([Intel DRM driver requires libdrm_intel]))
62- PKG_CHECK_MODULES([intelbatch], [intelbatch],,
63- AC_MSG_ERROR([Intel DRM driver requires libintelbatch]))
64- PKGCONFIG_REQUIRES_PRIVATE+=" libdrm_intel intelbatch"
65- with_drm_intel=yes
66- ;;
67- *)
68- AC_MSG_ERROR([Unknown DRM driver: '$driver'])
69- ;;
70- esac
71-done
72-AM_CONDITIONAL([WITH_DRM_INTEL], [test "x$with_drm_intel" = "xyes"])
73-
74-# Wayland
75-AC_ARG_ENABLE([wayland],
76- AS_HELP_STRING([--disable-wayland],
77- [disable Wayland support]),
78- enable_wayland=$enableval,
79- enable_wayland=yes)
80-if test "x$enable_wayland" = "xyes" ; then
81- PKG_CHECK_MODULES([wayland_client], [wayland-client],,
82- AC_MSG_ERROR([Wayland client libraries not found. Specify \
83---disable-wayland to build without wayland support]))
84- PKGCONFIG_REQUIRES_PRIVATE+=" wayland-client"
85-fi
86-AM_CONDITIONAL([ENABLE_WAYLAND], [test "x$enable_wayland" = "xyes"])
87-
88-DEFAULT_WAYLAND_INTERFACES=drm,shm
89-AC_ARG_WITH([wayland-interfaces],
90- AS_HELP_STRING([--with-wayland-interfaces=INTERFACES],
91- [specify Wayland interfaces (comma separated)]),
92- with_wayland_interfaces=$withval,
93- with_wayland_interfaces=$DEFAULT_WAYLAND_INTERFACES)
94-case "x$with_wayland_interfaces" in
95- xyes) with_wayland_interfaces=$DEFAULT_WAYLAND_INTERFACES ;;
96- xno) with_wayland_interfaces= ;;
97-esac
98-if test "x$wayland_interfaces" != "x" -a "x$enable_wayland" != "xyes"; then
99- AC_MSG_ERROR([--with-wayland-interfaces requires --enable-wayland])
100-fi
101-wayland_interfaces=`IFS=','; echo $with_wayland_interfaces`
102-for interface in $wayland_interfaces ; do
103- case "x$interface" in
104- xdrm)
105- PKG_CHECK_MODULES([libdrm], [libdrm],,
106- AC_MSG_ERROR([Wayland DRM support requires libdrm]))
107- PKGCONFIG_REQUIRES_PRIVATE+=" libdrm"
108- AC_DEFINE([WITH_WAYLAND_DRM], [1],
109- [Build support for wl_drm global])
110- with_wayland_drm=yes
111- ;;
112- xshm)
113- AC_DEFINE([WITH_WAYLAND_SHM], [1],
114- [Build support for wl_shm global])
115- with_wayland_shm=yes
116- ;;
117- *)
118- AC_MSG_ERROR([Unknown Wayland interface: '$interface'])
119- ;;
120- esac
121-done
122-AM_CONDITIONAL([WITH_WAYLAND_DRM], [test "x$with_wayland_drm" = "xyes"])
123-AM_CONDITIONAL([WITH_WAYLAND_SHM], [test "x$with_wayland_shm" = "xyes"])
124-
125-# Pixman
126-AC_ARG_ENABLE([pixman],
127- AS_HELP_STRING([--disable-pixman],
128- [disable pixman drawable support]),
129- enable_pixman=$enableval,
130- enable_pixman=yes)
131-if test "x$enable_pixman" = "xyes" ; then
132- AC_DEFINE([ENABLE_PIXMAN], [1], [Enable Pixman support])
133-fi
134-AM_CONDITIONAL([ENABLE_PIXMAN], test "x$enable_pixman" = "xyes")
135-dnl }}}
136-
137-dnl Check for libraries {{{
138-PKG_CHECK_MODULES([pixman], [pixman-1])
139-PKG_CHECK_MODULES([fontconfig], [fontconfig])
140-PKG_CHECK_MODULES([freetype], [freetype2])
141-dnl }}}
142-
143-dnl Wayland protocol
144-WAYLAND_SCANNER_RULES(['$(top_srcdir)/protocol'])
145-
146-dnl pkgconfig
147-AC_SUBST([PKGCONFIG_REQUIRES_PRIVATE])
148-
149-AC_CONFIG_FILES([Makefile protocol/Makefile wld.pc])
150-AC_OUTPUT
151-
+25,
-0
1@@ -0,0 +1,25 @@
2+# wld: protocol/local.mk
3+
4+dir := protocol
5+
6+PROTOCOL_EXTENSIONS = $(dir)/wayland-drm.xml
7+
8+$(dir)/%-protocol.c: $(dir)/%.xml
9+ $(call quiet,GEN,$(WAYLAND_SCANNER)) code < $< > $@
10+
11+$(dir)/%-client-protocol.h: $(dir)/%.xml
12+ $(call quiet,GEN,$(WAYLAND_SCANNER)) client-header < $< > $@
13+
14+.deps/$(dir): | .deps
15+ @mkdir "$@"
16+
17+$(dir)/%.o: $(dir)/%.c | .deps/$(dir)
18+ $(compile)
19+
20+$(dir)/%.lo: $(dir)/%.c | .deps/$(dir)
21+ $(compile) -fPIC
22+
23+CLEAN_FILES += \
24+ $(PROTOCOL_EXTENSIONS:%.xml=%-protocol.c) \
25+ $(PROTOCOL_EXTENSIONS:%.xml=%-client-protocol.h)
26+
+1,
-1
1@@ -22,7 +22,7 @@
2 */
3
4 #include "wayland-drm.h"
5-#include "wayland-drm-client-protocol.h"
6+#include "protocol/wayland-drm-client-protocol.h"
7 #include "wayland.h"
8 #include "drm.h"
9 #include "wayland-private.h"
+6,
-7
1@@ -1,14 +1,13 @@
2-prefix=@prefix@
3-exec_prefix=@exec_prefix@
4-libdir=@libdir@
5-includedir=@includedir@
6+prefix=@PREFIX@
7+libdir=@LIBDIR@
8+includedir=@INCLUDEDIR@
9
10 Name: wld
11 Description: A primitive drawing library library targeted at Wayland
12-Version: @PACKAGE_VERSION@
13+Version: @VERSION@
14 Cflags: -I${includedir}
15 Libs: -L${libdir} -lwld
16
17-Requires: fontconfig pixman-1
18-Requires.private: freetype2 @PKGCONFIG_REQUIRES_PRIVATE@
19+Requires: @WLD_REQUIRES@
20+Requires.private: @WLD_REQUIRES_PRIVATE@
21