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