swc

Unnamed repository; edit this file 'description' to name the repository.
git clone git://git.nihaljere.xyz/swc
Log | Files | Refs | README | LICENSE

commit 91a4aa839eb9121bed3fcb46b28c9f24c0445590
parent f9bbfb5618c6da495d54409c3c63c8746d05e1b7
Author: Michael Forney <mforney@mforney.org>
Date:   Thu, 24 Oct 2013 22:21:02 -0700

Switch build system to plain Makefiles

Diffstat:
M.gitignore | 28+++-------------------------
AMakefile | 44++++++++++++++++++++++++++++++++++++++++++++
AMakefile.common | 13+++++++++++++
Aconfig.mk | 33+++++++++++++++++++++++++++++++++
Dconfigure.ac | 37-------------------------------------
Dlaunch/Makefile.am | 13-------------
Alaunch/Makefile.local | 22++++++++++++++++++++++
Dlibswc/Makefile.am | 44--------------------------------------------
Alibswc/Makefile.local | 83+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Dprotocol/Makefile.am | 7-------
Aprotocol/Makefile.local | 19+++++++++++++++++++
11 files changed, 217 insertions(+), 126 deletions(-)

diff --git a/.gitignore b/.gitignore @@ -5,30 +5,8 @@ protocol/wayland-drm-protocol.c protocol/wayland-drm-server-protocol.h -.deps/ -.libs/ -.dirstamp - -Makefile -Makefile.in - -/aclocal.m4 -/ar-lib -/autom4te.cache/ -/config.guess -/config.log -/config.status -/config.sub -/configure -/compile -/depcomp -/install-sh -/libtool -/ltmain.sh -/m4/ -/missing - -/libswc/libswc.la -/launch/liblaunch-protocol.la +/.deps/ +/libswc/libswc.a +/libswc/libswc.so /launch/swc-launch diff --git a/Makefile b/Makefile @@ -0,0 +1,44 @@ +# swc: Makefile + +.PHONY: all +all: build + +SUBDIRS := launch libswc protocol +CLEAN_FILES := + +include config.mk +include $(SUBDIRS:%=%/Makefile.local) + +ifeq ($(if $(V),$(V),0), 0) + define quiet + @echo " $1 $@" + @$(if $2,$2,$($1)) + endef +else + quiet = $(if $2,$2,$($1)) +endif + +define check_deps + @echo "Checking for dependencies of $1 ($2)" + @$(PKG_CONFIG) --exists --print-errors $2 +endef + +compile = $(call quiet,CC) $(CFLAGS) $(CPPFLAGS) -I . -c -MMD -MP -MF .deps/$*.d -o $@ $< +link = $(call quiet,CCLD,$(CC)) $(CFLAGS) -o $@ $^ + +.PHONY: check-dependencies +check-dependencies: $(SUBDIRS:%=check-dependencies-%) + +.PHONY: build +build: $(SUBDIRS:%=build-%) + +.PHONY: install +install: $(SUBDIRS:%=install-%) + +$(DESTDIR)$(BINDIR) $(DESTDIR)$(LIBDIR) $(DESTDIR)$(INCLUDEDIR): + mkdir -p "$@" + +.PHONY: clean +clean: + rm -f $(CLEAN_FILES) + diff --git a/Makefile.common b/Makefile.common @@ -0,0 +1,13 @@ +# swc: Makefile.common + +.PHONY: check-dependencies-$(dir) +check-dependencies-$(dir): + +.PHONY: build-$(dir) +build-$(dir): $($(dir)_TARGETS) + +.PHONY: install-$(dir) +install-$(dir): + +CLEAN_FILES += $($(dir)_TARGETS) + diff --git a/config.mk b/config.mk @@ -0,0 +1,33 @@ +# swc: config.mk + +PREFIX = /usr/local +BINDIR = $(PREFIX)/bin +LIBDIR = $(PREFIX)/lib +INCLUDEDIR = $(PREFIX)/include + +CC = gcc +CPPFLAGS = -D_GNU_SOURCE # Required for mkostemp +CFLAGS = -O2 -pipe +PKG_CONFIG = pkg-config +WAYLAND_SCANNER = wayland-scanner + +ENABLE_STATIC = 1 +ENABLE_SHARED = 1 + +# Dependencies +SWC_PACKAGES = \ + wayland-server \ + libudev \ + libevdev \ + xkbcommon \ + libdrm \ + pixman-1 \ + wld +LAUNCH_PACKAGES = \ + libdrm + +SWC_PACKAGE_CFLAGS = $$($(PKG_CONFIG) --cflags $(SWC_PACKAGES)) +SWC_PACKAGE_LIBS = $$($(PKG_CONFIG) --libs $(SWC_PACKAGES)) +LAUNCH_PACKAGE_CFLAGS = $$($(PKG_CONFIG) --cflags $(LAUNCH_PACKAGES)) +LAUNCH_PACKAGE_LIBS = $$($(PKG_CONFIG) --libs $(LAUNCH_PACKAGES)) + diff --git a/configure.ac b/configure.ac @@ -1,37 +0,0 @@ -dnl swc: configure.ac - -AC_PREREQ([2.59]) - -AC_INIT([swc], [0.0.1], [mforney@mforney.org]) -AM_INIT_AUTOMAKE([foreign -Wall -Werror subdir-objects]) -AC_LANG([C]) - -m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) - -AC_PROG_CC_C99 -AC_USE_SYSTEM_EXTENSIONS - -AM_PROG_AR -LT_INIT - -AC_CONFIG_SRCDIR([libswc/swc.c]) -AC_CONFIG_MACRO_DIR([m4]) - -PKG_PROG_PKG_CONFIG([0.9.0]) - -dnl Check for libraries {{{ -PKG_CHECK_MODULES([wayland_server], [wayland-server]) -PKG_CHECK_MODULES([udev], [libudev]) -PKG_CHECK_MODULES([libevdev], [libevdev]) -PKG_CHECK_MODULES([xkbcommon], [xkbcommon]) -PKG_CHECK_MODULES([drm], [libdrm]) -PKG_CHECK_MODULES([pixman], [pixman-1]) -PKG_CHECK_MODULES([wld], [wld]) -dnl }}} - -dnl Wayland protocol -WAYLAND_SCANNER_RULES(['$(top_srcdir)/protocol']) - -AC_CONFIG_FILES([Makefile libswc/Makefile launch/Makefile protocol/Makefile]) -AC_OUTPUT - diff --git a/launch/Makefile.am b/launch/Makefile.am @@ -1,13 +0,0 @@ -# launch/Makefile.am - -AM_CFLAGS = $(drm_CFLAGS) - -bin_PROGRAMS = swc-launch -noinst_LTLIBRARIES = liblaunch-protocol.la - -swc_launch_SOURCES = launch.c -swc_launch_LDADD = liblaunch-protocol.la $(drm_LIBS) -swc_launch_LDFLAGS = -static - -liblaunch_protocol_la_SOURCES = protocol.c protocol.h - diff --git a/launch/Makefile.local b/launch/Makefile.local @@ -0,0 +1,22 @@ +# swc: launch/Makefile.local + +dir := launch + +$(dir)_TARGETS := $(dir)/swc-launch + +$(dir)/launch.o: $(dir)/launch.c + $(compile) $(LAUNCH_PACKAGE_CFLAGS) + +$(dir)/swc-launch: $(dir)/launch.o $(dir)/protocol.static.o + $(link) $(LAUNCH_PACKAGE_LIBS) + +check-dependencies-$(dir): + $(call check_deps,swc-launch,$(LAUNCH_PACKAGES)) + +install-$(dir): $(dir)/swc-launch | $(DESTDIR)$(BINDIR) + install -m4755 launch/swc-launch "$(DESTDIR)$(BINDIR)" + +CLEAN_FILES += $(dir)/launch.o + +include Makefile.common + diff --git a/libswc/Makefile.am b/libswc/Makefile.am @@ -1,44 +0,0 @@ -# swc: libswc/Makefile.am - -AM_CPPFLAGS = -I$(top_srcdir) -I$(top_builddir) -AM_CFLAGS = $(drm_CFLAGS) $(pixman_CFLAGS) $(wld_CFLAGS) $(libevdev_CFLAGS) - -lib_LTLIBRARIES = libswc.la -include_HEADERS = swc.h - -libswc_la_SOURCES = \ - compositor.c compositor.h \ - util.c util.h \ - output.c output.h \ - plane.c plane.h \ - surface.c surface.h \ - compositor_surface.c compositor_surface.h \ - cursor_surface.c cursor_surface.h \ - region.c region.h \ - renderer.c renderer.h \ - input_focus.c input_focus.h \ - keyboard.c keyboard.h \ - pointer.c pointer.h \ - seat.c seat.h \ - data_device_manager.c data_device_manager.h \ - data_device.c data_device.h \ - data.c data.h \ - mode.c mode.h \ - evdev_device.c evdev_device.h \ - xkb.c xkb.h \ - drm.c drm.h \ - drm_buffer.c drm_buffer.h \ - ../protocol/wayland-drm-protocol.c - -# Public interface -libswc_la_SOURCES += \ - swc.c swc.h \ - window.c window.h \ - shell.c shell.h \ - shell_surface.c shell_surface.h \ - binding.c binding.h - -libswc_la_LIBADD = $(wayland_server_LIBS) $(udev_LIBS) $(libevdev_LIBS) \ - $(xkbcommon_LIBS) $(drm_LIBS) $(pixman_LIBS) $(wld_LIBS) \ - ../launch/liblaunch-protocol.la - diff --git a/libswc/Makefile.local b/libswc/Makefile.local @@ -0,0 +1,83 @@ +# swc: libswc/Makefile.local + +dir := libswc + +ifneq ($(ENABLE_STATIC), 0) +$(dir)_TARGETS += $(dir)/libswc.a +endif + +ifneq ($(ENABLE_SHARED), 0) +$(dir)_TARGETS += $(dir)/libswc.so +endif + +SWC_SOURCES = \ + libswc/compositor.c \ + libswc/util.c \ + libswc/output.c \ + libswc/plane.c \ + libswc/surface.c \ + libswc/compositor_surface.c \ + libswc/cursor_surface.c \ + libswc/region.c \ + libswc/renderer.c \ + libswc/input_focus.c \ + libswc/keyboard.c \ + libswc/pointer.c \ + libswc/seat.c \ + libswc/data_device_manager.c \ + libswc/data_device.c \ + libswc/data.c \ + libswc/mode.c \ + libswc/evdev_device.c \ + libswc/xkb.c \ + libswc/drm.c \ + libswc/drm_buffer.c \ + protocol/wayland-drm-protocol.c \ + launch/protocol.c + +# Public interface +SWC_SOURCES += \ + libswc/swc.c \ + libswc/window.c \ + libswc/shell.c \ + libswc/shell_surface.c \ + libswc/binding.c + +SWC_SHARED_OBJECTS = $(SWC_SOURCES:%.c=%.shared.o) +SWC_STATIC_OBJECTS = $(SWC_SOURCES:%.c=%.static.o) + +# Explicitly state dependencies on generated files +$(dir)/drm.c $(dir)/drm_buffer.c: protocol/wayland-drm-server-protocol.h + +%.shared.o: %.c + @mkdir -p .deps/$(dir $@) + $(compile) -fPIC $(SWC_PACKAGE_CFLAGS) + +%.static.o: %.c + @mkdir -p .deps/$(dir $@) + $(compile) $(SWC_PACKAGE_CFLAGS) + +$(dir)/libswc.a: $(SWC_STATIC_OBJECTS) + $(call quiet,AR) cru $@ $^ + +$(dir)/libswc.so: $(SWC_SHARED_OBJECTS) + $(link) -shared $(SWC_PACKAGE_LIBS) + +.PHONY: install-libswc.a +install-libswc.a: $(dir)/libswc.a | $(DESTDIR)$(LIBDIR) + install -m0644 $< "$(DESTDIR)$(LIBDIR)" + +.PHONY: install-libswc.so +install-libswc.so: $(dir)/libswc.so | $(DESTDIR)$(LIBDIR) + install -m0755 $< "$(DESTDIR)$(LIBDIR)" + +check-dependencies-libswc: + $(call check_deps,libswc,$(SWC_PACKAGES)) + +install-libswc: $($(dir)_TARGETS:$(dir)/%=install-%) | $(DESTDIR)$(INCLUDEDIR) + install -m0644 libswc/swc.h "$(DESTDIR)$(INCLUDEDIR)" + +CLEAN_FILES += $(SWC_SHARED_OBJECTS) $(SWC_STATIC_OBJECTS) + +include Makefile.common + diff --git a/protocol/Makefile.am b/protocol/Makefile.am @@ -1,7 +0,0 @@ -# wld: protocol/Makefile.am - -BUILT_SOURCES = wayland-drm-protocol.c wayland-drm-server-protocol.h -CLEANFILES = $(BUILT_SOURCES) - -@wayland_scanner_rules@ - diff --git a/protocol/Makefile.local b/protocol/Makefile.local @@ -0,0 +1,19 @@ +# swc: protocol/Makefile.local + +dir := protocol + +PROTOCOL_EXTENSIONS = \ + $(dir)/wayland-drm.xml + +$(dir)/%-protocol.c: $(dir)/%.xml + $(call quiet,GEN,$(WAYLAND_SCANNER)) code < $< > $@ + +$(dir)/%-server-protocol.h: $(dir)/%.xml + $(call quiet,GEN,$(WAYLAND_SCANNER)) server-header < $< > $@ + +CLEAN_FILES += \ + $(PROTOCOL_EXTENSIONS:%.xml=%-protocol.c) \ + $(PROTOCOL_EXTENSIONS:%.xml=%-server-protocol.h) + +include Makefile.common +