-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
122 lines (94 loc) · 2.44 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
all: polytreewm
VERSION = 6.2
include config/1-generated.mk
include config/2-conditionals.mk
include config/3-defvars.mk
CONFIGMKS_TO_REMOVE = \
config/1-generated.mk \
config/2-conditionals.mk
CONFIGMKS = \
$(CONFIGMKS_TO_REMOVE) \
config/3-defvars.mk
RUST_SRC = \
rust-polytreewm/Cargo.toml \
rust-polytreewm/src/*.rs \
rust-polytreewm/src/**/*.rs
RUST_APIS = \
src/atoms.h \
src/constraints.h \
src/geom.h \
src/helpers.h \
src/settings.h
MODULES_SRC = \
src/config/keys.c \
src/config/buttons.c \
src/config/layouts.c \
src/drw.c \
src/dwm.c \
src/geom.c \
src/logger.c \
src/spawn.c \
src/state.c \
src/unit.c \
src/util.c \
src/xbase.c
DWM_SRC = \
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
TEST_SRC = \
tests/geom_basic_geom.c \
tests/geom_position.c \
tests/geom_sizes.c \
tests/geom_win_geom.c
MAIN_SRC = $(MODULES_SRC) src/main.c
MODULES_HDR = $(MODULES_SRC:.c=.h) $(RUST_APIS) src/config/common.h
DWM_HDR = $(DWM_SRC:.c=.h) src/dwm/types.h
MAIN_HDR = $(MODULES_HDR) src/main.h
MODULES_OBJ = $(MODULES_SRC:.c=.o)
TEST_OBJ = $(TEST_SRC:.c=.o)
ALL_OBJ = $(MODULES_OBJ) $(TEST_OBJ) tests/main.o src/main.o
TEST_EXE = $(TEST_SRC:.c=.test)
ALL_EXE = polytreewm $(TEST_EXE)
###############
# Executables #
###############
polytreewm: src/main.o $(MODULES_OBJ) target/debug/libpolytreewm.a
$(CC) -o $@ $^ $(LDFLAGS)
%.test: %.o tests/main.o $(MODULES_OBJ) target/debug/libpolytreewm.a
$(CC) -o $@ $^ $(LDFLAGS)
################
# Object files #
################
%.o: %.c $(CONFIGMKS) $(HDR)
$(CC) -c $< -o $@ $(CFLAGS)
dwm.o: $(DWM_SRC) $(DWM_HDR)
target/debug/libpolytreewm.a: $(RUST_SRC)
$(CARGO) build
#########
# Tasks #
#########
test: $(TEST_EXE)
@echo "$(TEST_EXE)" | awk '{ OFS="\n"; $$1=$$1 } 1' | /bin/sh
$(CARGO) test
$(CARGO) fmt --check
$(CARGO) clippy
clean:
rm -f $(ALL_OBJ) $(ALL_EXE)
$(CARGO) clean
distclean: clean
rm -f $(CONFIGMKS_TO_REMOVE)
install: all
mkdir -p $(DESTDIR)$(BINDIR)
cp -f polytreewm $(DESTDIR)$(BINDIR)
chmod 755 $(DESTDIR)$(BINDIR)/polytreewm
mkdir -p $(DESTDIR)$(MANDIR)/man1
sed "s/VERSION/$(VERSION)/g" < polytreewm.1 > $(DESTDIR)$(MANDIR)/man1/polytreewm.1
chmod 644 $(DESTDIR)$(MANDIR)/man1/polytreewm.1
uninstall:
rm -f \
$(DESTDIR)$(BINDIR)/polytreewm \
$(DESTDIR)$(MANDIR)/man1/polytreewm.1
.PHONY: all clean distclean install uninstall test