forked from herbstluftwm/herbstluftwm
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
177 lines (150 loc) · 5.85 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
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
include version.mk
include config.mk
include colors.mk
HLWMSRC = $(wildcard src/*.cpp)
HLWMOBJ = $(HLWMSRC:.cpp=.o)
HLWMTARGET = herbstluftwm
HCSRC = $(wildcard ipc-client/*.c)
HCOBJ = $(HCSRC:.c=.o)
HCTARGET = herbstclient
TARGETS = $(HLWMTARGET) $(HCTARGET)
OBJ = $(HLWMOBJ) $(HCOBJ)
DEPS = $(OBJ:.o=.d)
HERBSTCLIENTDOC = doc/herbstclient.txt
HERBSTLUFTWMDOC = doc/herbstluftwm.txt
TUTORIAL = doc/herbstluftwm-tutorial.txt
.PHONY: depend all all-nodoc doc install install-nodoc info www
.PHONY: cleandoc cleanwww cleandeps clean
all: $(TARGETS) doc
all-nodoc: $(TARGETS)
$(HCTARGET): $(HCOBJ)
$(call colorecho,LD,$@)
$(VERBOSE) $(LD) -o $@ $(CFLAGS) $(LDFLAGS) $^ $(LIBS)
$(HLWMTARGET): $(HLWMOBJ)
$(LDXX) -o $@ $(CXXFLAGS) $(LDXXFLAGS) $^ $(LIBS)
-include $(DEPS)
%.o: %.c version.mk
$(call colorecho,CC,$<)
$(VERBOSE) $(CC) -c $(CPPFLAGS) $(CFLAGS) -o $@ $<
$(VERBOSE) $(CC) -c $(CPPFLAGS) -o $*.d -MT $@ -MM $<
%.o: %.cpp version.mk
$(call colorecho,CXX,$<)
$(VERBOSE) $(CXX) -c $(CPPFLAGS) $(CXXFLAGS) -o $@ $<
$(VERBOSE) $(CXX) -c $(CPPFLAGS) $(CXXFLAGS) -o $*.d -MT $@ -MM $<
info:
@echo Some Info:
@echo Preprocessing with: $(CC) -E $(CPPFLAGS)
@echo Compiling C with: $(CC) -c $(CPPFLAGS) $(CFLAGS) -o OUT INPUT
@echo Compiling C++ with: $(CXX) -c $(CPPFLAGS) $(CXXFLAGS) -o OUT INPUT
@echo Linking with: $(LD) -o OUT $(LDFLAGS) INPUT
clean: cleandoc cleandeps
$(call colorecho,RM,$(TARGETS))
$(VERBOSE) rm -f $(TARGETS)
$(call colorecho,RM,$(OBJ))
$(VERBOSE) rm -f $(OBJ)
cleandeps:
$(call colorecho,RM,$(DEPS))
$(VERBOSE) rm -f $(DEPS)
cleandoc:
$(call colorecho,RM,doc/herbstclient.1)
$(VERBOSE) rm -f doc/herbstclient.1
$(call colorecho,RM,doc/herbstclient.html)
$(VERBOSE) rm -f doc/herbstclient.html
$(call colorecho,RM,doc/herbstluftwm.1)
$(VERBOSE) rm -f doc/herbstluftwm.1
$(call colorecho,RM,doc/herbstluftwm.html)
$(VERBOSE) rm -f doc/herbstluftwm.html
$(call colorecho,RM,doc/herbstluftwm-tutorial.7)
$(VERBOSE) rm -f doc/herbstluftwm-tutorial.7
$(call colorecho,RM,doc/herbstluftwm-tutorial.html)
$(VERBOSE) rm -f doc/herbstluftwm-tutorial.html
doc: doc/herbstclient.1 \
doc/herbstclient.html \
doc/herbstluftwm.1 \
doc/herbstluftwm.html \
doc/herbstluftwm-tutorial.7 \
doc/herbstluftwm-tutorial.html
tar: doc
tar -czf $(TARFILE) `git ls-files` doc/*.html doc/*.[0-9]
rm -rf $(TMPTARDIR)
mkdir -p $(TMPTARDIR)
tar -xvf $(TARFILE) -C $(TMPTARDIR)
tar -czf $(TARFILE) $(TMPTARDIR)
rm -rf $(TMPTARDIR)
gpg --detach-sign $(TARFILE)
doc/%.1 doc/%.7: doc/%.txt version.mk
$(call colorecho,DOC,$@)
$(VERBOSE) $(A2X) -f manpage -a "herbstluftwmversion=herbstluftwm $(VERSION)" -a "date=`date +%Y-%m-%d`" $<
doc/%.html: doc/%.txt version.mk
$(call colorecho,DOC,$@)
$(VERBOSE) $(ASCIIDOC) $<
install: all install-nodoc
@echo "==> creating dirs..."
$(MKDIR) '$(DESTDIR)$(MAN1DIR)'
$(MKDIR) '$(DESTDIR)$(MAN7DIR)'
$(MKDIR) '$(DESTDIR)$(DOCDIR)'
@echo "==> copying files..."
$(INSTALL) -m 644 doc/herbstclient.1 '$(DESTDIR)$(MAN1DIR)/'
$(INSTALL) -m 644 doc/herbstluftwm.1 '$(DESTDIR)$(MAN1DIR)/'
$(INSTALL) -m 644 doc/herbstluftwm-tutorial.7 '$(DESTDIR)$(MAN7DIR)/'
$(INSTALL) -m 644 doc/herbstclient.html '$(DESTDIR)$(DOCDIR)/'
$(INSTALL) -m 644 doc/herbstluftwm.html '$(DESTDIR)$(DOCDIR)/'
$(INSTALL) -m 644 doc/herbstluftwm-tutorial.html '$(DESTDIR)$(DOCDIR)/'
install-nodoc: all-nodoc
@echo "==> creating dirs..."
$(MKDIR) '$(DESTDIR)$(LICENSEDIR)'
$(MKDIR) '$(DESTDIR)$(BINDIR)'
$(MKDIR) '$(DESTDIR)$(DOCDIR)'
$(MKDIR) '$(DESTDIR)$(EXAMPLESDIR)'
$(MKDIR) '$(DESTDIR)$(BASHCOMPLETIONDIR)'
$(MKDIR) '$(DESTDIR)$(CONFIGDIR)'
$(MKDIR) '$(DESTDIR)$(ZSHCOMPLETIONDIR)'
$(MKDIR) '$(DESTDIR)$(FISHCOMPLETIONDIR)'
$(MKDIR) '$(DESTDIR)$(XSESSIONSDIR)'
@echo "==> copying files..."
$(INSTALL) $(TARGETS) '$(DESTDIR)$(BINDIR)/'
$(INSTALL) -m 644 LICENSE '$(DESTDIR)$(LICENSEDIR)/'
$(INSTALL) -m 644 BUGS '$(DESTDIR)$(DOCDIR)/'
$(INSTALL) -m 644 NEWS '$(DESTDIR)$(DOCDIR)/'
$(INSTALL) -m 644 INSTALL '$(DESTDIR)$(DOCDIR)/'
$(INSTALL) -m 755 share/autostart '$(DESTDIR)$(CONFIGDIR)/'
$(INSTALL) -m 755 share/panel.sh '$(DESTDIR)$(CONFIGDIR)/'
$(INSTALL) -m 755 share/restartpanels.sh '$(DESTDIR)$(CONFIGDIR)/'
$(INSTALL) -m 644 share/herbstclient-completion '$(DESTDIR)$(BASHCOMPLETIONDIR)/'
$(INSTALL) -m 644 share/herbstclient.fish '$(DESTDIR)$(FISHCOMPLETIONDIR)/'
$(INSTALL) -m 644 share/_herbstclient '$(DESTDIR)$(ZSHCOMPLETIONDIR)/'
$(INSTALL) -m 644 share/herbstluftwm.desktop '$(DESTDIR)$(XSESSIONSDIR)/'
$(INSTALL) -m 755 share/dmenu_run_hlwm '$(DESTDIR)$(BINDIR)/'
$(INSTALL) -m 644 scripts/README '$(DESTDIR)$(EXAMPLESDIR)/'
$(INSTALL) -m 755 scripts/*.sh '$(DESTDIR)$(EXAMPLESDIR)/'
uninstall:
@echo "==> deleting files..."
-$(foreach TARGET,$(TARGETS),$(RM) '$(DESTDIR)$(BINDIR)/$(TARGET)';)
-$(RM) '$(DESTDIR)$(BINDIR)/dmenu_run_hlwm'
-$(RM) '$(DESTDIR)$(LICENSEDIR)/LICENSE'
-$(RM) '$(DESTDIR)$(MAN1DIR)/herbstclient.1'
-$(RM) '$(DESTDIR)$(MAN1DIR)/herbstluftwm.1'
-$(RM) '$(DESTDIR)$(MAN7DIR)/herbstluftwm-tutorial.7'
-$(RM) '$(DESTDIR)$(DOCDIR)/herbstclient.html'
-$(RM) '$(DESTDIR)$(DOCDIR)/herbstluftwm.html'
-$(RM) '$(DESTDIR)$(DOCDIR)/herbstluftwm-tutorial.html'
-$(RM) '$(DESTDIR)$(DOCDIR)/BUGS'
-$(RM) '$(DESTDIR)$(DOCDIR)/NEWS'
-$(RM) '$(DESTDIR)$(DOCDIR)/INSTALL'
-$(RM) '$(DESTDIR)$(CONFIGDIR)/autostart'
-$(RM) '$(DESTDIR)$(CONFIGDIR)/panel.sh'
-$(RM) '$(DESTDIR)$(CONFIGDIR)/restartpanels.sh'
-$(RM) '$(DESTDIR)$(BASHCOMPLETIONDIR)/herbstclient-completion'
-$(RM) '$(DESTDIR)$(FISHCOMPLETIONDIR)/herbstclient.fish'
-$(RM) '$(DESTDIR)$(ZSHCOMPLETIONDIR)/_herbstclient'
-$(RM) '$(DESTDIR)$(XSESSIONSDIR)/herbstluftwm.desktop'
-$(RM) '$(DESTDIR)$(EXAMPLESDIR)/README'
-$(RM) '$(DESTDIR)$(EXAMPLESDIR)'/*.sh
@echo "==> deleting directories..."
-$(RMDIR) '$(DESTDIR)$(EXAMPLESDIR)/'
-$(RMDIR) '$(DESTDIR)$(DOCDIR)/'
-$(RMDIR) '$(DESTDIR)$(CONFIGDIR)/'
www:
make -C www
cleanwww:
make -C www clean