File: Makefile.mingw

package info (click to toggle)
ntop 3:3.3-11
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 12,772 kB
  • ctags: 7,534
  • sloc: ansic: 71,427; sh: 16,772; awk: 1,504; perl: 792; makefile: 782; php: 123; python: 23; sql: 13; sed: 11
file content (105 lines) | stat: -rw-r--r-- 3,351 bytes parent folder | download | duplicates (4)
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
#
# ntop makefile for MingW
#

USE_SSL = 1

VERSION = 3.0

#
# Root direcories for need packages. Edit these as needed.
#
GDCHART_ROOT = ../../Graphics/gdchart0.94c
GD_ROOT      = ../../Graphics/gdchart0.94c/gd-1.8.3
PNG_ROOT     = ../../Graphics/libpng-1.24
ZLIB_ROOT    = ../../zlib-1.2.1
GDBM_ROOT    = ../../gdbm-1.8.0
PCAP_ROOT    = ../libpcap
OPENSSL_ROOT = ../OpenSSL-0.9.8

OBJ_DIR = MingW_obj

VPATH = plugins myrrd

CC     = gcc
CFLAGS = -O2 -Wall -g -I. -I./myrrd -I$(PCAP_ROOT) -I$(PCAP_ROOT)/bpf/net \
         -I$(PCAP_ROOT)/Win32/include -I$(GD_ROOT) -I$(PNG_ROOT) -I$(GDBM_ROOT) \
         -DHAVE_FCNTL_H -DHAVE_PCAP_H -DHAVE_STDARG_H -DHAVE_PCAP_OPEN_DEAD \
         -DHAVE_PCAP_LIB_VERSION -DHAVE_STRFTIME -DHAVE_MATH_H -DHAVE_INT8_T \
         -DHAVE_INT16_T -DHAVE_INT32_T -DHAVE_UINT8_T -DHAVE_UINT16_T \
         -DHAVE_UINT32_T

LDFLAGS = -s

LIBS = $(PCAP_ROOT)/libwpcap.a      $(ZLIB_ROOT)/libz.a \
       $(GDCHART_ROOT)/libgdchart.a $(GD_ROOT)/libgd.a \
       $(PNG_ROOT)/lib/libpng.a     $(GDBM_ROOT)/libgdbm.a \
       -lversion -lws2_32

PROGRAM = ntop.exe

SOURCE = ntop.c ntop_win32.c main.c address.c admin.c dataFormat.c emitter.c \
         globals-core.c globals-report.c graph.c hash.c http.c initialize.c leaks.c \
         fcUtils.c pbuf.c plugin.c protocols.c iface.c qsort.c report.c reportUtils.c \
         sessions.c term.c traffic.c util.c vendor.c version.c webInterface.c \
         getopt.c getopt1.c ssl.c \
         \
         $(addprefix plugins/, icmpPlugin.c lastSeenPlugin.c netflowPlugin.c \
           pdaPlugin.c sflowPlugin.c rrdPlugin.c) \
         \
         $(addprefix myrrd/, gdlucidab10.c gdlucidab12.c gdlucidab12l2.c gdlucidab14.c \
           gdlucidan10.c gdlucidan10l2.c gdlucidan12.c gdlucidan14.c gdpng.c gifsize.c \
           parsetime.c pngsize.c rrd_create.c rrd_diff.c rrd_error.c rrd_fetch.c \
           rrd_format.c rrd_graph.c rrd_last.c rrd_open.c rrd_update.c dummy.c)

OBJECTS = $(addprefix $(OBJ_DIR)/, $(notdir $(SOURCE:.c=.o)))

ifeq ($(USE_SSL),1)
  CFLAGS += -I$(OPENSSL_ROOT)/outinc -DHAVE_OPENSSL -DOPENSSL_NO_KRB5
  LIBS   += $(OPENSSL_ROOT)/out/libeay32.dll.a $(OPENSSL_ROOT)/out/libssl32.dll.a
endif

all: ./config.h $(OBJ_DIR) $(PROGRAM) ntop.html
	@echo Welcome to ntop

$(OBJ_DIR):
	mkdir $(OBJ_DIR)

$(PROGRAM): $(OBJECTS)
	$(CC) $(LDFLAGS) -o $@ $^ $(LIBS)

$(OBJ_DIR)/%.o: %.c
	$(CC) $(CFLAGS) -o $@ -c $<
	@echo

./config.h:
	@echo '/* config.h for MingW */' > $@
	@echo '#include <winsock2.h>' >> $@
	@echo '#include <ws2tcpip.h>' >> $@

version.c:
	@echo Creating version.c...
	@echo 'char *VERSION = "$(VERSION)";'   > $@
	@echo 'char *version = "$(VERSION)";'  >> $@
	@echo 'char *osName  = "Win32/MingW";' >> $@
	@echo 'char *release = "(rel)";'       >> $@
	@echo 'char *distro  = "(??)";'        >> $@
	@echo 'char *author  = "Luca Deri <deri@unipi.it>";' >> $@
	@echo 'char *compiler_cflags = "$(CFLAGS)";' >> $@
	@echo 'char *core_libs       = "$(LIBS)";'   >> $@
	@echo 'char *system_libs     = "$(LIBS)";'   >> $@

clean:
	rm -f $(OBJECTS)

vclean distclean: clean
	rm -f $(PROGRAM) version.c ./config.h .depend

ntop.html: ntop.8
	man2html < $^ | sed -e 's/Content-type: text\/html//g' > $@

depend: version.c ./config.h
	$(CC) -MM $(CFLAGS) $(SOURCE) | \
	sed -e 's/^\([a-zA-Z0-9_-]*\.o:\)/'$(OBJ_DIR)'\/\1/' > .depend

-include .depend