Xinqi Bao's Git

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