-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
131 lines (100 loc) · 3.17 KB
/
Copy pathMakefile
File metadata and controls
131 lines (100 loc) · 3.17 KB
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
123
124
125
126
127
128
129
130
# st-wl - simple terminal
# See LICENSE file for copyright and license details.
CC = gcc
CFLAGS = -pipe
ifeq (,$(findstring j,$(MAKEFLAGS)))
CPUS ?= $(shell nproc)
MAKEFLAGS += -j $(CPUS)
endif
include config.mk
THISDIR := $(dir $(abspath $(lastword $(MAKEFILE_LIST))))
ifdef DEBUG
DEBUGFLAGS=-O0 -g -DDEBUG
endif
SRC = st.c wl.c xdg-shell-protocol.c xdg-decoration-protocol.c $(SIXEL_C) $(LIGATURES_C)
OBJ = $(SRC:%.c=.objects/%.o)
DEP = $(SRC:%.c=.deps/%.d)
all: bump-version st-wl
bump-version:
@old=$$(grep '^VERSION = ' config.mk | sed 's/VERSION = //'); \
patch=$$(echo $$old | cut -d. -f3); \
new=$$(echo $$old | sed "s/\.$${patch}$$/.$$(( patch + 1 ))/"); \
sed -i "s/^VERSION = .*/VERSION = $$new/" config.mk; \
echo " VER $$new"
.PHONY: bump-version
options:
@echo st-wl build options:
@echo "CFLAGS = $(STCFLAGS)"
@echo "LDFLAGS = $(STLDFLAGS)"
@echo "CC = $(CC)"
@touch options
config.h: config.def.h
cp config.def.h config.h
patches.h: patches.def.h
cp patches.def.h patches.h
xdg-shell-protocol.c:
@echo GEN $@
@wayland-scanner private-code $(XDG_SHELL_PROTO) $@
xdg-shell-client-protocol.h:
@echo GEN $@
@wayland-scanner client-header $(XDG_SHELL_PROTO) $@
xdg-decoration-protocol.c:
@echo GEN $@
@wayland-scanner private-code $(XDG_DECORATION_PROTO) $@
xdg-decoration-protocol.h:
@echo GEN $@
@wayland-scanner client-header $(XDG_DECORATION_PROTO) $@
ifeq ($(if $(V),$(V),0), 0)
define quiet
@echo " $1 $(notdir $(<:%.c=.objects/%.o))"
@$(if $2,$2,$($1))
endef
define quietlink
@echo " $1 $@"
@$(if $2,$2,$($1))
endef
else
define quiet
$(if $2,$2,$($1))
endef
define quietlink
$(if $2,$2,$($1))
endef
endif
.objects/%.o .deps/%.d: %.c | .deps .objects
$(call quiet,CC) $(STCFLAGS) -c $< -o .objects/$*.o -MMD -MP -MF .deps/$*.d -MT .objects/$*.o
.objects/wl.o: xdg-shell-client-protocol.h xdg-decoration-protocol.h
$(OBJ): config.h config.mk patches.h
# just to make sure that the options rule is run first
$(THISDIR)wld/libwld.a config.h config.mk patches.h: options
st-wl: $(THISDIR)wld/libwld.a $(OBJ)
$(call quietlink,CC) $(STCFLAGS) -o $@ $(OBJ) $(STLDFLAGS)
$(THISDIR)wld/.objects/%.o:
@rm -f $@
$(THISDIR)wld/libwld.a:
@DEBUGFLAGS="$(DEBUGFLAGS)" $(MAKE) -C wld
.deps .objects:
@mkdir "$@"
clean:
rm -rf .objects .deps
rm -f st-wl st-wl-$(VERSION).tar.gz config.h options patches.h xdg-decoration-* xdg-shell-*
$(MAKE) -C wld clean
install: st-wl
mkdir -p $(DESTDIR)$(PREFIX)/bin
cp -f st-wl $(DESTDIR)$(PREFIX)/bin
strip $(DESTDIR)$(PREFIX)/bin/st-wl
chmod 755 $(DESTDIR)$(PREFIX)/bin/st-wl
mkdir -p $(DESTDIR)$(MANPREFIX)/man1
sed "s/VERSION/$(VERSION)/g" < st-wl.1 > $(DESTDIR)$(MANPREFIX)/man1/st-wl.1
chmod 644 $(DESTDIR)$(MANPREFIX)/man1/st-wl.1
tic -sx st-wl.info
mkdir -p $(DESTDIR)$(PREFIX)/share/applications
cp st-wl.desktop $(DESTDIR)$(PREFIX)/share/applications
@echo Please see the README file regarding the terminfo entry of st-wl.
uninstall:
rm -f $(DESTDIR)$(PREFIX)/bin/st-wl
rm -f $(DESTDIR)$(MANPREFIX)/man1/st-wl.1
rm -f $(DESTDIR)$(PREFIX)/share/applications/st-wl.desktop
.PHONY: all clean dist install uninstall
-include wld/.deps/*.d
-include $(DEP)