mirror of
https://github.com/kolunmi/dwlb.git
synced 2026-02-19 10:43:12 +00:00
Makefile: improved compatibility with BSD make
This commit is contained in:
parent
48dbe00bdb
commit
9449551bcf
125
Makefile
125
Makefile
@ -1,55 +1,94 @@
|
||||
BINS = dwlb
|
||||
MANS = dwlb.1
|
||||
include config.mk
|
||||
|
||||
PREFIX ?= /usr/local
|
||||
CFLAGS += -Wall -Wextra -Wno-unused-parameter -Wno-format-truncation -g
|
||||
# Protocol source files
|
||||
PROTO_SRC = xdg-shell-protocol.c \
|
||||
xdg-output-unstable-v1-protocol.c \
|
||||
wlr-layer-shell-unstable-v1-protocol.c \
|
||||
dwl-ipc-unstable-v2-protocol.c
|
||||
|
||||
all: $(BINS)
|
||||
PROTO_OBJ = ${PROTO_SRC:.c=.o}
|
||||
|
||||
SRC = dwlb.c
|
||||
OBJ = ${SRC:.c=.o} ${PROTO_OBJ}
|
||||
|
||||
all: dwlb
|
||||
|
||||
# Protocol header generation
|
||||
xdg-shell-protocol.h:
|
||||
${WAYLAND_SCANNER} client-header \
|
||||
${WAYLAND_PROTOCOLS}/stable/xdg-shell/xdg-shell.xml $@
|
||||
|
||||
xdg-shell-protocol.c:
|
||||
${WAYLAND_SCANNER} private-code \
|
||||
${WAYLAND_PROTOCOLS}/stable/xdg-shell/xdg-shell.xml $@
|
||||
|
||||
xdg-output-unstable-v1-protocol.h:
|
||||
${WAYLAND_SCANNER} client-header \
|
||||
${WAYLAND_PROTOCOLS}/unstable/xdg-output/xdg-output-unstable-v1.xml $@
|
||||
|
||||
xdg-output-unstable-v1-protocol.c:
|
||||
${WAYLAND_SCANNER} private-code \
|
||||
${WAYLAND_PROTOCOLS}/unstable/xdg-output/xdg-output-unstable-v1.xml $@
|
||||
|
||||
wlr-layer-shell-unstable-v1-protocol.h:
|
||||
${WAYLAND_SCANNER} client-header \
|
||||
protocols/wlr-layer-shell-unstable-v1.xml $@
|
||||
|
||||
wlr-layer-shell-unstable-v1-protocol.c:
|
||||
${WAYLAND_SCANNER} private-code \
|
||||
protocols/wlr-layer-shell-unstable-v1.xml $@
|
||||
|
||||
dwl-ipc-unstable-v2-protocol.h:
|
||||
${WAYLAND_SCANNER} client-header \
|
||||
protocols/dwl-ipc-unstable-v2.xml $@
|
||||
|
||||
dwl-ipc-unstable-v2-protocol.c:
|
||||
${WAYLAND_SCANNER} private-code \
|
||||
protocols/dwl-ipc-unstable-v2.xml $@
|
||||
|
||||
# Protocol object dependencies
|
||||
xdg-shell-protocol.o: xdg-shell-protocol.h
|
||||
xdg-output-unstable-v1-protocol.o: xdg-output-unstable-v1-protocol.h
|
||||
wlr-layer-shell-unstable-v1-protocol.o: wlr-layer-shell-unstable-v1-protocol.h
|
||||
dwl-ipc-unstable-v2-protocol.o: dwl-ipc-unstable-v2-protocol.h
|
||||
|
||||
# Main object dependencies
|
||||
|
||||
.c.o:
|
||||
${CC} -c ${CFLAGS} $<
|
||||
|
||||
${OBJ}: config.h config.mk
|
||||
|
||||
config.h:
|
||||
cp config.def.h $@
|
||||
|
||||
dwlb.o: utf8.h config.h \
|
||||
xdg-shell-protocol.h \
|
||||
xdg-output-unstable-v1-protocol.h \
|
||||
wlr-layer-shell-unstable-v1-protocol.h \
|
||||
dwl-ipc-unstable-v2-protocol.h
|
||||
|
||||
dwlb: ${OBJ}
|
||||
${CC} -o $@ ${OBJ} ${LDFLAGS}
|
||||
|
||||
clean:
|
||||
$(RM) $(BINS) $(addsuffix .o,$(BINS))
|
||||
rm -f dwlb ${OBJ} \
|
||||
xdg-shell-protocol.h xdg-shell-protocol.c \
|
||||
xdg-output-unstable-v1-protocol.h xdg-output-unstable-v1-protocol.c \
|
||||
wlr-layer-shell-unstable-v1-protocol.h wlr-layer-shell-unstable-v1-protocol.c \
|
||||
dwl-ipc-unstable-v2-protocol.h dwl-ipc-unstable-v2-protocol.c \
|
||||
|
||||
install: all
|
||||
install -D -t $(PREFIX)/bin $(BINS)
|
||||
install -D -m0644 -t $(PREFIX)/share/man/man1 $(MANS)
|
||||
mkdir -p ${PREFIX}/bin
|
||||
cp -f dwlb ${PREFIX}/bin
|
||||
chmod 755 ${PREFIX}/bin/dwlb
|
||||
mkdir -p ${MANPREFIX}/man1
|
||||
cp -f dwlb.1 > ${MANPREFIX}/man1/dwlb.1
|
||||
chmod 644 ${MANPREFIX}/man1/dwlb.1
|
||||
|
||||
WAYLAND_PROTOCOLS=$(shell pkg-config --variable=pkgdatadir wayland-protocols)
|
||||
WAYLAND_SCANNER=$(shell pkg-config --variable=wayland_scanner wayland-scanner)
|
||||
|
||||
xdg-shell-protocol.h:
|
||||
$(WAYLAND_SCANNER) client-header $(WAYLAND_PROTOCOLS)/stable/xdg-shell/xdg-shell.xml $@
|
||||
xdg-shell-protocol.c:
|
||||
$(WAYLAND_SCANNER) private-code $(WAYLAND_PROTOCOLS)/stable/xdg-shell/xdg-shell.xml $@
|
||||
xdg-shell-protocol.o: xdg-shell-protocol.h
|
||||
uninstall:
|
||||
rm -f ${PREFIX}/bin/dwlb \
|
||||
${MANPREFIX}/man1/dwlb.1
|
||||
|
||||
xdg-output-unstable-v1-protocol.h:
|
||||
$(WAYLAND_SCANNER) client-header $(WAYLAND_PROTOCOLS)/unstable/xdg-output/xdg-output-unstable-v1.xml $@
|
||||
xdg-output-unstable-v1-protocol.c:
|
||||
$(WAYLAND_SCANNER) private-code $(WAYLAND_PROTOCOLS)/unstable/xdg-output/xdg-output-unstable-v1.xml $@
|
||||
xdg-output-unstable-v1-protocol.o: xdg-output-unstable-v1-protocol.h
|
||||
|
||||
wlr-layer-shell-unstable-v1-protocol.h:
|
||||
$(WAYLAND_SCANNER) client-header protocols/wlr-layer-shell-unstable-v1.xml $@
|
||||
wlr-layer-shell-unstable-v1-protocol.c:
|
||||
$(WAYLAND_SCANNER) private-code protocols/wlr-layer-shell-unstable-v1.xml $@
|
||||
wlr-layer-shell-unstable-v1-protocol.o: wlr-layer-shell-unstable-v1-protocol.h
|
||||
|
||||
dwl-ipc-unstable-v2-protocol.h:
|
||||
$(WAYLAND_SCANNER) client-header protocols/dwl-ipc-unstable-v2.xml $@
|
||||
dwl-ipc-unstable-v2-protocol.c:
|
||||
$(WAYLAND_SCANNER) private-code protocols/dwl-ipc-unstable-v2.xml $@
|
||||
dwl-ipc-unstable-v2-protocol.o: dwl-ipc-unstable-v2-protocol.h
|
||||
|
||||
dwlb.o: utf8.h config.h xdg-shell-protocol.h xdg-output-unstable-v1-protocol.h wlr-layer-shell-unstable-v1-protocol.h dwl-ipc-unstable-v2-protocol.h
|
||||
|
||||
# Protocol dependencies
|
||||
dwlb: xdg-shell-protocol.o xdg-output-unstable-v1-protocol.o wlr-layer-shell-unstable-v1-protocol.o dwl-ipc-unstable-v2-protocol.o
|
||||
|
||||
# Library dependencies
|
||||
dwlb: CFLAGS+=$(shell pkg-config --cflags wayland-client wayland-cursor fcft pixman-1)
|
||||
dwlb: LDLIBS+=$(shell pkg-config --libs wayland-client wayland-cursor fcft pixman-1) -lrt
|
||||
|
||||
.PHONY: all clean install
|
||||
.PHONY: all clean dist install uninstall
|
||||
|
||||
30
config.mk
Normal file
30
config.mk
Normal file
@ -0,0 +1,30 @@
|
||||
# Dwlb Version
|
||||
VERSION = 0.0.1
|
||||
|
||||
# Paths
|
||||
PREFIX = /usr/local
|
||||
MANPREFIX = ${PREFIX}/share/man
|
||||
|
||||
# includes and libs
|
||||
FCFT_LIB = `pkg-config --libs fcft`
|
||||
FCFT_INC = `pkg-config --cflags fcft`
|
||||
|
||||
PIXMAN_LIB = `pkg-config --libs pixman-1`
|
||||
PIXMAN_INC = `pkg-config --cflags pixman-1`
|
||||
|
||||
# Wayland Protocols
|
||||
WAYLAND_PROTOCOLS = `pkg-config --variable=pkgdatadir wayland-protocols`
|
||||
WAYLAND_SCANNER = `pkg-config --variable=wayland_scanner wayland-scanner`
|
||||
|
||||
WAYLAND_LIB = `pkg-config --libs wayland-client wayland-cursor`
|
||||
WAYLAND_INC = `pkg-config --cflags wayland-client wayland-cursor`
|
||||
|
||||
INCS = ${FCFT_INC} ${PIXMAN_INC} ${WAYLAND_INC}
|
||||
LIBS = ${FCFT_LIB} ${PIXMAN_LIB} ${WAYLAND_LIB}
|
||||
|
||||
# flags
|
||||
CFLAGS = -std=c99 -Wall -Wextra -Wno-unused-parameter -Wno-format-truncation -g -Os ${INCS}
|
||||
LDFLAGS = ${LIBS}
|
||||
|
||||
# compiler
|
||||
CC = cc
|
||||
Loading…
x
Reference in New Issue
Block a user