-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmakefile
176 lines (134 loc) · 3.45 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
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
#
# $Id: //devel/tools/main/nbtscan/makefile#5 $
#
# This is the makefile for the NBTSCAN program, which compiles and
# runs under both NT and many flavors of UNIX. This requires GNU
# make (especially under NT, sorry). If you are building under NT
# and *don't* have GNU make, use:
#
# nmake /f makefile.nt all
#
#-------------------------------------------------------------------
# Operating system detection
#
# See if we're running NT or UNIX so the rest of the Makefile is
# keyed to actual operating system type and not to funky
# environment variables.
#
ifdef PROCESSOR_ARCHITECTURE
OS=NT
else
OS=unix
endif
#-------------------------------------------------------------------
# NT is lots different than UNIX, so we take care of the CFLAGS and
# the like right here. These are the flags of interest:
#
# /nologo suppress that damn copyright message
#
# /MD link with the shared MSVCRT.DLL library. This
# reduces the footprint of the .EXE. All NT
# systems have this DLL installed in the WINNT
# directories.
#
# /GF enable readonly string pooling. Safer!
#
# /G5 optimize for Pentium
#
# /W3 enable lots of warnings
#
ifeq ($(OS),NT)
O = obj
L = lib
E = .exe
CC = cl
CFLAGS = /nologo -DENABLE_PERL
LIBS = wsock32.lib kernel32.lib advapi32.lib
else
O = o
L = a
E =
CFLAGS = -DENABLE_PERL
LIBS = $(NETLIBS)
endif
CFLAGS += $(PENCFLAGS)
#PENLIB = ../lib/libpen.$L
#CINCLUDES = -I../lib
all : nbtscan$E $(PENLIB)
OBJS = nbtscan.$O parse_target_cb.$O \
dump_packet.$O \
byteswap_nodestats.$O netbios_fixname.$O \
process_response.$O netbios_name.$O \
display_nbtstat.$O parse_nbtstat.$O \
packetio.$O errors.$O hostname.$O \
version.$O targets.$O gen_perl.$O
CFLAGS += -DCOMMONFILE=\"nbtscan_common.h\"
OBJS += all_digitsA.$O \
die.$O \
lookup_hostname.$O \
netbios_pack.$O \
netbios_unpack.$O \
netmasks.$O \
nstrcpyA.$O \
parse_inaddr.$O \
parse_target.$O \
printable_NETBIOS_question_class.$O \
printable_NETBIOS_question_type.$O \
sleep_msecs.$O \
stripA.$O \
timeval_set_secs.$O \
winsock.$O
$(OBJS) : nbtdefs.h
CLEAN = *.$O nbtscan$E nbtscan-source.tgz *.pch
ifeq ($(OS),NT)
LINKDEBUG=/debug /debugtype:both
nbtscan.exe : $(OBJS) $(PENLIB)
$(strip link /nologo /out:$@ $(OBJS) $(PENLIB) $(LIBS))
else
nbtscan : $(OBJS) $(PENLIB)
$(strip $(CC) -o $@ $(OBJS) $(PENLIB) $(LIBS))
endif
ifdef COPY
deliver : nbtscan$E
$(COPY) $^ $(DELIVER)
endif
clean :
-rm -f $(CLEAN)
#------------------------------------------------------------------------
# Set rules for building objects from sources
#
ifeq ($(OS), NT)
%.obj : %.c
cl /YXnbtscan_common.h $(CINCLUDES) $(CFLAGS) -c $*.c
else
%.o : %.c
$(CC) $(CINCLUDES) $(CFLAGS) -c $*.c
endif
#------------------------------------------------------------------------
# Create a tarball
#
SOURCES = makefile README
SOURCES += $(OBJS:.o=.c)
SOURCES += nbtdefs.h nbtscan_common.h penlib.h win_sock.h
tarball : nbtscan-source.tgz nbtscan-source.zip
nbtscan-source.tgz : $(SOURCES)
gtar -czvf $@ $(SOURCES)
nbtscan-source.zip : $(SOURCES)
zip $@ $(SOURCES)
# ------------------------------------------------------------------------
# PC-Lint stuff
#
ifdef PCLINTDIR
CSRC = $(OBJS:.$O=.c)
lint : $(CSRC)
lint-nt -i../lib -u local.lnt $(CSRC) > lint.out
endif
ifdef INSTDIR
ifdef PROCESSOR_REVISION
install : nbtscan.exe
xcopy /Y nbtscan.exe $(INSTDIR)\nbtscan.exe
else
install : nbtscan
cp nbtscan $(INSTDIR); chmod a+x $(INSTDIR)/nbtscan
endif
endif