Makefile (1367B)
1 .POSIX: 2 3 VERSION = 2.0 4 5 # paths 6 PREFIX = /usr/local 7 MANPREFIX = $(PREFIX)/share/man 8 DOCPREFIX = $(PREFIX)/share/doc 9 10 SRC = ii.c 11 OBJ = $(SRC:.c=.o) 12 13 # use system flags. 14 II_CFLAGS = $(CFLAGS) 15 II_LDFLAGS = $(LDFLAGS) 16 17 # on systems which provide strlcpy(3), 18 # remove NEED_STRLCPY from CPPFLAGS and 19 # remove strlcpy.o from LIBS 20 II_CPPFLAGS = $(CPPFLAGS) -DVERSION=\"$(VERSION)\" -D_DEFAULT_SOURCE -DNEED_STRLCPY 21 LIBS = strlcpy.o 22 23 all: ii 24 25 options: 26 @echo ii build options: 27 @echo "CFLAGS = $(CFLAGS)" 28 @echo "LDFLAGS = $(LDFLAGS)" 29 @echo "CC = $(CC)" 30 31 .c.o: 32 $(CC) -c $< $(II_CFLAGS) $(II_CPPFLAGS) 33 34 ii: $(OBJ) $(LIBS) 35 $(CC) -o $@ $(OBJ) $(LIBS) $(II_LDFLAGS) 36 37 $(OBJ): arg.h 38 39 install: all 40 mkdir -p $(DESTDIR)$(PREFIX)/bin 41 mkdir -p $(DESTDIR)$(MANPREFIX)/man1 42 mkdir -p $(DESTDIR)$(DOCPREFIX)/ii 43 install -m 644 README FAQ LICENSE $(DESTDIR)$(DOCPREFIX)/ii 44 install -m 775 ii $(DESTDIR)$(PREFIX)/bin 45 sed "s/VERSION/$(VERSION)/g" < ii.1 > $(DESTDIR)$(MANPREFIX)/man1/ii.1 46 chmod 644 $(DESTDIR)$(MANPREFIX)/man1/ii.1 47 48 uninstall: all 49 rm -f $(DESTDIR)$(MANPREFIX)/man1/ii.1 $(DESTDIR)$(PREFIX)/bin/ii 50 rm -rf $(DESTDIR)$(DOCPREFIX)/ii 51 52 dist: clean 53 mkdir -p ii-$(VERSION) 54 cp -R Makefile README FAQ LICENSE strlcpy.c arg.h \ 55 ii.c ii.1 ii-$(VERSION) 56 tar -cf - ii-$(VERSION) | gzip -c > ii-$(VERSION).tar.gz 57 rm -rf ii-$(VERSION) 58 59 clean: 60 rm -f ii *.o