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 \ | |
91ee40f3 SK |
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)) | |
53d24ad6 | 48 | EXECUTABLES := $(AWK_EXECUTABLES) $(BASH_EXECUTABLES) |
03c229bf | 49 | |
82dcdacc | 50 | define BUILD_AWK_EXE |
8482fea6 SK |
51 | echo '#! $(PATH_TO_AWK) -f' > $@ && \ |
52 | echo 'BEGIN {Node = Node ? Node : "$(shell hostname)"}' >> $@ && \ | |
53 | echo 'BEGIN {Module = "$(notdir $@)"}' >> $@ && \ | |
54 | cat $^ >> $@ && \ | |
82dcdacc SK |
55 | chmod +x $@ |
56 | endef | |
57 | ||
91ee40f3 SK |
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 | ||
03c229bf SK |
68 | .PHONY: \ |
69 | build \ | |
862ac48f | 70 | rebuild \ |
3ad4dbbb | 71 | install \ |
86eb090e SK |
72 | uninstall \ |
73 | reinstall \ | |
03c229bf SK |
74 | clean |
75 | ||
91ee40f3 SK |
76 | build: | bin |
77 | build: $(EXECUTABLES) | |
03c229bf | 78 | |
3ad4dbbb | 79 | install: |
86eb090e SK |
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 | |
3ad4dbbb | 88 | |
862ac48f SK |
89 | rebuild: |
90 | @$(MAKE) -s clean | |
91 | @$(MAKE) -s build | |
92 | ||
03c229bf | 93 | clean: |
91ee40f3 SK |
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)))) | |
03c229bf | 103 | |
c6a7396e SK |
104 | #----------------------------------------------------------------------------- |
105 | # AWK | |
106 | #----------------------------------------------------------------------------- | |
03c229bf SK |
107 | bin/khatus_bar: \ |
108 | src/awk/exe/bar.awk \ | |
109 | src/awk/lib/cache.awk \ | |
8482fea6 | 110 | src/awk/lib/str.awk \ |
81336934 | 111 | src/awk/lib/msg.awk \ |
8482fea6 | 112 | src/awk/lib/num.awk |
82dcdacc | 113 | $(BUILD_AWK_EXE) |
03c229bf SK |
114 | |
115 | bin/khatus_actuate_alert_to_notify_send: \ | |
116 | src/awk/exe/actuate_alert_to_notify_send.awk \ | |
8482fea6 | 117 | src/awk/lib/str.awk \ |
81336934 | 118 | src/awk/lib/msg.awk |
82dcdacc | 119 | $(BUILD_AWK_EXE) |
03c229bf SK |
120 | |
121 | bin/khatus_actuate_device_add_to_automount: \ | |
122 | src/awk/exe/actuate_device_add_to_automount.awk \ | |
8482fea6 | 123 | src/awk/lib/str.awk \ |
81336934 | 124 | src/awk/lib/msg.awk |
82dcdacc | 125 | $(BUILD_AWK_EXE) |
03c229bf SK |
126 | |
127 | bin/khatus_actuate_status_bar_to_xsetroot_name: \ | |
128 | src/awk/exe/actuate_status_bar_to_xsetroot_name.awk \ | |
8482fea6 | 129 | src/awk/lib/str.awk \ |
81336934 | 130 | src/awk/lib/msg.awk |
82dcdacc | 131 | $(BUILD_AWK_EXE) |
03c229bf | 132 | |
7dc9c797 SK |
133 | bin/khatus_gen_bar_make_status: \ |
134 | src/awk/exe/gen_bar_make_status.awk | |
135 | $(BUILD_AWK_EXE) | |
136 | ||
03c229bf SK |
137 | bin/khatus_monitor_devices: \ |
138 | src/awk/exe/monitor_devices.awk \ | |
8482fea6 | 139 | src/awk/lib/str.awk \ |
81336934 | 140 | src/awk/lib/msg.awk |
82dcdacc | 141 | $(BUILD_AWK_EXE) |
03c229bf SK |
142 | |
143 | bin/khatus_monitor_energy: \ | |
144 | src/awk/exe/monitor_energy.awk \ | |
8482fea6 | 145 | src/awk/lib/str.awk \ |
81336934 | 146 | src/awk/lib/msg.awk \ |
8482fea6 | 147 | src/awk/lib/num.awk |
82dcdacc | 148 | $(BUILD_AWK_EXE) |
03c229bf SK |
149 | |
150 | bin/khatus_monitor_errors: \ | |
151 | src/awk/exe/monitor_errors.awk \ | |
8482fea6 | 152 | src/awk/lib/str.awk \ |
81336934 | 153 | src/awk/lib/msg.awk |
82dcdacc | 154 | $(BUILD_AWK_EXE) |
03c229bf SK |
155 | |
156 | bin/khatus_parse_bluetoothctl_show: \ | |
157 | src/awk/exe/parse_bluetoothctl_show.awk \ | |
81336934 | 158 | src/awk/lib/msg.awk |
82dcdacc | 159 | $(BUILD_AWK_EXE) |
03c229bf SK |
160 | |
161 | bin/khatus_parse_df_pcent: \ | |
162 | src/awk/exe/parse_df_pcent.awk \ | |
81336934 | 163 | src/awk/lib/msg.awk |
82dcdacc | 164 | $(BUILD_AWK_EXE) |
03c229bf SK |
165 | |
166 | bin/khatus_parse_fan_file: \ | |
167 | src/awk/exe/parse_fan_file.awk \ | |
81336934 | 168 | src/awk/lib/msg.awk |
82dcdacc | 169 | $(BUILD_AWK_EXE) |
03c229bf SK |
170 | |
171 | bin/khatus_parse_free: \ | |
172 | src/awk/exe/parse_free.awk \ | |
81336934 | 173 | src/awk/lib/msg.awk |
82dcdacc | 174 | $(BUILD_AWK_EXE) |
03c229bf SK |
175 | |
176 | bin/khatus_parse_ip_addr: \ | |
177 | src/awk/exe/parse_ip_addr.awk \ | |
81336934 | 178 | src/awk/lib/msg.awk |
82dcdacc | 179 | $(BUILD_AWK_EXE) |
03c229bf SK |
180 | |
181 | bin/khatus_parse_iwconfig: \ | |
182 | src/awk/exe/parse_iwconfig.awk \ | |
81336934 | 183 | src/awk/lib/msg.awk |
82dcdacc | 184 | $(BUILD_AWK_EXE) |
03c229bf SK |
185 | |
186 | bin/khatus_parse_loadavg_file: \ | |
187 | src/awk/exe/parse_loadavg_file.awk \ | |
81336934 | 188 | src/awk/lib/msg.awk |
82dcdacc | 189 | $(BUILD_AWK_EXE) |
03c229bf | 190 | |
57ed1a64 SK |
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 \ | |
81336934 | 197 | src/awk/lib/msg.awk \ |
8482fea6 | 198 | src/awk/lib/str.awk |
82dcdacc | 199 | $(BUILD_AWK_EXE) |
03c229bf SK |
200 | |
201 | bin/khatus_parse_mpd_status_currentsong: \ | |
202 | src/awk/exe/parse_mpd_status_currentsong.awk \ | |
81336934 | 203 | src/awk/lib/msg.awk |
82dcdacc | 204 | $(BUILD_AWK_EXE) |
03c229bf SK |
205 | |
206 | bin/khatus_parse_pactl_list_sinks: \ | |
207 | src/awk/exe/parse_pactl_list_sinks.awk \ | |
81336934 | 208 | src/awk/lib/msg.awk |
82dcdacc | 209 | $(BUILD_AWK_EXE) |
03c229bf SK |
210 | |
211 | bin/khatus_parse_ps: \ | |
212 | src/awk/exe/parse_ps.awk \ | |
81336934 | 213 | src/awk/lib/msg.awk |
82dcdacc | 214 | $(BUILD_AWK_EXE) |
03c229bf SK |
215 | |
216 | bin/khatus_parse_sys_block_stat: \ | |
217 | src/awk/exe/parse_sys_block_stat.awk \ | |
81336934 | 218 | src/awk/lib/msg.awk |
82dcdacc | 219 | $(BUILD_AWK_EXE) |
03c229bf SK |
220 | |
221 | bin/khatus_parse_udevadm_monitor_block: \ | |
222 | src/awk/exe/parse_udevadm_monitor_block.awk \ | |
81336934 | 223 | src/awk/lib/msg.awk |
82dcdacc | 224 | $(BUILD_AWK_EXE) |
03c229bf SK |
225 | |
226 | bin/khatus_parse_upower: \ | |
227 | src/awk/exe/parse_upower.awk \ | |
81336934 | 228 | src/awk/lib/msg.awk |
82dcdacc | 229 | $(BUILD_AWK_EXE) |