polytreewm/Makefile

123 lines
2.4 KiB
Makefile
Raw Permalink Normal View History

2021-11-16 18:00:30 -05:00
all: polytreewm
2021-12-04 14:05:07 -05:00
VERSION = 6.2
2021-11-16 18:05:40 -05:00
include config/1-generated.mk
2021-11-16 18:07:04 -05:00
include config/2-conditionals.mk
include config/3-defvars.mk
2021-11-16 18:16:14 -05:00
CONFIGMKS_TO_REMOVE = \
2021-11-16 18:05:40 -05:00
config/1-generated.mk \
2021-11-16 18:16:14 -05:00
config/2-conditionals.mk
CONFIGMKS = \
$(CONFIGMKS_TO_REMOVE) \
2021-11-16 18:07:04 -05:00
config/3-defvars.mk
2021-11-16 14:48:06 -05:00
2022-09-09 09:13:04 -04:00
RUST_SRC = \
rust-polytreewm/Cargo.toml \
rust-polytreewm/src/*.rs \
rust-polytreewm/src/**/*.rs
2022-09-09 11:01:37 -04:00
RUST_APIS = \
src/atoms.h \
src/constraints.h \
src/geom.h \
src/helpers.h \
src/settings.h
2022-09-08 15:17:51 -04:00
2021-11-16 21:34:53 -05:00
MODULES_SRC = \
src/config/keys.c \
src/config/buttons.c \
src/config/layouts.c \
src/drw.c \
2021-11-20 20:29:09 -05:00
src/dwm.c \
2021-12-04 12:14:07 -05:00
src/geom.c \
2021-12-04 13:42:03 -05:00
src/logger.c \
src/spawn.c \
2021-11-20 14:34:34 -05:00
src/state.c \
2021-11-16 21:56:19 -05:00
src/unit.c \
src/util.c \
src/xbase.c
DWM_SRC = \
2022-09-09 16:44:59 -04:00
src/dwm/spaghetti/bar.c \
src/dwm/spaghetti/handlers.c \
src/dwm/spaghetti/layouts.c \
src/dwm/spaghetti/wmcheckwin.c \
src/dwm/spaghetti/xerror.c
2006-07-12 19:30:55 -04:00
2021-12-04 13:42:03 -05:00
TEST_SRC = \
2021-12-04 14:31:40 -05:00
tests/geom_basic_geom.c \
2021-12-04 13:42:03 -05:00
tests/geom_position.c \
tests/geom_sizes.c \
tests/geom_win_geom.c
2021-12-04 13:42:03 -05:00
MAIN_SRC = $(MODULES_SRC) src/main.c
MODULES_HDR = $(MODULES_SRC:.c=.h) $(RUST_APIS) src/config/common.h
2022-09-09 16:47:55 -04:00
DWM_HDR = $(DWM_SRC:.c=.h) src/dwm/types.h
2021-12-04 14:17:10 -05:00
MAIN_HDR = $(MODULES_HDR) src/main.h
2021-11-16 21:34:53 -05:00
2021-12-04 13:42:03 -05:00
MODULES_OBJ = $(MODULES_SRC:.c=.o)
2021-12-04 14:03:55 -05:00
TEST_OBJ = $(TEST_SRC:.c=.o)
ALL_OBJ = $(MODULES_OBJ) $(TEST_OBJ) tests/main.o src/main.o
2021-11-16 21:34:53 -05:00
2021-12-04 13:42:03 -05:00
TEST_EXE = $(TEST_SRC:.c=.test)
ALL_EXE = polytreewm $(TEST_EXE)
2021-11-16 10:03:26 -05:00
2021-12-04 14:03:55 -05:00
###############
# Executables #
###############
2022-09-09 10:11:21 -04:00
polytreewm: src/main.o $(MODULES_OBJ) target/debug/libpolytreewm.a
2021-12-04 14:03:55 -05:00
$(CC) -o $@ $^ $(LDFLAGS)
2022-09-09 10:11:21 -04:00
%.test: %.o tests/main.o $(MODULES_OBJ) target/debug/libpolytreewm.a
2021-12-04 13:42:03 -05:00
$(CC) -o $@ $^ $(LDFLAGS)
2021-12-04 14:03:55 -05:00
################
# Object files #
################
2021-12-04 13:42:03 -05:00
%.o: %.c $(CONFIGMKS) $(HDR)
2021-11-16 21:34:53 -05:00
$(CC) -c $< -o $@ $(CFLAGS)
2006-07-10 10:38:18 -04:00
2021-11-16 21:34:53 -05:00
dwm.o: $(DWM_SRC) $(DWM_HDR)
2006-07-10 10:38:18 -04:00
2022-09-08 15:17:51 -04:00
target/debug/libpolytreewm.a: $(RUST_SRC)
$(CARGO) build
2022-09-07 09:52:34 -04:00
2021-12-04 14:03:55 -05:00
#########
# Tasks #
#########
test: $(TEST_EXE)
@echo "$(TEST_EXE)" | awk '{ OFS="\n"; $$1=$$1 } 1' | /bin/sh
$(CARGO) test
2022-09-07 11:01:51 -04:00
$(CARGO) fmt --check
2022-09-08 17:38:34 -04:00
$(CARGO) clippy
2021-12-04 14:03:55 -05:00
2006-07-10 10:38:18 -04:00
clean:
2021-12-04 13:42:03 -05:00
rm -f $(ALL_OBJ) $(ALL_EXE)
2022-09-07 09:52:34 -04:00
$(CARGO) clean
2006-07-10 10:49:43 -04:00
2021-11-16 17:02:06 -05:00
distclean: clean
2021-11-16 18:16:14 -05:00
rm -f $(CONFIGMKS_TO_REMOVE)
2021-11-16 17:02:06 -05:00
2006-07-10 10:49:43 -04:00
install: all
2021-11-16 21:34:53 -05:00
mkdir -p $(DESTDIR)$(BINDIR)
cp -f polytreewm $(DESTDIR)$(BINDIR)
chmod 755 $(DESTDIR)$(BINDIR)/polytreewm
2021-11-12 03:42:58 -05:00
2021-11-16 21:34:53 -05:00
mkdir -p $(DESTDIR)$(MANDIR)/man1
sed "s/VERSION/$(VERSION)/g" < polytreewm.1 > $(DESTDIR)$(MANDIR)/man1/polytreewm.1
chmod 644 $(DESTDIR)$(MANDIR)/man1/polytreewm.1
2006-07-10 10:49:43 -04:00
uninstall:
2021-11-12 03:42:58 -05:00
rm -f \
2021-11-16 21:34:53 -05:00
$(DESTDIR)$(BINDIR)/polytreewm \
$(DESTDIR)$(MANDIR)/man1/polytreewm.1
2022-09-08 15:17:51 -04:00
.PHONY: all clean distclean install uninstall test