separate build to obj/ & include/
This commit is contained in:
parent
92167bff9e
commit
51e5de1c8b
2 changed files with 19 additions and 14 deletions
31
Makefile
31
Makefile
|
|
@ -5,7 +5,7 @@
|
||||||
include config.mk
|
include config.mk
|
||||||
|
|
||||||
# flags for compiling
|
# flags for compiling
|
||||||
DWLCPPFLAGS = -Ibuild -DWLR_USE_UNSTABLE -D_POSIX_C_SOURCE=200809L \
|
DWLCPPFLAGS = -I$(INCLUDE) -DWLR_USE_UNSTABLE -D_POSIX_C_SOURCE=200809L \
|
||||||
-DVERSION=\"$(VERSION)\" $(XWAYLAND)
|
-DVERSION=\"$(VERSION)\" $(XWAYLAND)
|
||||||
DWLDEVCFLAGS = -g -Wpedantic -Wall -Wextra -Wdeclaration-after-statement \
|
DWLDEVCFLAGS = -g -Wpedantic -Wall -Wextra -Wdeclaration-after-statement \
|
||||||
-Wno-unused-parameter -Wshadow -Wunused-macros -Werror=strict-prototypes \
|
-Wno-unused-parameter -Wshadow -Wunused-macros -Werror=strict-prototypes \
|
||||||
|
|
@ -21,8 +21,11 @@ LDLIBS = `$(PKG_CONFIG) --libs $(PKGS)` $(WLR_LIBS) -lm $(LIBS)
|
||||||
define mkbin
|
define mkbin
|
||||||
$(addprefix $(BIN)/,$1)
|
$(addprefix $(BIN)/,$1)
|
||||||
endef
|
endef
|
||||||
define mkbuild
|
define mkobj
|
||||||
$(addprefix $(BUILD)/,$1)
|
$(addprefix $(OBJ)/,$1)
|
||||||
|
endef
|
||||||
|
define mkinclude
|
||||||
|
$(addprefix $(INCLUDE)/,$1)
|
||||||
endef
|
endef
|
||||||
define mksrc
|
define mksrc
|
||||||
$(addprefix $(SRC)/,$1)
|
$(addprefix $(SRC)/,$1)
|
||||||
|
|
@ -30,15 +33,15 @@ endef
|
||||||
|
|
||||||
.PHONY: setup
|
.PHONY: setup
|
||||||
setup:
|
setup:
|
||||||
mkdir -p $(BIN) $(BUILD)
|
mkdir -p $(BIN) $(BUILD) $(INCLUDE) $(OBJ)
|
||||||
|
|
||||||
all: setup $(call mkbin,dwl)
|
all: setup $(call mkbin,dwl)
|
||||||
$(BIN)/dwl: $(call mkbuild,dwl.o util.o)
|
$(BIN)/dwl: $(call mkobj,dwl.o util.o)
|
||||||
$(CC) $^ $(DWLCFLAGS) $(LDFLAGS) $(LDLIBS) -o $@
|
$(CC) $^ $(DWLCFLAGS) $(LDFLAGS) $(LDLIBS) -o $@
|
||||||
$(BUILD)/dwl.o: $(call mksrc,dwl.c client.h) config.mk $(call mkbuild,config.h cursor-shape-v1-protocol.h \
|
$(OBJ)/dwl.o: $(call mksrc,dwl.c client.h) config.mk $(call mkinclude,config.h cursor-shape-v1-protocol.h \
|
||||||
pointer-constraints-unstable-v1-protocol.h wlr-layer-shell-unstable-v1-protocol.h \
|
pointer-constraints-unstable-v1-protocol.h wlr-layer-shell-unstable-v1-protocol.h \
|
||||||
wlr-output-power-management-unstable-v1-protocol.h xdg-shell-protocol.h)
|
wlr-output-power-management-unstable-v1-protocol.h xdg-shell-protocol.h)
|
||||||
$(BUILD)/util.o: $(call mksrc,util.c util.h)
|
$(OBJ)/util.o: $(call mksrc,util.c util.h)
|
||||||
|
|
||||||
# wayland-scanner is a tool which generates C headers and rigging for Wayland
|
# wayland-scanner is a tool which generates C headers and rigging for Wayland
|
||||||
# protocols, which are specified in XML. wlroots requires you to rig these up
|
# protocols, which are specified in XML. wlroots requires you to rig these up
|
||||||
|
|
@ -46,26 +49,26 @@ $(BUILD)/util.o: $(call mksrc,util.c util.h)
|
||||||
WAYLAND_SCANNER = `$(PKG_CONFIG) --variable=wayland_scanner wayland-scanner`
|
WAYLAND_SCANNER = `$(PKG_CONFIG) --variable=wayland_scanner wayland-scanner`
|
||||||
WAYLAND_PROTOCOLS = `$(PKG_CONFIG) --variable=pkgdatadir wayland-protocols`
|
WAYLAND_PROTOCOLS = `$(PKG_CONFIG) --variable=pkgdatadir wayland-protocols`
|
||||||
|
|
||||||
$(BUILD)/cursor-shape-v1-protocol.h:
|
$(INCLUDE)/cursor-shape-v1-protocol.h:
|
||||||
$(WAYLAND_SCANNER) enum-header \
|
$(WAYLAND_SCANNER) enum-header \
|
||||||
$(WAYLAND_PROTOCOLS)/staging/cursor-shape/cursor-shape-v1.xml $@
|
$(WAYLAND_PROTOCOLS)/staging/cursor-shape/cursor-shape-v1.xml $@
|
||||||
$(BUILD)/pointer-constraints-unstable-v1-protocol.h:
|
$(INCLUDE)/pointer-constraints-unstable-v1-protocol.h:
|
||||||
$(WAYLAND_SCANNER) enum-header \
|
$(WAYLAND_SCANNER) enum-header \
|
||||||
$(WAYLAND_PROTOCOLS)/unstable/pointer-constraints/pointer-constraints-unstable-v1.xml $@
|
$(WAYLAND_PROTOCOLS)/unstable/pointer-constraints/pointer-constraints-unstable-v1.xml $@
|
||||||
$(BUILD)/wlr-layer-shell-unstable-v1-protocol.h:
|
$(INCLUDE)/wlr-layer-shell-unstable-v1-protocol.h:
|
||||||
$(WAYLAND_SCANNER) enum-header \
|
$(WAYLAND_SCANNER) enum-header \
|
||||||
protocols/wlr-layer-shell-unstable-v1.xml $@
|
protocols/wlr-layer-shell-unstable-v1.xml $@
|
||||||
$(BUILD)/wlr-output-power-management-unstable-v1-protocol.h:
|
$(INCLUDE)/wlr-output-power-management-unstable-v1-protocol.h:
|
||||||
$(WAYLAND_SCANNER) server-header \
|
$(WAYLAND_SCANNER) server-header \
|
||||||
protocols/wlr-output-power-management-unstable-v1.xml $@
|
protocols/wlr-output-power-management-unstable-v1.xml $@
|
||||||
$(BUILD)/xdg-shell-protocol.h:
|
$(INCLUDE)/xdg-shell-protocol.h:
|
||||||
$(WAYLAND_SCANNER) server-header \
|
$(WAYLAND_SCANNER) server-header \
|
||||||
$(WAYLAND_PROTOCOLS)/stable/xdg-shell/xdg-shell.xml $@
|
$(WAYLAND_PROTOCOLS)/stable/xdg-shell/xdg-shell.xml $@
|
||||||
|
|
||||||
$(BUILD)/config.h:
|
$(INCLUDE)/config.h:
|
||||||
cp $(SRC)/config.def.h $@
|
cp $(SRC)/config.def.h $@
|
||||||
clean:
|
clean:
|
||||||
rm -rf $(BUILD) $(BIN)
|
rm -rf $(INCLUDE) $(OBJ) $(BUILD) $(BIN)
|
||||||
|
|
||||||
dist: clean
|
dist: clean
|
||||||
mkdir -p dwl-$(VERSION)
|
mkdir -p dwl-$(VERSION)
|
||||||
|
|
|
||||||
|
|
@ -10,6 +10,8 @@ DATADIR = $(PREFIX)/share
|
||||||
|
|
||||||
SRC = src
|
SRC = src
|
||||||
BUILD = build
|
BUILD = build
|
||||||
|
OBJ = $(BUILD)/obj
|
||||||
|
INCLUDE = $(BUILD)/include
|
||||||
BIN = bin
|
BIN = bin
|
||||||
|
|
||||||
WLR_INCS = `$(PKG_CONFIG) --cflags wlroots-0.19`
|
WLR_INCS = `$(PKG_CONFIG) --cflags wlroots-0.19`
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue