swc

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

local.mk (4458B)


      1 # swc: libswc/local.mk
      2 
      3 dir := libswc
      4 
      5 LIBSWC_LINK := libswc.so
      6 LIBSWC_SO   := $(LIBSWC_LINK).$(VERSION_MAJOR)
      7 LIBSWC_LIB  := $(LIBSWC_SO).$(VERSION_MINOR)
      8 
      9 ifneq ($(ENABLE_STATIC), 0)
     10 $(dir)_TARGETS += $(dir)/libswc.a
     11 endif
     12 
     13 ifneq ($(ENABLE_SHARED), 0)
     14 $(dir)_TARGETS +=                   \
     15     $(dir)/$(LIBSWC_LIB)            \
     16     $(dir)/$(LIBSWC_SO)             \
     17     $(dir)/$(LIBSWC_LINK)
     18 endif
     19 
     20 $(dir)_PACKAGES := libdrm pixman-1 wayland-server wld xkbcommon
     21 $(dir)_CFLAGS += -Iprotocol
     22 
     23 SWC_SOURCES =                       \
     24     launch/protocol.c               \
     25     libswc/bindings.c               \
     26     libswc/compositor.c             \
     27     libswc/data.c                   \
     28     libswc/data_device.c            \
     29     libswc/data_device_manager.c    \
     30     libswc/dmabuf.c                 \
     31     libswc/drm.c                    \
     32     libswc/input.c                  \
     33     libswc/kde_decoration.c         \
     34     libswc/keyboard.c               \
     35     libswc/launch.c                 \
     36     libswc/mode.c                   \
     37     libswc/output.c                 \
     38     libswc/panel.c                  \
     39     libswc/panel_manager.c          \
     40     libswc/plane.c                  \
     41     libswc/pointer.c                \
     42     libswc/primary_plane.c          \
     43     libswc/region.c                 \
     44     libswc/screen.c                 \
     45     libswc/shell.c                  \
     46     libswc/shell_surface.c          \
     47     libswc/shm.c                    \
     48     libswc/subcompositor.c          \
     49     libswc/subsurface.c             \
     50     libswc/surface.c                \
     51     libswc/swc.c                    \
     52     libswc/touch.c                  \
     53     libswc/util.c                   \
     54     libswc/view.c                   \
     55     libswc/wayland_buffer.c         \
     56     libswc/window.c                 \
     57     libswc/xdg_decoration.c         \
     58     libswc/xdg_shell.c              \
     59     protocol/linux-dmabuf-unstable-v1-protocol.c \
     60     protocol/server-decoration-protocol.c \
     61     protocol/swc-protocol.c         \
     62     protocol/wayland-drm-protocol.c \
     63     protocol/xdg-decoration-unstable-v1-protocol.c \
     64     protocol/xdg-shell-protocol.c
     65 
     66 ifeq ($(shell uname),NetBSD)
     67     SWC_SOURCES += libswc/seat-ws.c
     68 else
     69     SWC_SOURCES += libswc/seat.c
     70     $(dir)_PACKAGES += libinput
     71     ifeq ($(ENABLE_LIBUDEV),1)
     72         $(dir)_CFLAGS += -DENABLE_LIBUDEV
     73         $(dir)_PACKAGES += libudev
     74     endif
     75 endif
     76 
     77 ifeq ($(ENABLE_XWAYLAND),1)
     78 $(dir)_CFLAGS += -DENABLE_XWAYLAND
     79 $(dir)_PACKAGES += xcb xcb-composite xcb-ewmh xcb-icccm
     80 
     81 SWC_SOURCES +=                      \
     82     libswc/xserver.c                \
     83     libswc/xwm.c
     84 endif
     85 
     86 SWC_STATIC_OBJECTS = $(SWC_SOURCES:%.c=%.o)
     87 SWC_SHARED_OBJECTS = $(SWC_SOURCES:%.c=%.lo)
     88 
     89 # Explicitly state dependencies on generated files
     90 objects = $(foreach obj,$(1),$(dir)/$(obj).o $(dir)/$(obj).lo)
     91 $(call objects,compositor panel_manager panel screen): protocol/swc-server-protocol.h
     92 $(call objects,dmabuf): protocol/linux-dmabuf-unstable-v1-server-protocol.h
     93 $(call objects,drm drm_buffer): protocol/wayland-drm-server-protocol.h
     94 $(call objects,kde_decoration): protocol/server-decoration-server-protocol.h
     95 $(call objects,xdg_decoration): protocol/xdg-decoration-unstable-v1-server-protocol.h
     96 $(call objects,xdg_shell): protocol/xdg-shell-server-protocol.h
     97 $(call objects,pointer): cursor/cursor_data.h
     98 
     99 $(dir)/libswc-internal.o: $(SWC_STATIC_OBJECTS)
    100 	$(link) -nostdlib -r
    101 
    102 $(dir)/libswc.o: $(dir)/libswc-internal.o
    103 	$(Q_OBJCOPY)$(OBJCOPY) --localize-hidden $< $@
    104 
    105 $(dir)/libswc.a: $(dir)/libswc.o
    106 	$(Q_AR)$(AR) cru $@ $^
    107 
    108 $(dir)/$(LIBSWC_LIB): $(SWC_SHARED_OBJECTS)
    109 	$(link) -shared -Wl,-soname,$(LIBSWC_SO) -Wl,-no-undefined $(libswc_PACKAGE_LIBS)
    110 
    111 $(dir)/$(LIBSWC_SO): $(dir)/$(LIBSWC_LIB)
    112 	$(Q_SYM)ln -sf $(notdir $<) $@
    113 
    114 $(dir)/$(LIBSWC_LINK): $(dir)/$(LIBSWC_SO)
    115 	$(Q_SYM)ln -sf $(notdir $<) $@
    116 
    117 .PHONY: install-libswc.a
    118 install-libswc.a: $(dir)/libswc.a | $(DESTDIR)$(LIBDIR)
    119 	install -m 644 $< $(DESTDIR)$(LIBDIR)
    120 
    121 .PHONY: install-$(LIBSWC_LIB)
    122 install-$(LIBSWC_LIB): $(dir)/$(LIBSWC_LIB) | $(DESTDIR)$(LIBDIR)
    123 	install -m 755 $< $(DESTDIR)$(LIBDIR)
    124 
    125 .PHONY: install-$(LIBSWC_SO) install-$(LIBSWC_LINK)
    126 install-$(LIBSWC_SO) install-$(LIBSWC_LINK): install-$(LIBSWC_LIB)
    127 	ln -sf $(LIBSWC_LIB) $(DESTDIR)$(LIBDIR)/${@:install-%=%}
    128 
    129 install-$(dir): $($(dir)_TARGETS:$(dir)/%=install-%) | $(DESTDIR)$(INCLUDEDIR)
    130 	install -m 644 libswc/swc.h $(DESTDIR)$(INCLUDEDIR)
    131 
    132 CLEAN_FILES += $(SWC_SHARED_OBJECTS) $(SWC_STATIC_OBJECTS)
    133 
    134 include common.mk