-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
102 lines (87 loc) · 2.65 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
#
# Copyright (c) 2020-2022 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_DNSDB2=1
CGPROF =
CDEBUG = -g -O3
CFLAGS += $(CGPROF) $(CDEBUG) $(CWARN) $(CDEFS)
TOOL = dnsdbflex
TOOL_OBJ = $(TOOL).o ns_ttl.o netio.o pdns.o pdns_dnsdb.o \
time.o
TOOL_SRC = $(TOOL).c ns_ttl.c netio.c pdns.c pdns_dnsdb.c \
time.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)
dnsdbflex: $(TOOL_OBJ) Makefile
$(CC) $(CDEBUG) -o $(TOOL) $(CGPROF) $(TOOL_OBJ) $(CURLLIBS) $(JANSLIBS)
.c.o:
$(CC) $(CFLAGS) $(CURLINCL) $(JANSINCL) -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
dnsdbflex.o: dnsdbflex.c \
defs.h netio.h \
pdns.h \
pdns_dnsdb.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
pdns.o: pdns.c defs.h \
netio.h \
pdns.h \
time.h \
globals.h
pdns_dnsdb.o: pdns_dnsdb.c \
defs.h \
pdns.h \
netio.h \
pdns_dnsdb.h time.h globals.h
time.o: time.c \
defs.h time.h \
globals.h pdns.h \
netio.h \
ns_ttl.h