Xinqi Bao's Git

7ed709985b05ff1c4d25fcaa0e310afcd8e57346
[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 COM =\
9 components/backlight\
10 components/battery\
11 components/cpu\
12 components/datetime\
13 components/disk\
14 components/entropy\
15 components/hostname\
16 components/ip\
17 components/kernel_release\
18 components/keyboard_indicators\
19 components/keymap\
20 components/load_avg\
21 components/netspeeds\
22 components/num_files\
23 components/ram\
24 components/run_command\
25 components/swap\
26 components/temperature\
27 components/uptime\
28 components/user\
29 components/volume\
30 components/wifi
31
32 all: slstatus
33
34 slstatus: slstatus.o $(COM:=.o) $(REQ:=.o)
35 slstatus.o: slstatus.c slstatus.h arg.h config.h config.mk $(REQ:=.h)
36 $(COM:=.o): config.mk $(REQ:=.h)
37
38 config.h:
39 cp config.def.h $@
40
41 .o:
42 $(CC) -o $@ $(LDFLAGS) $< $(COM:=.o) $(REQ:=.o) $(LDLIBS)
43
44 .c.o:
45 $(CC) -o $@ -c $(CPPFLAGS) $(CFLAGS) $<
46
47 clean:
48 rm -f slstatus slstatus.o $(COM:=.o) $(REQ:=.o)
49
50 dist:
51 rm -rf "slstatus-$(VERSION)"
52 mkdir -p "slstatus-$(VERSION)/components"
53 cp -R LICENSE Makefile README config.mk config.def.h \
54 arg.h slstatus.c $(COM:=.c) $(REQ:=.c) $(REQ:=.h) \
55 slstatus.1 "slstatus-$(VERSION)"
56 tar -cf - "slstatus-$(VERSION)" | gzip -c > "slstatus-$(VERSION).tar.gz"
57 rm -rf "slstatus-$(VERSION)"
58
59 install: all
60 mkdir -p "$(DESTDIR)$(PREFIX)/bin"
61 cp -f slstatus "$(DESTDIR)$(PREFIX)/bin"
62 chmod 755 "$(DESTDIR)$(PREFIX)/bin/slstatus"
63 mkdir -p "$(DESTDIR)$(MANPREFIX)/man1"
64 cp -f slstatus.1 "$(DESTDIR)$(MANPREFIX)/man1"
65 chmod 644 "$(DESTDIR)$(MANPREFIX)/man1/slstatus.1"
66
67 uninstall:
68 rm -f "$(DESTDIR)$(PREFIX)/bin/slstatus"
69 rm -f "$(DESTDIR)$(MANPREFIX)/man1/slstatus.1"