summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorIgor Pashev <pashev.igor@gmail.com>2019-12-06 13:10:00 +0300
committerIgor Pashev <pashev.igor@gmail.com>2019-12-06 13:10:00 +0300
commit8c13fdabc9833ead8afb57f6c4b476fb7a1ab9e6 (patch)
tree6acdbdadfef2a251bb95ef0aed0f673f0f2bbfa9 /Makefile
parent45eb26992d9fa4efd74b7b283834dcfc212a403f (diff)
parentabf1f11b61b525aa6b95673e50d4be90505b1d67 (diff)
downloadwhois-master.tar.gz
Merge git://github.com/rfc1036/whoisHEADmaster
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile68
1 files changed, 49 insertions, 19 deletions
diff --git a/Makefile b/Makefile
index 8c33c61..da93d4c 100644
--- a/Makefile
+++ b/Makefile
@@ -1,9 +1,14 @@
prefix = /usr
+ifdef DESTDIR
+BASEDIR := $(DESTDIR)
+endif
+
CFLAGS ?= -g -O2
-PERL = perl
-INSTALL = install
+PKG_CONFIG ?= pkg-config
+PERL ?= perl
+INSTALL ?= install
whois_OBJECTS := whois.o utils.o
mkpasswd_OBJECTS := mkpasswd.o utils.o
@@ -15,7 +20,7 @@ mkpasswd_OBJECTS := mkpasswd.o utils.o
# FreeBSD
#whois_LDADD += -liconv
#LIBS += -L/usr/local/lib -lintl
-#INCLUDES += -I/usr/local/include
+#DEFS += -I/usr/local/include
# OS/2 EMX
#whois_LDADD += -lsocket
@@ -32,9 +37,17 @@ ifdef LOCALEDIR
DEFS += -DLOCALEDIR=\"$(BASEDIR)$(prefix)/share/locale\"
endif
+# libidn support has been autodetected since 5.2.18
ifdef HAVE_LIBIDN
-whois_LDADD += -lidn
-DEFS += -DHAVE_LIBIDN
+$(error Please fix your build system to stop defining HAVE_LIBIDN!)
+endif
+
+ifeq ($(shell $(PKG_CONFIG) --exists 'libidn2 >= 2.0.3' || echo NO),)
+whois_LDADD += $(shell $(PKG_CONFIG) --libs libidn2)
+DEFS += -DHAVE_LIBIDN2 $(shell $(PKG_CONFIG) --cflags libidn2)
+else ifeq ($(shell $(PKG_CONFIG) --exists 'libidn' || echo NO),)
+whois_LDADD += $(shell $(PKG_CONFIG) --libs libidn)
+DEFS += -DHAVE_LIBIDN $(shell $(PKG_CONFIG) --cflags libidn)
endif
ifdef HAVE_ICONV
@@ -42,14 +55,17 @@ whois_OBJECTS += simple_recode.o
DEFS += -DHAVE_ICONV
endif
-ifdef HAVE_XCRYPT
+ifeq ($(shell $(PKG_CONFIG) --exists 'libxcrypt >= 4.1' || echo NO),)
+DEFS += -DHAVE_CRYPT_H -DHAVE_LINUX_CRYPT_GENSALT $(shell $(PKG_CONFIG) --cflags libcrypt)
+mkpasswd_LDADD += $(shell $(PKG_CONFIG) --libs libcrypt)
+else ifdef HAVE_XCRYPT
+DEFS += -DHAVE_XCRYPT_H -DHAVE_LINUX_CRYPT_GENSALT
mkpasswd_LDADD += -lxcrypt
-DEFS += -DHAVE_XCRYPT -DHAVE_LINUX_CRYPT_GENSALT
+else ifdef HAVE_LIBOWCRYPT
+# owl and openSUSE have crypt_gensalt(3) in libowcrypt
+DEFS += -DHAVE_CRYPT_H -DHAVE_LINUX_CRYPT_GENSALT -D_OW_SOURCE
+mkpasswd_LDADD += -lcrypt -lowcrypt
else
-ifdef HAVE_LINUX_CRYPT_GENSALT
-# owl and openSUSE have crypt_gensalt(3) in the libc's libcrypt
-DEFS += -DHAVE_LINUX_CRYPT_GENSALT
-endif
mkpasswd_LDADD += -lcrypt
endif
@@ -70,25 +86,39 @@ mkpasswd: $(mkpasswd_OBJECTS)
##############################################################################
version.h: debian/changelog make_version_h.pl
- $(PERL) -w make_version_h.pl $< > $@
+ $(PERL) make_version_h.pl $< > $@
as_del.h: as_del_list make_as_del.pl
- $(PERL) -w make_as_del.pl < $< > $@
+ $(PERL) make_as_del.pl < $< > $@
as32_del.h: as32_del_list make_as32_del.pl
- $(PERL) -w make_as32_del.pl < $< > $@
+ $(PERL) make_as32_del.pl < $< > $@
ip_del.h: ip_del_list make_ip_del.pl
- $(PERL) -w make_ip_del.pl < $< > $@
+ $(PERL) make_ip_del.pl < $< > $@
ip6_del.h: ip6_del_list make_ip6_del.pl
- $(PERL) -w make_ip6_del.pl < $< > $@
+ $(PERL) make_ip6_del.pl < $< > $@
+
+new_gtlds.h: new_gtlds_list make_new_gtlds.pl
+ $(PERL) make_new_gtlds.pl < $< > $@
+
+nic_handles.h: nic_handles_list make_nic_handles.pl
+ $(PERL) make_nic_handles.pl < $< > $@
tld_serv.h: tld_serv_list make_tld_serv.pl
- $(PERL) -w make_tld_serv.pl < $< > $@
+ $(PERL) make_tld_serv.pl < $< > $@
servers_charset.h: servers_charset_list make_servers_charset.pl
- $(PERL) -w make_servers_charset.pl < $< > $@
+ $(PERL) make_servers_charset.pl < $< > $@
+
+##############################################################################
+afl:
+ -rm -f Makefile.depend
+ DEFS=-DAFL_MODE=1 AFL_HARDEN=1 $(MAKE) whois CC=afl-gcc HAVE_ICONV=1
+
+afl-run:
+ nice afl-fuzz -i ../afl_in -o ../afl_out -- ./whois
##############################################################################
install: install-whois install-mkpasswd install-pos
@@ -115,7 +145,7 @@ distclean: clean
clean:
rm -f Makefile.depend as_del.h as32_del.h ip_del.h ip6_del.h \
- tld_serv.h servers_charset.h *.o whois mkpasswd
+ new_gtlds.h tld_serv.h servers_charset.h *.o whois mkpasswd
rm -f po/*.mo
pos: