2018-05-29 19:27:36 +03:00
|
|
|
.POSIX:
|
|
|
|
|
2022-09-02 12:49:34 +03:00
|
|
|
VERSION = 1.9
|
|
|
|
|
|
|
|
# paths
|
|
|
|
PREFIX = /usr/local
|
|
|
|
MANPREFIX = $(PREFIX)/share/man
|
|
|
|
DOCPREFIX = $(PREFIX)/share/doc
|
2005-12-19 16:39:54 +03:00
|
|
|
|
2018-05-29 19:34:52 +03:00
|
|
|
SRC = ii.c
|
2018-05-29 19:27:36 +03:00
|
|
|
OBJ = $(SRC:.c=.o)
|
|
|
|
|
2022-09-02 12:49:34 +03:00
|
|
|
# use system flags.
|
|
|
|
II_CFLAGS = $(CFLAGS)
|
|
|
|
II_LDFLAGS = $(LDFLAGS)
|
|
|
|
|
|
|
|
# on systems which provide strlcpy(3),
|
|
|
|
# remove NEED_STRLCPY from CPPFLAGS and
|
|
|
|
# remove strlcpy.o from LIBS
|
|
|
|
II_CPPFLAGS = $(CPPFLAGS) -DVERSION=\"$(VERSION)\" -D_DEFAULT_SOURCE -DNEED_STRLCPY
|
|
|
|
LIBS = strlcpy.o
|
2005-12-19 16:39:54 +03:00
|
|
|
|
2017-06-02 10:54:54 +03:00
|
|
|
all: ii
|
2005-12-19 16:39:54 +03:00
|
|
|
|
|
|
|
options:
|
|
|
|
@echo ii build options:
|
2022-09-02 12:49:34 +03:00
|
|
|
@echo "CFLAGS = $(CFLAGS)"
|
2018-05-29 19:27:36 +03:00
|
|
|
@echo "LDFLAGS = $(LDFLAGS)"
|
|
|
|
@echo "CC = $(CC)"
|
2005-12-19 16:39:54 +03:00
|
|
|
|
2017-06-02 10:54:54 +03:00
|
|
|
.c.o:
|
2022-09-02 12:49:34 +03:00
|
|
|
$(CC) -c $< $(II_CFLAGS) $(II_CPPFLAGS)
|
2005-12-19 16:39:54 +03:00
|
|
|
|
2018-05-29 19:34:52 +03:00
|
|
|
ii: $(OBJ) $(LIBS)
|
2022-09-02 12:49:34 +03:00
|
|
|
$(CC) -o $@ $(OBJ) $(LIBS) $(II_LDFLAGS)
|
2005-12-19 16:39:54 +03:00
|
|
|
|
2018-05-29 19:27:36 +03:00
|
|
|
$(OBJ): arg.h
|
2017-12-04 00:17:36 +03:00
|
|
|
|
2005-12-19 16:39:54 +03:00
|
|
|
install: all
|
2018-05-29 19:27:36 +03:00
|
|
|
mkdir -p $(DESTDIR)$(PREFIX)/bin
|
|
|
|
mkdir -p $(DESTDIR)$(MANPREFIX)/man1
|
|
|
|
mkdir -p $(DESTDIR)$(DOCPREFIX)/ii
|
2022-09-02 12:50:51 +03:00
|
|
|
install -m 644 README FAQ LICENSE $(DESTDIR)$(DOCPREFIX)/ii
|
2018-05-29 19:27:36 +03:00
|
|
|
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
|
2005-12-19 16:39:54 +03:00
|
|
|
|
|
|
|
uninstall: all
|
2018-05-29 19:27:36 +03:00
|
|
|
rm -f $(DESTDIR)$(MANPREFIX)/man1/ii.1 $(DESTDIR)$(PREFIX)/bin/ii
|
|
|
|
rm -rf $(DESTDIR)$(DOCPREFIX)/ii
|
2017-06-02 10:54:54 +03:00
|
|
|
|
|
|
|
dist: clean
|
2018-05-29 19:27:36 +03:00
|
|
|
mkdir -p ii-$(VERSION)
|
2022-09-02 12:50:51 +03:00
|
|
|
cp -R Makefile README FAQ LICENSE strlcpy.c arg.h \
|
2022-09-02 12:49:34 +03:00
|
|
|
ii.c ii.1 ii-$(VERSION)
|
2022-09-02 12:52:58 +03:00
|
|
|
tar -cf - ii-$(VERSION) | gzip -c > ii-$(VERSION).tar.gz
|
2018-05-29 19:27:36 +03:00
|
|
|
rm -rf ii-$(VERSION)
|
2005-12-19 16:39:54 +03:00
|
|
|
|
|
|
|
clean:
|
2017-06-02 10:54:54 +03:00
|
|
|
rm -f ii *.o
|