1 # The default target of this Makefile is this
4 # Define V=1 to have a more verbose compile.
6 # Define NO_PANEL if you don't want to use -lpanel.
8 # Define NEEDS_NCURSES5 if you need linking with ncurses5.
10 # Define NEEDS_NCURSESW5 if you need linking with ncursesw5.
12 # Define NEEDS_NCURSES6 if you need linking with ncurses6.
14 # Define NEEDS_NCURSESW6 if you need linking with ncursesw6.
18 @
$(SHELL_PATH
) .
/GEN-VERSION-FILE
21 CFLAGS
= -g
-O2
-Wall
-W
-std
=gnu99
-Werror
=format-security
-D_GNU_SOURCE
23 ALL_CFLAGS
= $(CPPFLAGS
) $(CFLAGS
)
24 ALL_LDFLAGS
= $(LDFLAGS
)
28 sbindir_relative
= sbin
29 sbindir
= $(prefix)/$(sbindir_relative
)
30 mandir = $(prefix)/share
/man
31 sharedir
= $(prefix)/share
32 localedir
= $(sharedir
)/locale
34 man8dir = $(mandir)/man8
39 export prefix bindir sharedir sysconfdir gitwebdir localedir
47 ### --- END CONFIGURATION SECTION ---
50 # Those must not be GNU-specific; they are shared with perl/ which may
51 # be built by a different compiler. (Note that this is an artifact now
52 # but it still might be nice to keep that distinction.)
53 BASIC_CFLAGS
= -I.
-Isrc
/
56 # Guard against environment variables
68 ALL_PROGRAMS
+= iptraf-ng rvnamed-ng
74 iptraf-h
+= src
/tui
/input.h
75 iptraf-h
+= src
/tui
/labels.h
76 iptraf-h
+= src
/tui
/listbox.h
77 iptraf-h
+= src
/tui
/menurt.h
78 iptraf-h
+= src
/tui
/msgboxes.h
79 iptraf-h
+= src
/tui
/winops.h
80 iptraf-h
+= src
/iptraf-ng-compat.h
81 iptraf-h
+= src
/parse-options.h
82 iptraf-h
+= src
/packet.h
83 iptraf-h
+= src
/tcptable.h
84 iptraf-h
+= src
/othptab.h
85 iptraf-h
+= src
/ifstats.h
86 iptraf-h
+= src
/deskman.h
87 iptraf-h
+= src
/hostmon.h
88 iptraf-h
+= src
/fltedit.h
89 iptraf-h
+= src
/cidr.h
90 iptraf-h
+= src
/fltselect.h
91 iptraf-h
+= src
/ipfilter.h
92 iptraf-h
+= src
/fltmgr.h
93 iptraf-h
+= src
/ipfrag.h
94 iptraf-h
+= src
/serv.h
95 iptraf-h
+= src
/servname.h
96 iptraf-h
+= src
/timer.h
97 iptraf-h
+= src
/ifaces.h
98 iptraf-h
+= src
/error.h
99 iptraf-h
+= src
/revname.h
100 iptraf-h
+= src
/log.h
101 iptraf-h
+= src
/pktsize.h
102 iptraf-h
+= src
/landesc.h
103 iptraf-h
+= src
/dirs.h
104 iptraf-h
+= src
/getpath.h
105 iptraf-h
+= src
/options.h
106 iptraf-h
+= src
/promisc.h
107 iptraf-h
+= src
/parseproto.h
108 iptraf-h
+= src
/addproto.h
109 iptraf-h
+= src
/arphdr.h
110 iptraf-h
+= src
/attrs.h
111 iptraf-h
+= src
/fltdefs.h
112 iptraf-h
+= src
/logvars.h
113 iptraf-h
+= src
/list.h
114 iptraf-h
+= src
/counters.h
115 iptraf-h
+= src
/rate.h
116 iptraf-h
+= src
/built-in.h
117 iptraf-h
+= src
/sockaddr.h
118 iptraf-h
+= src
/capt.h
119 iptraf-h
+= src
/capt-recvmsg.h
120 iptraf-h
+= src
/capt-recvmmsg.h
121 iptraf-h
+= src
/capt-mmap-v2.h
122 iptraf-h
+= src
/capt-mmap-v3.h
124 iptraf-o
+= src
/tui
/input.o
125 iptraf-o
+= src
/tui
/labels.o
126 iptraf-o
+= src
/tui
/listbox.o
127 iptraf-o
+= src
/tui
/menurt.o
128 iptraf-o
+= src
/tui
/msgboxes.o
129 iptraf-o
+= src
/tui
/winops.o
130 iptraf-o
+= src
/error.o
131 iptraf-o
+= src
/log.o
132 iptraf-o
+= src
/getpath.o
133 iptraf-o
+= src
/parseproto.o
134 iptraf-o
+= src
/fltselect.o
135 iptraf-o
+= src
/ipfilter.o
136 iptraf-o
+= src
/fltmgr.o
137 iptraf-o
+= src
/ipfrag.o
138 iptraf-o
+= src
/serv.o
139 iptraf-o
+= src
/servname.o
140 iptraf-o
+= src
/timer.o
141 iptraf-o
+= src
/revname.o
142 iptraf-o
+= src
/pktsize.o
143 iptraf-o
+= src
/landesc.o
144 iptraf-o
+= src
/options.o
145 iptraf-o
+= src
/promisc.o
146 iptraf-o
+= src
/ifaces.o
147 iptraf-o
+= src
/usage.o
148 iptraf-o
+= src
/iptraf.o
149 iptraf-o
+= src
/itrafmon.o
150 iptraf-o
+= src
/wrapper.o
151 iptraf-o
+= src
/parse-options.o
152 iptraf-o
+= src
/packet.o
153 iptraf-o
+= src
/tcptable.o
154 iptraf-o
+= src
/othptab.o
155 iptraf-o
+= src
/ifstats.o
156 iptraf-o
+= src
/detstats.o
157 iptraf-o
+= src
/deskman.o
158 iptraf-o
+= src
/hostmon.o
159 iptraf-o
+= src
/fltedit.o
160 iptraf-o
+= src
/cidr.o
161 iptraf-o
+= src
/counters.o
162 iptraf-o
+= src
/rate.o
163 iptraf-o
+= src
/capture-pkt.o
164 iptraf-o
+= src
/sockaddr.o
165 iptraf-o
+= src
/capt.o
166 iptraf-o
+= src
/capt-recvmsg.o
167 iptraf-o
+= src
/capt-recvmmsg.o
168 iptraf-o
+= src
/capt-mmap-v2.o
169 iptraf-o
+= src
/capt-mmap-v3.o
171 rvnamed-o
+= src
/rvnamed.o
172 rvnamed-o
+= src
/getpath.o
173 rvnamed-o
+= src
/sockaddr.o
174 rvnamed-o
+= src
/usage.o
176 -include config.mak.autogen
180 ifeq ($(prefix),/usr
)
187 ifdef CHECK_HEADER_DEPENDENCIES
188 COMPUTE_HEADER_DEPENDENCIES
= no
189 USE_COMPUTED_HEADER_DEPENDENCIES
=
192 ifndef COMPUTE_HEADER_DEPENDENCIES
193 COMPUTE_HEADER_DEPENDENCIES
= auto
196 ifeq ($(COMPUTE_HEADER_DEPENDENCIES
),auto
)
197 dep_check
= $(shell $(CC
) $(ALL_CFLAGS
) \
198 -c
-MF
/dev
/null
-MMD
-MP
-x c
/dev
/null
-o
/dev
/null
2>&1; \
200 ifeq ($(dep_check
),0)
201 override COMPUTE_HEADER_DEPENDENCIES
= yes
203 override COMPUTE_HEADER_DEPENDENCIES
= no
207 ifeq ($(COMPUTE_HEADER_DEPENDENCIES
),yes
)
208 USE_COMPUTED_HEADER_DEPENDENCIES
= YesPlease
210 ifneq ($(COMPUTE_HEADER_DEPENDENCIES
),no
)
211 $(error please set COMPUTE_HEADER_DEPENDENCIES to yes
, no
, or auto \
212 (not
"$(COMPUTE_HEADER_DEPENDENCIES)"))
216 ifndef NCURSES_LDFLAGS
218 NCURSES_CFLAGS
:= $(shell ncurses5-config
--cflags 2>/dev
/null
)
219 NCURSES_LDFLAGS
:= $(shell ncurses5-config
--libs
2>/dev
/null
)
221 NCURSES_LDFLAGS
+= -lpanel
226 ifndef NCURSES_LDFLAGS
227 ifdef NEEDS_NCURSESW5
228 NCURSES_CFLAGS
:= $(shell ncursesw5-config
--cflags 2>/dev
/null
)
229 NCURSES_LDFLAGS
:= $(shell ncursesw5-config
--libs
2>/dev
/null
)
231 NCURSES_LDFLAGS
+= -lpanelw
236 ifndef NCURSES_LDFLAGS
238 NCURSES_CFLAGS
:= $(shell ncurses6-config
--cflags 2>/dev
/null
)
239 NCURSES_LDFLAGS
:= $(shell ncurses6-config
--libs
2>/dev
/null
)
241 NCURSES_LDFLAGS
+= -lpanel
246 ifndef NCURSES_LDFLAGS
247 ifdef NEEDS_NCURSESW6
248 NCURSES_CFLAGS
:= $(shell ncursesw6-config
--cflags 2>/dev
/null
)
249 NCURSES_LDFLAGS
:= $(shell ncursesw6-config
--libs
2>/dev
/null
)
251 NCURSES_LDFLAGS
+= -lpanelw
256 # try find ncuses by autodetect
257 ifndef NCURSES_LDFLAGS
258 ifneq ($(shell ncursesw6-config
--libs
2>/dev
/null
),)
259 NCURSES_CFLAGS
:= $(shell ncursesw6-config
--cflags 2>/dev
/null
)
260 NCURSES_LDFLAGS
:= $(shell ncursesw6-config
--libs
2>/dev
/null
)
262 NCURSES_LDFLAGS
+= -lpanelw
264 else ifneq ($(shell ncurses6-config
--libs
2>/dev
/null
),)
265 NCURSES_CFLAGS
:= $(shell ncurses6-config
--cflags 2>/dev
/null
)
266 NCURSES_LDFLAGS
:= $(shell ncurses6-config
--libs
2>/dev
/null
)
268 NCURSES_LDFLAGS
+= -lpanel
270 else ifneq ($(shell ncursesw5-config
--libs
2>/dev
/null
),)
271 NCURSES_CFLAGS
:= $(shell ncursesw5-config
--cflags 2>/dev
/null
)
272 NCURSES_LDFLAGS
:= $(shell ncursesw5-config
--libs
2>/dev
/null
)
274 NCURSES_LDFLAGS
+= -lpanelw
276 else ifneq ($(shell ncurses5-config
--libs
2>/dev
/null
),)
277 NCURSES_CFLAGS
:= $(shell ncurses5-config
--cflags 2>/dev
/null
)
278 NCURSES_LDFLAGS
:= $(shell ncurses5-config
--libs
2>/dev
/null
)
280 NCURSES_LDFLAGS
+= -lpanel
285 QUIET_SUBDIR0
= +$(MAKE
) -C
# space to separate -C and subdir
288 ifneq ($(findstring $(MAKEFLAGS
),w
),w
)
289 PRINT_DIR
= --no-print-directory
294 ifneq ($(findstring $(MAKEFLAGS
),s
),s
)
296 QUIET_CC
= @echo
' ' CC
$@
;
297 QUIET_LINK
= @echo
' ' LINK
$@
;
298 QUIET_GEN
= @echo
' ' GEN
$@
;
299 QUIET_SUBDIR0
= +@subdir
=
300 QUIET_SUBDIR1
= ;$(NO_SUBDIR
) echo
' ' SUBDIR
$$subdir; \
301 $(MAKE
) $(PRINT_DIR
) -C
$$subdir
304 export QUIET_BUILT_IN
309 DESTDIR_SQ
= $(subst ','\'',$(DESTDIR))
310 sbindir_SQ = $(subst ','\'',$(sbindir
))
312 ALL_CFLAGS
+= $(BASIC_CFLAGS
)
313 ALL_LDFLAGS
+= $(BASIC_LDFLAGS
)
315 export TAR INSTALL DESTDIR SHELL_PATH
319 SHELL
= $(SHELL_PATH
)
321 #all:: shell_compatibility_test
322 #please_set_SHELL_PATH_to_a_more_modern_shell:
324 #shell_compatibility_test: please_set_SHELL_PATH_to_a_more_modern_shell
327 all:: $(ALL_PROGRAMS
)
329 iptraf-ng
: $(iptraf-o
)
330 $(QUIET_LINK
)$(CC
) $(ALL_CFLAGS
) -o
$@ \
331 $(iptraf-o
) $(ALL_LDFLAGS
) $(NCURSES_LDFLAGS
)
333 src
/deskman.o src
/iptraf.o
: VERSION-FILE
334 src
/deskman.o src
/iptraf.o src
/capture-pkt.o
: EXTRA_CPPFLAGS
= \
335 -DIPTRAF_VERSION
='"$(IPTRAF_VERSION)"' \
336 -DIPTRAF_NAME
='"iptraf-ng"'
338 rvnamed-ng
: $(rvnamed-o
)
339 $(QUIET_LINK
)$(CC
) $(ALL_CFLAGS
) -o
$@ \
340 $(rvnamed-o
) $(ALL_LDFLAGS
)
342 configure
: configure.ac
343 $(QUIET_GEN
)$(RM
) $@
$<+ && \
344 sed
-e
's/@@IPTRAF_VERSION@@/$(IPTRAF_VERSION)/g' \
346 autoconf
-o
$@
$<+ && \
349 OBJECTS
:= $(sort $(iptraf-o
) $(rvnamed-o
))
351 dep_files
:= $(foreach f
,$(OBJECTS
),$(dir $f).depend
/$(notdir $f).d
)
352 dep_dirs
:= $(addsuffix .depend
,$(sort $(dir $(OBJECTS
))))
354 ifeq ($(COMPUTE_HEADER_DEPENDENCIES
),yes
)
358 missing_dep_dirs
:= $(filter-out $(wildcard $(dep_dirs
)),$(dep_dirs
))
359 dep_file
= $(dir $@
).depend
/$(notdir $@
).d
360 dep_args
= -MF
$(dep_file
) -MMD
-MP
361 ifdef CHECK_HEADER_DEPENDENCIES
362 $(error cannot compute header dependencies outside a normal build. \
363 Please unset CHECK_HEADER_DEPENDENCIES and try again
)
369 ifdef PRINT_HEADER_DEPENDENCIES
370 $(OBJECTS
): %.o
: %.c FORCE
373 ifndef CHECK_HEADER_DEPENDENCIES
374 $(error cannot
print header dependencies during a normal build. \
375 Please set CHECK_HEADER_DEPENDENCIES and try again
)
379 ifndef PRINT_HEADER_DEPENDENCIES
380 ifdef CHECK_HEADER_DEPENDENCIES
381 $(OBJECTS
): %.o
: %.c
$(dep_files
) FORCE
382 @set
-e
; echo CHECK
$@
; \
383 missing_deps
="$(missing_deps)"; \
384 if
test "$$missing_deps"; \
386 echo missing dependencies
: $$missing_deps; \
392 ifndef CHECK_HEADER_DEPENDENCIES
393 $(OBJECTS
): %.o
: %.c
$(missing_dep_dirs
)
394 $(QUIET_CC
)$(CC
) -o
$*.o
-c
$(dep_args
) $(NCURSES_CFLAGS
) $(ALL_CFLAGS
) $(EXTRA_CPPFLAGS
) $<
397 ifdef USE_COMPUTED_HEADER_DEPENDENCIES
398 # Take advantage of gcc's on-the-fly dependency generation
399 # See <http://gcc.gnu.org/gcc-3.0/features.html>.
400 dep_files_present
:= $(wildcard $(dep_files
))
401 ifneq ($(dep_files_present
),)
402 include $(dep_files_present
)
405 # Dependencies on header files, for platforms that do not support
406 # the gcc -MMD option.
408 # Dependencies on automatically generated headers such as common-cmds.h
409 # should _not_ be included here, since they are necessary even when
410 # building an object for the first time.
412 # XXX. Please check occasionally that these include all dependencies
415 $(OBJECTS
): $(iptraf-h
)
419 ### Maintainer's dist rules
421 iptraf-ng.spec
: iptraf-ng.spec.in
422 sed
-e
's/@@IPTRAF_VERSION@@/$(IPTRAF_VERSION)/g' < $< > $@
+
425 IPTRAF_TARNAME
= iptraf-ng-
$(IPTRAF_VERSION
)
426 dist: iptraf-ng.spec configure
427 @mkdir
-p
$(IPTRAF_TARNAME
)
428 @cp iptraf-ng.spec configure
$(IPTRAF_TARNAME
)
429 @cp
--parents
`git ls-files` $(IPTRAF_TARNAME
)
430 @echo
$(IPTRAF_VERSION
) > $(IPTRAF_TARNAME
)/version
431 $(TAR
) cf
$(IPTRAF_TARNAME
).
tar $(IPTRAF_TARNAME
)
432 @
$(RM
) -rf
$(IPTRAF_TARNAME
)
433 gzip
-f
-9 $(IPTRAF_TARNAME
).
tar
437 --define "_source_filedigest_algorithm md5" \
438 --define "_binary_filedigest_algorithm md5" \
439 -ta
$(IPTRAF_TARNAME
).
tar.gz
442 ## TODO: use asciidoc to generate mans
444 ### Installation rules
446 @echo
$(DESTDIR_SQ
)$(man8dir)
447 $(INSTALL
) -d
-m
755 '$(DESTDIR_SQ)$(sbindir_SQ)'
448 $(INSTALL
) $(ALL_PROGRAMS
) '$(DESTDIR_SQ)$(sbindir_SQ)'
449 $(INSTALL
) -d
-m
755 $(DESTDIR
)$(man8dir)
450 $(INSTALL
) -m
644 src
/iptraf-ng
.8 $(DESTDIR
)$(man8dir)
451 $(INSTALL
) -m
644 src
/rvnamed-ng
.8 $(DESTDIR
)$(man8dir)
459 $(RM
) src
/*.o src
/tui
/*.o
460 $(RM
) $(ALL_PROGRAMS
)
461 $(RM
) -r autom4te.cache
464 $(RM
) $(IPTRAF_TARNAME
).
tar.gz
465 $(RM
) config.log config.mak.autogen config.mak.append config.status config.cache
472 .PHONY
: clean distclean all install FORCE