Re: [hackers] [slstatus] Simplify Makefile
> Dear Laslo, dear Quentin, Hi Aaron, > > why not just the following? Thanks for bringing the topic up; for > > some reason I had in mind that it was necessary to list the > > dependencies explicitly. > > I will merge this patch as it has the required dependency on > slstatus.o and it is generally simpler. > Thank you very much! I think you missed some of the points of the patch... My patched fixed the dependencies on the slstatus object, there's no need to have all objects depend on util.h, there's no need to override the inference rule .o:, the dist target is missing some files. It's not about apparent “simplicity”, it's about correctness. Do the right thing! -- Quentin
[hackers] [slstatus] Simplify Makefile || Laslo Hunhold
commit f56e50a2694e92d972a060d71b2f80c72fd23365 Author: Laslo HunholdAuthorDate: Sun Sep 17 23:48:11 2017 +0200 Commit: Aaron Marcher CommitDate: Mon Sep 18 08:47:54 2017 +0200 Simplify Makefile diff --git a/Makefile b/Makefile index d657981..505b526 100644 --- a/Makefile +++ b/Makefile @@ -31,26 +31,7 @@ all: slstatus slstatus: slstatus.o $(COM:=.o) $(REQ:=.o) slstatus.o: slstatus.c slstatus.h $(HDR) $(REQ:=.h) - -battery.o: battery.c config.mk $(HDR) $(REQ:=.h) -cpu.o: cpu.c config.mk $(HDR) $(REQ:=.h) -datetime.o: datetime.c config.mk $(HDR) $(REQ:=.h) -disk.o: disk.c config.mk $(HDR) $(REQ:=.h) -entropy.o: entropy.c config.mk $(HDR) $(REQ:=.h) -hostname.o: hostname.c config.mk $(HDR) $(REQ:=.h) -ip.o: ip.c config.mk $(HDR) $(REQ:=.h) -kernel_release.o: kernel_release.c config.mk $(HDR) $(REQ:=.h) -keyboard_indicators.o: keyboard_indicators.c config.mk $(HDR) $(REQ:=.h) -load_avg.o: load_avg.c config.mk $(HDR) $(REQ:=.h) -num_files.o: num_files.c config.mk $(HDR) $(REQ:=.h) -ram.o: ram.c config.mk $(HDR) $(REQ:=.h) -run_command.o: run_command.c config.mk $(HDR) $(REQ:=.h) -swap.o: swap.c config.mk $(HDR) $(REQ:=.h) -temperature.o: temperature.c config.mk $(HDR) $(REQ:=.h) -uptime.o: uptime.c config.mk $(HDR) $(REQ:=.h) -user.o: user.c config.mk $(HDR) $(REQ:=.h) -volume.o: volume.c config.mk $(HDR) $(REQ:=.h) -wifi.o: wifi.c config.mk $(HDR) $(REQ:=.h) +$(COM:=.o): config.mk $(HDR) $(REQ:=.h) config.h: cp config.def.h $@
Re: [hackers] [slstatus] Simplify Makefile
Dear Laslo, dear Quentin, why not just the following? Thanks for bringing the topic up; for some reason I had in mind that it was necessary to list the dependencies explicitly. I will merge this patch as it has the required dependency on slstatus.o and it is generally simpler. Thank you very much! Regards, Aaron -- Web: https://drkhsh.at/ or http://drkhsh5rv6pnahas.onion/ Gopher: gopher://drkhsh.at or gopher://drkhsh5rv6pnahas.onion GPG: 0x09e71697435bf54b Fingerprint: 57D2 5F2C 9402 A6BD FEF9 B3B6 09E7 1697 435B F54B
Re: [hackers] [slstatus] Simplify Makefile
On Sun, 17 Sep 2017 23:02:43 +0200 Quentin Rameauwrote: Dear Quentin, > why not just the following? Thanks for bringing the topic up; for some reason I had in mind that it was necessary to list the dependencies explicitly. With best regards Laslo Hunhold -- Laslo Hunhold >From f645ddc6b207b578e4782ff9f854268fdd81b75d Mon Sep 17 00:00:00 2001 From: Laslo Hunhold Date: Sun, 17 Sep 2017 23:48:11 +0200 Subject: [PATCH] Simplify Makefile --- Makefile | 21 + 1 file changed, 1 insertion(+), 20 deletions(-) diff --git a/Makefile b/Makefile index d690612..14855ac 100644 --- a/Makefile +++ b/Makefile @@ -31,26 +31,7 @@ all: slstatus slstatus: slstatus.o $(COM:=.o) $(REQ:=.o) slstatus.o: slstatus.c slstatus.h $(HDR) $(REQ:=.h) - -battery.o: battery.c config.mk $(HDR) $(REQ:=.h) -cpu.o: cpu.c config.mk $(HDR) $(REQ:=.h) -datetime.o: datetime.c config.mk $(HDR) $(REQ:=.h) -disk.o: disk.c config.mk $(HDR) $(REQ:=.h) -entropy.o: entropy.c config.mk $(HDR) $(REQ:=.h) -hostname.o: hostname.c config.mk $(HDR) $(REQ:=.h) -ip.o: ip.c config.mk $(HDR) $(REQ:=.h) -kernel_release.o: kernel_release.c config.mk $(HDR) $(REQ:=.h) -keyboard_indicators.o: keyboard_indicators.c config.mk $(HDR) $(REQ:=.h) -load_avg.o: load_avg.c config.mk $(HDR) $(REQ:=.h) -num_files.o: num_files.c config.mk $(HDR) $(REQ:=.h) -ram.o: ram.c config.mk $(HDR) $(REQ:=.h) -run_command.o: run_command.c config.mk $(HDR) $(REQ:=.h) -swap.o: swap.c config.mk $(HDR) $(REQ:=.h) -temperature.o: temperature.c config.mk $(HDR) $(REQ:=.h) -uptime.o: uptime.c config.mk $(HDR) $(REQ:=.h) -user.o: user.c config.mk $(HDR) $(REQ:=.h) -volume.o: volume.c config.mk $(HDR) $(REQ:=.h) -wifi.o: wifi.c config.mk $(HDR) $(REQ:=.h) +$(COM:=.o): config.mk $(HDR) $(REQ:=.h) .o: $(CC) -o $@ $(LDFLAGS) $< $(COM:=.o) $(REQ:=.o) $(LDLIBS) -- 2.14.1
Re: [hackers] [slstatus] Simplify Makefile
On Sun, 17 Sep 2017 22:29:42 +0100 Matthew Parnellwrote: > Hi Quentin, Hi Matthew, > I like this simplification a lot, I believe it covers the dependency > resolution that Laslo pointed out earlier today; and yet cleans things > up nicely. > I'd very much like to see this merged. I've just sent an updated patch to cover more precisely which object depends on which header, should be better now. Thanks! -- Quentin
[hackers] [slstatus] Simplify Makefile
--- Makefile | 37 ++--- 1 file changed, 10 insertions(+), 27 deletions(-) diff --git a/Makefile b/Makefile index d657981..3d116ba 100644 --- a/Makefile +++ b/Makefile @@ -4,9 +4,10 @@ include config.mk -REQ = util HDR = arg.h config.h COM =\ + util\ + slstatus\ battery\ cpu\ datetime\ @@ -26,49 +27,31 @@ COM =\ user\ volume\ wifi +OBJ = $(COM:=.o) all: slstatus -slstatus: slstatus.o $(COM:=.o) $(REQ:=.o) -slstatus.o: slstatus.c slstatus.h $(HDR) $(REQ:=.h) +slstatus: $(OBJ) + $(CC) -o $@ $(LDFLAGS) $(OBJ) $(LDLIBS) -battery.o: battery.c config.mk $(HDR) $(REQ:=.h) -cpu.o: cpu.c config.mk $(HDR) $(REQ:=.h) -datetime.o: datetime.c config.mk $(HDR) $(REQ:=.h) -disk.o: disk.c config.mk $(HDR) $(REQ:=.h) -entropy.o: entropy.c config.mk $(HDR) $(REQ:=.h) -hostname.o: hostname.c config.mk $(HDR) $(REQ:=.h) -ip.o: ip.c config.mk $(HDR) $(REQ:=.h) -kernel_release.o: kernel_release.c config.mk $(HDR) $(REQ:=.h) -keyboard_indicators.o: keyboard_indicators.c config.mk $(HDR) $(REQ:=.h) -load_avg.o: load_avg.c config.mk $(HDR) $(REQ:=.h) -num_files.o: num_files.c config.mk $(HDR) $(REQ:=.h) -ram.o: ram.c config.mk $(HDR) $(REQ:=.h) -run_command.o: run_command.c config.mk $(HDR) $(REQ:=.h) -swap.o: swap.c config.mk $(HDR) $(REQ:=.h) -temperature.o: temperature.c config.mk $(HDR) $(REQ:=.h) -uptime.o: uptime.c config.mk $(HDR) $(REQ:=.h) -user.o: user.c config.mk $(HDR) $(REQ:=.h) -volume.o: volume.c config.mk $(HDR) $(REQ:=.h) -wifi.o: wifi.c config.mk $(HDR) $(REQ:=.h) +$(OBJ): config.mk +util.o: util.h +slstatus.o: slstatus.h $(HDR) config.h: cp config.def.h $@ -.o: - $(CC) -o $@ $(LDFLAGS) $< $(COM:=.o) $(REQ:=.o) $(LDLIBS) - .c.o: $(CC) -c $(CPPFLAGS) $(CFLAGS) $< clean: - rm -f slstatus slstatus.o $(COM:=.o) $(REQ:=.o) + rm -f slstatus slstatus.o $(OBJ) dist: rm -rf "slstatus-$(VERSION)" mkdir -p "slstatus-$(VERSION)" cp -R LICENSE Makefile README config.mk config.def.h \ - $(HDR) slstatus.c $(COM:=.c) $(REQ:=.c) $(REQ:=.h) \ + $(HDR) slstatus.c slstatus.h $(COM:=.c) util.h \ slstatus.1 "slstatus-$(VERSION)" tar -cf - "slstatus-$(VERSION)" | gzip -c > "slstatus-$(VERSION).tar.gz" rm -rf "slstatus-$(VERSION)" -- 2.14.1
Re: [hackers] [slstatus] Simplify Makefile
Hi Quentin, I like this simplification a lot, I believe it covers the dependency resolution that Laslo pointed out earlier today; and yet cleans things up nicely. I'd very much like to see this merged. Cheers, -- Matthew Parnell m...@parnmatt.co.uk
[hackers] [slstatus] Simplify Makefile
--- Makefile | 25 - 1 file changed, 4 insertions(+), 21 deletions(-) diff --git a/Makefile b/Makefile index d657981..fc80ab1 100644 --- a/Makefile +++ b/Makefile @@ -7,6 +7,7 @@ include config.mk REQ = util HDR = arg.h config.h COM =\ + $(REQ)\ battery\ cpu\ datetime\ @@ -26,31 +27,13 @@ COM =\ user\ volume\ wifi +OBJ = $(COM:=.o) all: slstatus -slstatus: slstatus.o $(COM:=.o) $(REQ:=.o) -slstatus.o: slstatus.c slstatus.h $(HDR) $(REQ:=.h) +slstatus: slstatus.h $(OBJ) -battery.o: battery.c config.mk $(HDR) $(REQ:=.h) -cpu.o: cpu.c config.mk $(HDR) $(REQ:=.h) -datetime.o: datetime.c config.mk $(HDR) $(REQ:=.h) -disk.o: disk.c config.mk $(HDR) $(REQ:=.h) -entropy.o: entropy.c config.mk $(HDR) $(REQ:=.h) -hostname.o: hostname.c config.mk $(HDR) $(REQ:=.h) -ip.o: ip.c config.mk $(HDR) $(REQ:=.h) -kernel_release.o: kernel_release.c config.mk $(HDR) $(REQ:=.h) -keyboard_indicators.o: keyboard_indicators.c config.mk $(HDR) $(REQ:=.h) -load_avg.o: load_avg.c config.mk $(HDR) $(REQ:=.h) -num_files.o: num_files.c config.mk $(HDR) $(REQ:=.h) -ram.o: ram.c config.mk $(HDR) $(REQ:=.h) -run_command.o: run_command.c config.mk $(HDR) $(REQ:=.h) -swap.o: swap.c config.mk $(HDR) $(REQ:=.h) -temperature.o: temperature.c config.mk $(HDR) $(REQ:=.h) -uptime.o: uptime.c config.mk $(HDR) $(REQ:=.h) -user.o: user.c config.mk $(HDR) $(REQ:=.h) -volume.o: volume.c config.mk $(HDR) $(REQ:=.h) -wifi.o: wifi.c config.mk $(HDR) $(REQ:=.h) +$(OBJ): config.mk $(HDR) $(REQ:=.h) config.h: cp config.def.h $@ -- 2.14.1