diff --git a/.idea/.gitignore b/.idea/.gitignore
new file mode 100644
index 0000000..13566b8
--- /dev/null
+++ b/.idea/.gitignore
@@ -0,0 +1,8 @@
+# Default ignored files
+/shelf/
+/workspace.xml
+# Editor-based HTTP Client requests
+/httpRequests/
+# Datasource local storage ignored files
+/dataSources/
+/dataSources.local.xml
diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml
new file mode 100644
index 0000000..973f941
--- /dev/null
+++ b/.idea/inspectionProfiles/Project_Default.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/misc.xml b/.idea/misc.xml
new file mode 100644
index 0000000..53624c9
--- /dev/null
+++ b/.idea/misc.xml
@@ -0,0 +1,18 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/vcs.xml b/.idea/vcs.xml
new file mode 100644
index 0000000..35eb1dd
--- /dev/null
+++ b/.idea/vcs.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Makefile b/Makefile
index 2f93b87..b1e9d05 100644
--- a/Makefile
+++ b/Makefile
@@ -1,68 +1,82 @@
-# See LICENSE file for copyright and license details
-# slstatus - suckless status monitor
.POSIX:
include config.mk
REQ = util
-COM =\
- components/battery\
- components/cpu\
- components/datetime\
- components/disk\
- components/entropy\
- components/hostname\
- components/ip\
- components/kernel_release\
- components/keyboard_indicators\
- components/keymap\
- components/load_avg\
- components/netspeeds\
- components/num_files\
- components/ram\
- components/run_command\
- components/separator\
- components/swap\
- components/temperature\
- components/uptime\
- components/user\
- components/volume\
+COM = \
+ components/battery \
+ components/cpu \
+ components/datetime \
+ components/disk \
+ components/entropy \
+ components/hostname \
+ components/ip \
+ components/kernel_release \
+ components/keyboard_indicators \
+ components/keymap \
+ components/load_avg \
+ components/netspeeds \
+ components/num_files \
+ components/ram \
+ components/run_command \
+ components/separator \
+ components/swap \
+ components/temperature \
+ components/uptime \
+ components/user \
+ components/volume \
components/wifi
-all: slstatus
+BUILD_DIR = build
+OBJ_DIR = $(BUILD_DIR)/obj
+SRC_DIR = src
-$(COM:=.o): config.mk $(REQ:=.h)
-slstatus.o: slstatus.c slstatus.h arg.h config.h config.mk $(REQ:=.h)
+COM_OBJ = $(COM:%=$(OBJ_DIR)/%.o)
+REQ_OBJ = $(REQ:%=$(OBJ_DIR)/%.o)
+SLSTATUS_OBJ = $(OBJ_DIR)/yo_slstatus.o
-.c.o:
+all: $(BUILD_DIR)/yo-slstatus
+
+$(COM_OBJ): $(OBJ_DIR)/%.o : $(SRC_DIR)/%.c $(REQ_OBJ) config.mk $(REQ:%=$(SRC_DIR)/%.h)
+ @mkdir -p $(@D)
+ $(CC) -o $@ -c $(CPPFLAGS) $(CFLAGS) $<
+
+$(REQ_OBJ): $(OBJ_DIR)/%.o : $(SRC_DIR)/%.c $(SRC_DIR)/%.h
+ @mkdir -p $(@D)
+ $(CC) -o $@ -c $(CPPFLAGS) $(CFLAGS) $<
+
+$(SLSTATUS_OBJ): $(SRC_DIR)/yo_slstatus.c $(SRC_DIR)/yo_slstatus.h $(SRC_DIR)/arg.h config.mk $(REQ_OBJ) $(REQ:%=$(SRC_DIR)/%.h)
+ @mkdir -p $(@D)
$(CC) -o $@ -c $(CPPFLAGS) $(CFLAGS) $<
config.h:
cp config.def.h $@
-slstatus: slstatus.o $(COM:=.o) $(REQ:=.o)
- $(CC) -o $@ $(LDFLAGS) $(COM:=.o) $(REQ:=.o) slstatus.o $(LDLIBS)
+$(BUILD_DIR)/yo-slstatus: $(SLSTATUS_OBJ) $(COM_OBJ) $(REQ_OBJ)
+ $(CC) -o $@ $(LDFLAGS) $(SLSTATUS_OBJ) $(COM_OBJ) $(REQ_OBJ) $(LDLIBS)
clean:
- rm -f slstatus slstatus.o $(COM:=.o) $(REQ:=.o)
+ rm -rf $(BUILD_DIR)
dist:
- rm -rf "slstatus-$(VERSION)"
- mkdir -p "slstatus-$(VERSION)/components"
+ rm -rf "yo-slstatus_$(VERSION)"
+ mkdir -p "yo-slstatus_$(VERSION)/components"
cp -R LICENSE Makefile README config.mk config.def.h \
- arg.h slstatus.c $(COM:=.c) $(REQ:=.c) $(REQ:=.h) \
- slstatus.1 "slstatus-$(VERSION)"
- tar -cf - "slstatus-$(VERSION)" | gzip -c > "slstatus-$(VERSION).tar.gz"
- rm -rf "slstatus-$(VERSION)"
+ arg.h $(SRC_DIR)/yo-slstatus.c $(COM:%=$(SRC_DIR)/%.c) $(REQ:%=$(SRC_DIR)/%.c) $(REQ:%=$(SRC_DIR)/%.h) \
+ yo-slstatus.1 "yo-slstatus_$(VERSION)"
+ tar -cf - "yo-slstatus_$(VERSION)" | gzip -c > "yo-slstatus_$(VERSION).tar.gz"
+ rm -rf "yo-slstatus_$(VERSION)"
install: all
mkdir -p "$(DESTDIR)$(PREFIX)/bin"
- cp -f slstatus "$(DESTDIR)$(PREFIX)/bin"
- chmod 755 "$(DESTDIR)$(PREFIX)/bin/slstatus"
+ cp -f $(BUILD_DIR)/yo-slstatus "$(DESTDIR)$(PREFIX)/bin"
+ chmod 755 "$(DESTDIR)$(PREFIX)/bin/yo-slstatus"
mkdir -p "$(DESTDIR)$(MANPREFIX)/man1"
- cp -f slstatus.1 "$(DESTDIR)$(MANPREFIX)/man1"
- chmod 644 "$(DESTDIR)$(MANPREFIX)/man1/slstatus.1"
+ cp -f yo-slstatus.1 "$(DESTDIR)$(MANPREFIX)/man1"
+ chmod 644 "$(DESTDIR)$(MANPREFIX)/man1/yo-slstatus.1"
uninstall:
- rm -f "$(DESTDIR)$(PREFIX)/bin/slstatus"
- rm -f "$(DESTDIR)$(MANPREFIX)/man1/slstatus.1"
+ rm -f "$(DESTDIR)$(PREFIX)/bin/yo-slstatus"
+ rm -f "$(DESTDIR)$(MANPREFIX)/man1/yo-slstatus.1"
+
+.PHONY: all clean dist install uninstall
diff --git a/arg.h b/src/arg.h
similarity index 100%
rename from arg.h
rename to src/arg.h
diff --git a/components/battery.c b/src/components/battery.c
similarity index 100%
rename from components/battery.c
rename to src/components/battery.c
diff --git a/components/cpu.c b/src/components/cpu.c
similarity index 100%
rename from components/cpu.c
rename to src/components/cpu.c
diff --git a/components/datetime.c b/src/components/datetime.c
similarity index 100%
rename from components/datetime.c
rename to src/components/datetime.c
diff --git a/components/disk.c b/src/components/disk.c
similarity index 100%
rename from components/disk.c
rename to src/components/disk.c
diff --git a/components/entropy.c b/src/components/entropy.c
similarity index 100%
rename from components/entropy.c
rename to src/components/entropy.c
diff --git a/components/hostname.c b/src/components/hostname.c
similarity index 100%
rename from components/hostname.c
rename to src/components/hostname.c
diff --git a/components/ip.c b/src/components/ip.c
similarity index 100%
rename from components/ip.c
rename to src/components/ip.c
diff --git a/components/kernel_release.c b/src/components/kernel_release.c
similarity index 100%
rename from components/kernel_release.c
rename to src/components/kernel_release.c
diff --git a/components/keyboard_indicators.c b/src/components/keyboard_indicators.c
similarity index 100%
rename from components/keyboard_indicators.c
rename to src/components/keyboard_indicators.c
diff --git a/components/keymap.c b/src/components/keymap.c
similarity index 100%
rename from components/keymap.c
rename to src/components/keymap.c
diff --git a/components/load_avg.c b/src/components/load_avg.c
similarity index 100%
rename from components/load_avg.c
rename to src/components/load_avg.c
diff --git a/components/netspeeds.c b/src/components/netspeeds.c
similarity index 100%
rename from components/netspeeds.c
rename to src/components/netspeeds.c
diff --git a/components/num_files.c b/src/components/num_files.c
similarity index 100%
rename from components/num_files.c
rename to src/components/num_files.c
diff --git a/components/ram.c b/src/components/ram.c
similarity index 100%
rename from components/ram.c
rename to src/components/ram.c
diff --git a/components/run_command.c b/src/components/run_command.c
similarity index 100%
rename from components/run_command.c
rename to src/components/run_command.c
diff --git a/components/separator.c b/src/components/separator.c
similarity index 100%
rename from components/separator.c
rename to src/components/separator.c
diff --git a/components/swap.c b/src/components/swap.c
similarity index 100%
rename from components/swap.c
rename to src/components/swap.c
diff --git a/components/temperature.c b/src/components/temperature.c
similarity index 100%
rename from components/temperature.c
rename to src/components/temperature.c
diff --git a/components/uptime.c b/src/components/uptime.c
similarity index 100%
rename from components/uptime.c
rename to src/components/uptime.c
diff --git a/components/user.c b/src/components/user.c
similarity index 100%
rename from components/user.c
rename to src/components/user.c
diff --git a/components/volume.c b/src/components/volume.c
similarity index 100%
rename from components/volume.c
rename to src/components/volume.c
diff --git a/components/wifi.c b/src/components/wifi.c
similarity index 100%
rename from components/wifi.c
rename to src/components/wifi.c
diff --git a/config.def.h b/src/config.def.h
similarity index 100%
rename from config.def.h
rename to src/config.def.h
diff --git a/config.h b/src/config.h
similarity index 100%
rename from config.h
rename to src/config.h
diff --git a/util.c b/src/util.c
similarity index 100%
rename from util.c
rename to src/util.c
diff --git a/util.h b/src/util.h
similarity index 100%
rename from util.h
rename to src/util.h
diff --git a/slstatus.c b/src/yo_slstatus.c
similarity index 99%
rename from slstatus.c
rename to src/yo_slstatus.c
index 64da5cb..203e52f 100644
--- a/slstatus.c
+++ b/src/yo_slstatus.c
@@ -8,7 +8,7 @@
#include
#include "arg.h"
-#include "slstatus.h"
+#include "yo_slstatus.h"
#include "util.h"
struct arg {
diff --git a/slstatus.h b/src/yo_slstatus.h
similarity index 100%
rename from slstatus.h
rename to src/yo_slstatus.h
diff --git a/slstatus.1 b/yo-slstatus.1
similarity index 100%
rename from slstatus.1
rename to yo-slstatus.1