summaryrefslogtreecommitdiff
path: root/Makefile
blob: a1f52d7d157986b6f2a4a3768c6ddc29679e8e32 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
CC      ?= cc
CFLAGS  += -std=c99 -pedantic -Wall -Wextra -Os
LDFLAGS += -lelf -lz -lzstd

PREFIX  ?= /usr
BINDIR   = $(PREFIX)/bin
MANDIR   = $(PREFIX)/share/man

SRCS     = util.c pkg.c elf.c lang.c main.c
OBJS     = $(SRCS:.c=.o)

all: revdep

revdep: $(OBJS)
	$(CC) -o $@ $(OBJS) $(LDFLAGS)

%.o: %.c revdep.h
	$(CC) $(CFLAGS) -c $< -o $@

install: all
	install -Dm0755 revdep $(DESTDIR)$(BINDIR)/revdep
	install -Dm0644 man/revdep.8 $(DESTDIR)$(MANDIR)/man8/revdep.8
	install -dm0755 $(DESTDIR)/etc/revdep.d

uninstall:
	rm -f $(DESTDIR)$(BINDIR)/revdep
	rm -f $(DESTDIR)$(MANDIR)/man8/revdep.8

lint:
	mandoc -Tlint man/revdep.8

clean:
	rm -f $(OBJS) revdep

.PHONY: all clean install uninstall lint