diff --git a/Makefile b/Makefile index ac37303..c3126b6 100644 --- a/Makefile +++ b/Makefile @@ -5,7 +5,7 @@ include config.mk # 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) DWLDEVCFLAGS = -g -Wpedantic -Wall -Wextra -Wdeclaration-after-statement \ -Wno-unused-parameter -Wshadow -Wunused-macros -Werror=strict-prototypes \ @@ -21,8 +21,11 @@ LDLIBS = `$(PKG_CONFIG) --libs $(PKGS)` $(WLR_LIBS) -lm $(LIBS) define mkbin $(addprefix $(BIN)/,$1) endef -define mkbuild -$(addprefix $(BUILD)/,$1) +define mkobj +$(addprefix $(OBJ)/,$1) +endef +define mkinclude +$(addprefix $(INCLUDE)/,$1) endef define mksrc $(addprefix $(SRC)/,$1) @@ -30,15 +33,15 @@ endef .PHONY: setup setup: - mkdir -p $(BIN) $(BUILD) + mkdir -p $(BIN) $(BUILD) $(INCLUDE) $(OBJ) 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 $@ -$(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 \ 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 # 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_PROTOCOLS = `$(PKG_CONFIG) --variable=pkgdatadir wayland-protocols` -$(BUILD)/cursor-shape-v1-protocol.h: +$(INCLUDE)/cursor-shape-v1-protocol.h: $(WAYLAND_SCANNER) enum-header \ $(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_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 \ 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 \ protocols/wlr-output-power-management-unstable-v1.xml $@ -$(BUILD)/xdg-shell-protocol.h: +$(INCLUDE)/xdg-shell-protocol.h: $(WAYLAND_SCANNER) server-header \ $(WAYLAND_PROTOCOLS)/stable/xdg-shell/xdg-shell.xml $@ -$(BUILD)/config.h: +$(INCLUDE)/config.h: cp $(SRC)/config.def.h $@ clean: - rm -rf $(BUILD) $(BIN) + rm -rf $(INCLUDE) $(OBJ) $(BUILD) $(BIN) dist: clean mkdir -p dwl-$(VERSION) diff --git a/config.mk b/config.mk index c58e660..7d1dc14 100644 --- a/config.mk +++ b/config.mk @@ -10,6 +10,8 @@ DATADIR = $(PREFIX)/share SRC = src BUILD = build +OBJ = $(BUILD)/obj +INCLUDE = $(BUILD)/include BIN = bin WLR_INCS = `$(PKG_CONFIG) --cflags wlroots-0.19`