1# 2# Copyright (c) 2014-2020 by Farsight Security, Inc. 3# 4# Licensed under the Apache License, Version 2.0 (the "License"); 5# you may not use this file except in compliance with the License. 6# You may obtain a copy of the License at 7# 8# http://www.apache.org/licenses/LICENSE-2.0 9# 10# Unless required by applicable law or agreed to in writing, software 11# distributed under the License is distributed on an "AS IS" BASIS, 12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13# See the License for the specific language governing permissions and 14# limitations under the License. 15# 16 17CURLINCL = `curl-config --cflags` 18JANSINCL = -I$(LOCALBASE)/include 19 20CURLLIBS = `[ ! -z "$$(curl-config --libs)" ] && curl-config --libs || curl-config --static-libs` 21JANSLIBS = -L$(LOCALBASE)/lib -ljansson 22 23CWARN =-W -Wall -Wextra -Wcast-qual -Wpointer-arith -Wwrite-strings \ 24 -Wmissing-prototypes -Wbad-function-cast -Wnested-externs \ 25 -Wunused -Wshadow -Wmissing-noreturn -Wswitch-enum -Wconversion 26# try shipping without any warnings 27CWARN +=-Werror 28# warning about bad indentation, only for clang 6.x+ 29#CWARN +=-Werror=misleading-indentation 30 31CDEFS = -DWANT_PDNS_DNSDB=1 -DWANT_PDNS_CIRCL=1 32CGPROF = 33CDEBUG = -g -O3 34CFLAGS += $(CGPROF) $(CDEBUG) $(CWARN) $(CDEFS) 35INCL= $(CURLINCL) $(JANSINCL) 36# freebsd requires that -lresolv _not_ be used here 37LIBS= $(CURLLIBS) $(JANSLIBS) 38#LIBS= $(CURLLIBS) $(JANSLIBS) 39 40TOOL = dnsdbq 41TOOL_OBJ = $(TOOL).o ns_ttl.o netio.o \ 42 pdns.o pdns_circl.o pdns_dnsdb.o \ 43 sort.o time.o asinfo.o deduper.o 44TOOL_SRC = $(TOOL).c ns_ttl.c netio.c \ 45 pdns.c pdns_circl.c pdns_dnsdb.c \ 46 sort.c time.c asinfo.c deduper.c 47 48all: $(TOOL) 49 50install: all 51 rm -f $(PREFIX)/bin/$(TOOL) 52 mkdir -p $(PREFIX)/bin 53 cp $(TOOL) $(PREFIX)/bin/$(TOOL) 54 rm -f $(PREFIX)/share/man/man1/$(TOOL).1 55 mkdir -p $(PREFIX)/share/man/man1 56 cp $(TOOL).man $(PREFIX)/share/man/man1/$(TOOL).1 57 58clean: 59 rm -f $(TOOL) 60 rm -f $(TOOL_OBJ) 61 62dnsdbq: $(TOOL_OBJ) Makefile 63 $(CC) $(CDEBUG) -o $(TOOL) $(CGPROF) $(TOOL_OBJ) $(LIBS) 64 65.c.o: 66 $(CC) $(CFLAGS) $(INCL) -c $< 67 68$(TOOL_OBJ): Makefile 69 70# BSD only 71depend: 72 mkdep $(CURLINCL) $(JANSINCL) $(CDEFS) $(TOOL_SRC) 73 74# these were made by mkdep on BSD but are now staticly edited 75deduper.o: deduper.c deduper.h 76asinfo.o: asinfo.c \ 77 asinfo.h globals.h defs.h sort.h pdns.h netio.h 78dnsdbq.o: dnsdbq.c \ 79 defs.h netio.h \ 80 pdns.h \ 81 pdns_dnsdb.h pdns_circl.h sort.h \ 82 time.h globals.h 83ns_ttl.o: ns_ttl.c \ 84 ns_ttl.h 85netio.o: netio.c \ 86 defs.h netio.h \ 87 pdns.h \ 88 globals.h sort.h 89pdns.o: pdns.c defs.h \ 90 asinfo.h \ 91 netio.h \ 92 pdns.h \ 93 time.h \ 94 globals.h sort.h 95pdns_circl.o: pdns_circl.c \ 96 defs.h \ 97 pdns.h \ 98 netio.h \ 99 pdns_circl.h globals.h sort.h 100pdns_dnsdb.o: pdns_dnsdb.c \ 101 defs.h \ 102 pdns.h \ 103 netio.h \ 104 pdns_dnsdb.h time.h globals.h sort.h 105sort.o: sort.c \ 106 defs.h sort.h pdns.h \ 107 netio.h \ 108 globals.h 109time.o: time.c \ 110 defs.h time.h \ 111 globals.h sort.h pdns.h \ 112 netio.h \ 113 ns_ttl.h 114