Begin X4 prototype
[khatus.git] / x2 / Makefile
1 MAKEFLAGS := --no-builtin-rules
2
3 PREFIX := $(HOME)
4 PATH_TO_AWK := /usr/bin/awk
5 AWK_EXECUTABLES := \
6 bin/khatus_bar \
7 bin/khatus_actuate_alert_to_notify_send \
8 bin/khatus_actuate_device_add_to_automount \
9 bin/khatus_actuate_status_bar_to_xsetroot_name \
10 bin/khatus_gen_bar_make_status \
11 bin/khatus_monitor_devices \
12 bin/khatus_monitor_energy \
13 bin/khatus_monitor_errors \
14 bin/khatus_parse_bluetoothctl_show \
15 bin/khatus_parse_df_pcent \
16 bin/khatus_parse_fan_file \
17 bin/khatus_parse_free \
18 bin/khatus_parse_ip_addr \
19 bin/khatus_parse_iwconfig \
20 bin/khatus_parse_loadavg_file \
21 bin/khatus_parse_noaa_api \
22 bin/khatus_parse_mpd_status_currentsong \
23 bin/khatus_parse_pactl_list_sinks \
24 bin/khatus_parse_ps \
25 bin/khatus_parse_sys_block_stat \
26 bin/khatus_parse_udevadm_monitor_block \
27 bin/khatus_parse_upower
28 BASH_EXECUTABLE_NAMES := \
29 khatus \
30 khatus_sensor_bluetooth_power \
31 khatus_sensor_datetime \
32 khatus_sensor_devices \
33 khatus_sensor_disk_io \
34 khatus_sensor_disk_space \
35 khatus_sensor_energy \
36 khatus_sensor_fan \
37 khatus_sensor_loadavg \
38 khatus_sensor_memory \
39 khatus_sensor_mpd \
40 khatus_sensor_net_addr_io \
41 khatus_sensor_net_wifi_status \
42 khatus_sensor_procs \
43 khatus_sensor_screen_brightness \
44 khatus_sensor_temperature \
45 khatus_sensor_volume \
46 khatus_sensor_weather
47 BASH_EXECUTABLES := $(foreach exe,$(BASH_EXECUTABLE_NAMES),bin/$(exe))
48 EXECUTABLES := $(AWK_EXECUTABLES) $(BASH_EXECUTABLES)
49
50 define BUILD_AWK_EXE
51 echo '#! $(PATH_TO_AWK) -f' > $@ && \
52 echo 'BEGIN {Node = Node ? Node : "$(shell hostname)"}' >> $@ && \
53 echo 'BEGIN {Module = "$(notdir $@)"}' >> $@ && \
54 cat $^ >> $@ && \
55 chmod +x $@
56 endef
57
58 define BUILD_BASH_EXE
59 cat $^ > $@ && \
60 chmod +x $@
61 endef
62
63 define GEN_BASH_EXE_RULE
64 bin/$(1) : src/bash/exe/$(1).sh
65 $$(BUILD_BASH_EXE)
66 endef
67
68 .PHONY: \
69 build \
70 rebuild \
71 install \
72 uninstall \
73 reinstall \
74 clean
75
76 build: | bin
77 build: $(EXECUTABLES)
78
79 install:
80 @$(foreach filename,$(wildcard bin/*),cp -p "$(filename)" "$(PREFIX)/$(filename)"; )
81
82 uninstall:
83 @$(foreach filename,$(wildcard $(PREFIX)/bin/khatus*),rm "$(filename)"; )
84
85 reinstall:
86 @$(MAKE) -s uninstall
87 @$(MAKE) -s install
88
89 rebuild:
90 @$(MAKE) -s clean
91 @$(MAKE) -s build
92
93 clean:
94 rm -rf bin
95
96 bin:
97 mkdir -p bin
98
99 #-----------------------------------------------------------------------------
100 # Bash
101 #-----------------------------------------------------------------------------
102 $(foreach exe,$(BASH_EXECUTABLE_NAMES),$(eval $(call GEN_BASH_EXE_RULE,$(exe))))
103
104 #-----------------------------------------------------------------------------
105 # AWK
106 #-----------------------------------------------------------------------------
107 bin/khatus_bar: \
108 src/awk/exe/bar.awk \
109 src/awk/lib/cache.awk \
110 src/awk/lib/str.awk \
111 src/awk/lib/msg.awk \
112 src/awk/lib/num.awk
113 $(BUILD_AWK_EXE)
114
115 bin/khatus_actuate_alert_to_notify_send: \
116 src/awk/exe/actuate_alert_to_notify_send.awk \
117 src/awk/lib/str.awk \
118 src/awk/lib/msg.awk
119 $(BUILD_AWK_EXE)
120
121 bin/khatus_actuate_device_add_to_automount: \
122 src/awk/exe/actuate_device_add_to_automount.awk \
123 src/awk/lib/str.awk \
124 src/awk/lib/msg.awk
125 $(BUILD_AWK_EXE)
126
127 bin/khatus_actuate_status_bar_to_xsetroot_name: \
128 src/awk/exe/actuate_status_bar_to_xsetroot_name.awk \
129 src/awk/lib/str.awk \
130 src/awk/lib/msg.awk
131 $(BUILD_AWK_EXE)
132
133 bin/khatus_gen_bar_make_status: \
134 src/awk/exe/gen_bar_make_status.awk
135 $(BUILD_AWK_EXE)
136
137 bin/khatus_monitor_devices: \
138 src/awk/exe/monitor_devices.awk \
139 src/awk/lib/str.awk \
140 src/awk/lib/msg.awk
141 $(BUILD_AWK_EXE)
142
143 bin/khatus_monitor_energy: \
144 src/awk/exe/monitor_energy.awk \
145 src/awk/lib/str.awk \
146 src/awk/lib/msg.awk \
147 src/awk/lib/num.awk
148 $(BUILD_AWK_EXE)
149
150 bin/khatus_monitor_errors: \
151 src/awk/exe/monitor_errors.awk \
152 src/awk/lib/str.awk \
153 src/awk/lib/msg.awk
154 $(BUILD_AWK_EXE)
155
156 bin/khatus_parse_bluetoothctl_show: \
157 src/awk/exe/parse_bluetoothctl_show.awk \
158 src/awk/lib/msg.awk
159 $(BUILD_AWK_EXE)
160
161 bin/khatus_parse_df_pcent: \
162 src/awk/exe/parse_df_pcent.awk \
163 src/awk/lib/msg.awk
164 $(BUILD_AWK_EXE)
165
166 bin/khatus_parse_fan_file: \
167 src/awk/exe/parse_fan_file.awk \
168 src/awk/lib/msg.awk
169 $(BUILD_AWK_EXE)
170
171 bin/khatus_parse_free: \
172 src/awk/exe/parse_free.awk \
173 src/awk/lib/msg.awk
174 $(BUILD_AWK_EXE)
175
176 bin/khatus_parse_ip_addr: \
177 src/awk/exe/parse_ip_addr.awk \
178 src/awk/lib/msg.awk
179 $(BUILD_AWK_EXE)
180
181 bin/khatus_parse_iwconfig: \
182 src/awk/exe/parse_iwconfig.awk \
183 src/awk/lib/msg.awk
184 $(BUILD_AWK_EXE)
185
186 bin/khatus_parse_loadavg_file: \
187 src/awk/exe/parse_loadavg_file.awk \
188 src/awk/lib/msg.awk
189 $(BUILD_AWK_EXE)
190
191 # Order of dependencies is important for khatus_parse_noaa_api!
192 # parse_hxpipe MUST appear before parse_noaa_api, because the order in
193 # which they match lines matters!
194 bin/khatus_parse_noaa_api: \
195 src/awk/lib/parse_hxpipe.awk \
196 src/awk/exe/parse_noaa_api.awk \
197 src/awk/lib/msg.awk \
198 src/awk/lib/str.awk
199 $(BUILD_AWK_EXE)
200
201 bin/khatus_parse_mpd_status_currentsong: \
202 src/awk/exe/parse_mpd_status_currentsong.awk \
203 src/awk/lib/msg.awk
204 $(BUILD_AWK_EXE)
205
206 bin/khatus_parse_pactl_list_sinks: \
207 src/awk/exe/parse_pactl_list_sinks.awk \
208 src/awk/lib/msg.awk
209 $(BUILD_AWK_EXE)
210
211 bin/khatus_parse_ps: \
212 src/awk/exe/parse_ps.awk \
213 src/awk/lib/msg.awk
214 $(BUILD_AWK_EXE)
215
216 bin/khatus_parse_sys_block_stat: \
217 src/awk/exe/parse_sys_block_stat.awk \
218 src/awk/lib/msg.awk
219 $(BUILD_AWK_EXE)
220
221 bin/khatus_parse_udevadm_monitor_block: \
222 src/awk/exe/parse_udevadm_monitor_block.awk \
223 src/awk/lib/msg.awk
224 $(BUILD_AWK_EXE)
225
226 bin/khatus_parse_upower: \
227 src/awk/exe/parse_upower.awk \
228 src/awk/lib/msg.awk
229 $(BUILD_AWK_EXE)
This page took 0.090825 seconds and 4 git commands to generate.