Xinqi Bao's Git

Fix missing config.h in Makefile
[slstatus.git] / Makefile
1 # See LICENSE file for copyright and license details
2 # slstatus - suckless status monitor
3 .POSIX:
4
5 include config.mk
6
7 REQ = util
8 HDR = arg.h config.h
9 COM =\
10 battery\
11 cpu\
12 datetime\
13 disk\
14 entropy\
15 hostname\
16 ip\
17 kernel_release\
18 keyboard_indicators\
19 load_avg\
20 num_files\
21 ram\
22 run_command\
23 swap\
24 temperature\
25 uptime\
26 user\
27 volume\
28 wifi
29
30 all: slstatus
31
32 slstatus: slstatus.o $(COM:=.o) $(REQ:=.o)
33 slstatus.o: slstatus.c slstatus.h $(HDR) $(REQ:=.h)
34
35 battery.o: battery.c config.mk $(HDR) $(REQ:=.h)
36 cpu.o: cpu.c config.mk $(HDR) $(REQ:=.h)
37 datetime.o: datetime.c config.mk $(HDR) $(REQ:=.h)
38 disk.o: disk.c config.mk $(HDR) $(REQ:=.h)
39 entropy.o: entropy.c config.mk $(HDR) $(REQ:=.h)
40 hostname.o: hostname.c config.mk $(HDR) $(REQ:=.h)
41 ip.o: ip.c config.mk $(HDR) $(REQ:=.h)
42 kernel_release.o: kernel_release.c config.mk $(HDR) $(REQ:=.h)
43 keyboard_indicators.o: keyboard_indicators.c config.mk $(HDR) $(REQ:=.h)
44 load_avg.o: load_avg.c config.mk $(HDR) $(REQ:=.h)
45 num_files.o: num_files.c config.mk $(HDR) $(REQ:=.h)
46 ram.o: ram.c config.mk $(HDR) $(REQ:=.h)
47 run_command.o: run_command.c config.mk $(HDR) $(REQ:=.h)
48 swap.o: swap.c config.mk $(HDR) $(REQ:=.h)
49 temperature.o: temperature.c config.mk $(HDR) $(REQ:=.h)
50 uptime.o: uptime.c config.mk $(HDR) $(REQ:=.h)
51 user.o: user.c config.mk $(HDR) $(REQ:=.h)
52 volume.o: volume.c config.mk $(HDR) $(REQ:=.h)
53 wifi.o: wifi.c config.mk $(HDR) $(REQ:=.h)
54
55 config.h:
56 cp config.def.h $@
57
58 .o:
59 $(CC) -o $@ $(LDFLAGS) $< $(COM:=.o) $(REQ:=.o) $(LDLIBS)
60
61 .c.o:
62 $(CC) -c $(CPPFLAGS) $(CFLAGS) $<
63
64 clean:
65 rm -f slstatus slstatus.o $(COM:=.o) $(REQ:=.o)
66
67 dist:
68 rm -rf "slstatus-$(VERSION)"
69 mkdir -p "slstatus-$(VERSION)"
70 cp -R LICENSE Makefile README config.mk config.def.h \
71 $(HDR) slstatus.c $(COM:=.c) $(REQ:=.c) $(REQ:=.h) \
72 slstatus.1 "slstatus-$(VERSION)"
73 tar -cf - "slstatus-$(VERSION)" | gzip -c > "slstatus-$(VERSION).tar.gz"
74 rm -rf "slstatus-$(VERSION)"
75
76 install: all
77 mkdir -p "$(DESTDIR)$(PREFIX)/bin"
78 cp -f slstatus "$(DESTDIR)$(PREFIX)/bin"
79 chmod 755 "$(DESTDIR)$(PREFIX)/bin/slstatus"
80 mkdir -p "$(DESTDIR)$(MANPREFIX)/man1"
81 cp -f slstatus.1 "$(DESTDIR)$(MANPREFIX)/man1"
82 chmod 644 "$(DESTDIR)$(MANPREFIX)/man1/slstatus.1"
83
84 uninstall:
85 rm -f "$(DESTDIR)$(PREFIX)/bin/slstatus"
86 rm -f "$(DESTDIR)$(MANPREFIX)/man1/slstatus.1"