| 1 |
prefix = $(DESTDIR)/usr |
| 2 |
bindir = ${prefix}/sbin |
| 3 |
mandir = ${prefix}/share/man |
| 4 |
|
| 5 |
CC ?= gcc |
| 6 |
CFLAGS += -Wall -std=c11 -pedantic -O2 |
| 7 |
SSL_LIBS ?= -lssl |
| 8 |
|
| 9 |
INSTALL ?= install -c |
| 10 |
STRIP ?= strip -s |
| 11 |
|
| •12 |
ENABLE_HTTPS ?= 1 |
| 13 |
ifeq ($(ENABLE_HTTPS),1) |
| 14 |
CPPFLAGS += -DENABLE_HTTPS |
| •15 |
LIBS += $(SSL_LIBS) |
| 16 |
endif |
| 17 |
|
| •18 |
all: htpdate |
| 19 |
htpdate: htpdate.c |
| •20 |
$(CC) $(CFLAGS) $(LDFLAGS) $(CPPFLAGS) -o htpdate htpdate.c $(LIBS) |
| 21 |
|
| 22 |
install: all |
| 23 |
$(STRIP) htpdate |
| 24 |
mkdir -p $(bindir) |
| 25 |
$(INSTALL) -m 755 htpdate $(bindir)/htpdate |
| 26 |
mkdir -p $(mandir)/man8 |
| 27 |
$(INSTALL) -m 644 htpdate.8 $(mandir)/man8/htpdate.8 |
| 28 |
gzip -f -9 $(mandir)/man8/htpdate.8 |
| 29 |
|
| 30 |
test: |
| 31 |
./htpdate -v |
| 32 |
./htpdate -p 1 www.example.com http://www.example.com https://example.com |
| 33 |
./htpdate -p 1 -d www.example.com www.example.com:80/htpdate.html |
| 34 |
./htpdate -p 2 -04q www.example.com/ |
| 35 |
./htpdate -6q www.example.com |
| 36 |
./htpdate -t -dd www.example.com |
| 37 |
./htpdate -p1 https://93.184.216.34 https://93.184.216.34:443 |
| 38 |
./htpdate -p1 93.184.216.34:80 |
| 39 |
./htpdate -p1 [2606:2800:220:1:248:1893:25c8:1946] |
| 40 |
./htpdate -h |
| 41 |
|
| 42 |
clean: |
| 43 |
rm -rf htpdate |
| 44 |
|
| 45 |
uninstall: |
| 46 |
rm -rf $(bindir)/htpdate |
| 47 |
rm -rf $(mandir)/man8/htpdate.8.gz |