Xinqi Bao's Git

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