aboutsummaryrefslogtreecommitdiff
path: root/Makefile
blob: 21c0311c64cb19fad66b30fc56a4b65a63a255c5 (plain) (blame)
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# See LICENSE file for copyright and license details.
.POSIX:

include config.mk

SRC = ii.c
OBJ = $(SRC:.c=.o)

IICFLAGS = -DVERSION=\"$(VERSION)\" -D_DEFAULT_SOURCE $(CFLAGS)

all: ii

options:
	@echo ii build options:
	@echo "CFLAGS   = $(IICFLAGS)"
	@echo "LDFLAGS  = $(LDFLAGS)"
	@echo "CC       = $(CC)"

.c.o:
	$(CC) $(IICFLAGS) -c $<

ii: $(OBJ) $(LIBS)
	$(CC) $(LDFLAGS) -o $@ $(OBJ) $(LIBS)

$(OBJ): arg.h

install: all
	mkdir -p $(DESTDIR)$(PREFIX)/bin
	mkdir -p $(DESTDIR)$(MANPREFIX)/man1
	mkdir -p $(DESTDIR)$(DOCPREFIX)/ii
	install -m 644 CHANGES README FAQ LICENSE $(DESTDIR)$(DOCPREFIX)/ii
	install -m 775 ii $(DESTDIR)$(PREFIX)/bin
	sed "s/VERSION/$(VERSION)/g" < ii.1 > $(DESTDIR)$(MANPREFIX)/man1/ii.1
	chmod 644 $(DESTDIR)$(MANPREFIX)/man1/ii.1

uninstall: all
	rm -f $(DESTDIR)$(MANPREFIX)/man1/ii.1 $(DESTDIR)$(PREFIX)/bin/ii
	rm -rf $(DESTDIR)$(DOCPREFIX)/ii

dist: clean
	mkdir -p ii-$(VERSION)
	cp -R Makefile CHANGES README FAQ LICENSE strlcpy.c arg.h \
		config.mk ii.c ii.1 ii-$(VERSION)
	tar -cf ii-$(VERSION).tar ii-$(VERSION)
	gzip ii-$(VERSION).tar
	rm -rf ii-$(VERSION)

clean:
	rm -f ii *.o