From: Siraaj Khandkar Date: Fri, 7 Sep 2018 00:45:22 +0000 (-0400) Subject: Move remaining code out of bin X-Git-Url: https://git.xandkar.net/?a=commitdiff_plain;h=91ee40f32a8ab133c8fd2119c052bc02bf32bae2;p=khatus.git Move remaining code out of bin and reserve it for built files from now on --- diff --git a/.gitignore b/.gitignore index 7d4b4de..271527f 100644 --- a/.gitignore +++ b/.gitignore @@ -1,24 +1,3 @@ _build/ -bin/khatus_actuate_alert_to_notify_send -bin/khatus_actuate_device_add_to_automount -bin/khatus_actuate_status_bar_to_xsetroot_name -bin/khatus_bar -bin/khatus_dashboard -bin/khatus_monitor_devices -bin/khatus_monitor_energy -bin/khatus_monitor_errors -bin/khatus_parse_bluetoothctl_show -bin/khatus_parse_df_pcent -bin/khatus_parse_fan_file -bin/khatus_parse_free -bin/khatus_parse_ip_addr -bin/khatus_parse_iwconfig -bin/khatus_parse_loadavg_file -bin/khatus_parse_metar_d_output -bin/khatus_parse_mpd_status_currentsong -bin/khatus_parse_pactl_list_sinks -bin/khatus_parse_ps -bin/khatus_parse_sys_block_stat -bin/khatus_parse_udevadm_monitor_block -bin/khatus_parse_upower +bin/ data/ diff --git a/Makefile b/Makefile index 54353de..b9ecf04 100644 --- a/Makefile +++ b/Makefile @@ -1,3 +1,5 @@ +MAKEFLAGS := --no-builtin-rules + PREFIX := $(HOME) PATH_TO_AWK := /usr/bin/awk AWK_EXECUTABLES := \ @@ -22,8 +24,30 @@ AWK_EXECUTABLES := \ bin/khatus_parse_sys_block_stat \ bin/khatus_parse_udevadm_monitor_block \ bin/khatus_parse_upower +BASH_EXECUTABLE_NAMES := \ + khatus \ + khatus_gen_bar_make_status \ + khatus_sensor_bluetooth_power \ + khatus_sensor_datetime \ + khatus_sensor_devices \ + khatus_sensor_disk_io \ + khatus_sensor_disk_space \ + khatus_sensor_energy \ + khatus_sensor_fan \ + khatus_sensor_loadavg \ + khatus_sensor_memory \ + khatus_sensor_mpd \ + khatus_sensor_net_addr_io \ + khatus_sensor_net_wifi_status \ + khatus_sensor_procs \ + khatus_sensor_screen_brightness \ + khatus_sensor_temperature \ + khatus_sensor_volume \ + khatus_sensor_weather +BASH_EXECUTABLES := $(foreach exe,$(BASH_EXECUTABLE_NAMES),bin/$(exe)) OCAML_EXECUTABLES := \ - bin/khatus_dashboard + bin/khatus_cache_dumper +EXECUTABLES := $(AWK_EXECUTABLES) $(BASH_EXECUTABLES) $(OCAML_EXECUTABLES) define BUILD_AWK_EXE echo '#! $(PATH_TO_AWK) -f' > $@ && \ @@ -33,19 +57,37 @@ define BUILD_AWK_EXE chmod +x $@ endef +define BUILD_BASH_EXE + cat $^ > $@ && \ + chmod +x $@ +endef + +define GEN_BASH_EXE_RULE +bin/$(1) : src/bash/exe/$(1).sh + $$(BUILD_BASH_EXE) +endef + .PHONY: \ build \ install \ clean -build: $(AWK_EXECUTABLES) $(OCAML_EXECUTABLES) +build: | bin +build: $(EXECUTABLES) install: $(foreach filename,$(wildcard bin/*),cp -p "$(filename)" "$(PREFIX)/$(filename)"; ) clean: - rm -f $(AWK_EXECUTABLES) - rm -f $(OCAML_EXECUTABLES) + rm -rf bin + +bin: + mkdir -p bin + +#----------------------------------------------------------------------------- +# Bash +#----------------------------------------------------------------------------- +$(foreach exe,$(BASH_EXECUTABLE_NAMES),$(eval $(call GEN_BASH_EXE_RULE,$(exe)))) #----------------------------------------------------------------------------- # AWK diff --git a/bin/khatus b/src/bash/exe/khatus.sh old mode 100755 new mode 100644 similarity index 100% rename from bin/khatus rename to src/bash/exe/khatus.sh diff --git a/bin/khatus_gen_bar_make_status b/src/bash/exe/khatus_gen_bar_make_status.sh old mode 100755 new mode 100644 similarity index 100% rename from bin/khatus_gen_bar_make_status rename to src/bash/exe/khatus_gen_bar_make_status.sh diff --git a/bin/khatus_sensor_bluetooth_power b/src/bash/exe/khatus_sensor_bluetooth_power.sh old mode 100755 new mode 100644 similarity index 100% rename from bin/khatus_sensor_bluetooth_power rename to src/bash/exe/khatus_sensor_bluetooth_power.sh diff --git a/bin/khatus_sensor_datetime b/src/bash/exe/khatus_sensor_datetime.sh old mode 100755 new mode 100644 similarity index 100% rename from bin/khatus_sensor_datetime rename to src/bash/exe/khatus_sensor_datetime.sh diff --git a/bin/khatus_sensor_devices b/src/bash/exe/khatus_sensor_devices.sh old mode 100755 new mode 100644 similarity index 100% rename from bin/khatus_sensor_devices rename to src/bash/exe/khatus_sensor_devices.sh diff --git a/bin/khatus_sensor_disk_io b/src/bash/exe/khatus_sensor_disk_io.sh old mode 100755 new mode 100644 similarity index 100% rename from bin/khatus_sensor_disk_io rename to src/bash/exe/khatus_sensor_disk_io.sh diff --git a/bin/khatus_sensor_disk_space b/src/bash/exe/khatus_sensor_disk_space.sh old mode 100755 new mode 100644 similarity index 100% rename from bin/khatus_sensor_disk_space rename to src/bash/exe/khatus_sensor_disk_space.sh diff --git a/bin/khatus_sensor_energy b/src/bash/exe/khatus_sensor_energy.sh old mode 100755 new mode 100644 similarity index 100% rename from bin/khatus_sensor_energy rename to src/bash/exe/khatus_sensor_energy.sh diff --git a/bin/khatus_sensor_fan b/src/bash/exe/khatus_sensor_fan.sh old mode 100755 new mode 100644 similarity index 100% rename from bin/khatus_sensor_fan rename to src/bash/exe/khatus_sensor_fan.sh diff --git a/bin/khatus_sensor_loadavg b/src/bash/exe/khatus_sensor_loadavg.sh old mode 100755 new mode 100644 similarity index 100% rename from bin/khatus_sensor_loadavg rename to src/bash/exe/khatus_sensor_loadavg.sh diff --git a/bin/khatus_sensor_memory b/src/bash/exe/khatus_sensor_memory.sh old mode 100755 new mode 100644 similarity index 100% rename from bin/khatus_sensor_memory rename to src/bash/exe/khatus_sensor_memory.sh diff --git a/bin/khatus_sensor_mpd b/src/bash/exe/khatus_sensor_mpd.sh old mode 100755 new mode 100644 similarity index 100% rename from bin/khatus_sensor_mpd rename to src/bash/exe/khatus_sensor_mpd.sh diff --git a/bin/khatus_sensor_net_addr_io b/src/bash/exe/khatus_sensor_net_addr_io.sh old mode 100755 new mode 100644 similarity index 100% rename from bin/khatus_sensor_net_addr_io rename to src/bash/exe/khatus_sensor_net_addr_io.sh diff --git a/bin/khatus_sensor_net_wifi_status b/src/bash/exe/khatus_sensor_net_wifi_status.sh old mode 100755 new mode 100644 similarity index 100% rename from bin/khatus_sensor_net_wifi_status rename to src/bash/exe/khatus_sensor_net_wifi_status.sh diff --git a/bin/khatus_sensor_procs b/src/bash/exe/khatus_sensor_procs.sh old mode 100755 new mode 100644 similarity index 100% rename from bin/khatus_sensor_procs rename to src/bash/exe/khatus_sensor_procs.sh diff --git a/bin/khatus_sensor_screen_brightness b/src/bash/exe/khatus_sensor_screen_brightness.sh old mode 100755 new mode 100644 similarity index 100% rename from bin/khatus_sensor_screen_brightness rename to src/bash/exe/khatus_sensor_screen_brightness.sh diff --git a/bin/khatus_sensor_temperature b/src/bash/exe/khatus_sensor_temperature.sh old mode 100755 new mode 100644 similarity index 100% rename from bin/khatus_sensor_temperature rename to src/bash/exe/khatus_sensor_temperature.sh diff --git a/bin/khatus_sensor_volume b/src/bash/exe/khatus_sensor_volume.sh old mode 100755 new mode 100644 similarity index 100% rename from bin/khatus_sensor_volume rename to src/bash/exe/khatus_sensor_volume.sh diff --git a/bin/khatus_sensor_weather b/src/bash/exe/khatus_sensor_weather.sh old mode 100755 new mode 100644 similarity index 100% rename from bin/khatus_sensor_weather rename to src/bash/exe/khatus_sensor_weather.sh