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