X-Git-Url: https://git.xinqibao.xyz/slstatus.git/blobdiff_plain/61e44e894890c1521a01148fbf969cbd4dbb4cae..2ea3d46f1341716daa1370f0f19d1fc571c3e63a:/Makefile

diff --git a/Makefile b/Makefile
index 1a90431..e046597 100644
--- a/Makefile
+++ b/Makefile
@@ -2,29 +2,34 @@
 # slstatus - suckless status monitor
 .POSIX:
 
+include os.mk
 include config.mk
 
 REQ = util
 COM =\
-	battery\
-	cpu\
-	datetime\
-	disk\
-	entropy\
-	hostname\
-	ip\
-	kernel_release\
-	keyboard_indicators\
-	load_avg\
-	num_files\
-	ram\
-	run_command\
-	swap\
-	temperature\
-	uptime\
-	user\
-	volume\
-	wifi
+	components/$(OS)/battery \
+	components/$(OS)/cpu \
+	components/datetime\
+	components/disk\
+	components/$(OS)/entropy \
+	components/hostname\
+	components/ip\
+	components/kernel_release\
+	components/keyboard_indicators\
+	components/load_avg\
+	components/num_files\
+	components/$(OS)/ram \
+	components/run_command\
+	components/$(OS)/swap \
+	components/$(OS)/temperature \
+	components/$(OS)/uptime \
+	components/user\
+	components/volume\
+	components/$(OS)/wifi
+
+SLSCFLAGS  = -I$(X11INC) -D_DEFAULT_SOURCE $(CFLAGS)
+SLSLDFLAGS = -L$(X11LIB) $(LDFLAGS)
+SLSLIBS    = -lX11 $(OSLIBS) $(LIBS)
 
 all: slstatus
 
@@ -36,17 +41,17 @@ config.h:
 	cp config.def.h $@
 
 .o:
-	$(CC) -o $@ $(LDFLAGS) $< $(COM:=.o) $(REQ:=.o) $(LDLIBS)
+	$(CC) -o $@ $(SLSLDFLAGS) $< $(COM:=.o) $(REQ:=.o) $(SLSLIBS)
 
 .c.o:
-	$(CC) -c $(CPPFLAGS) $(CFLAGS) $<
+	$(CC) -o $@ -c $(SLSCFLAGS) $<
 
 clean:
 	rm -f slstatus slstatus.o $(COM:=.o) $(REQ:=.o)
 
 dist:
 	rm -rf "slstatus-$(VERSION)"
-	mkdir -p "slstatus-$(VERSION)"
+	mkdir -p "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)"