1# Config-Makefile for Husky-packages
2# You must modify this file according to your needs.
3
4## common options ##
5
6# Build with debug info, link with debug version of CRT
7DEBUG=0
8DEBUG_TREE=0
9
10# Enable optimization
11OPTIMIZATION=0
12
13# Build libraries as dlls. Buils static libs otherwise
14!if "$(DYNLIBS)"=="1"
15DYNLIBS=1
16!else
17DYNLIBS=0
18!endif
19
20# Link CRT statically
21# It is useful for building binaries for distribution but it will generate big executables
22# Don't use with DYNLIBS=1 without testing first
23STATICCRT = 0
24
25# Perl support
26USE_PERL=0
27
28# ZipInternal packer
29USE_HPTZIP=1
30
31# Uncomment one of these lines if you want to enable hardlinking
32# on NTFS 4.0 or 5.0
33#NTDEF	= -D_WIN32_WINNT=0 -D_WIN32_WINDOWS=0x0400 -DWINVER=0x0400
34#NTDEF	= -D_WIN32_WINNT=0x0400
35#NTDEF	= -D_WIN32_WINNT=0x0500
36
37!if $(USE_PERL)==1
38PERL_DIR = C:\Perl
39PERLV    = 510
40PERLL    = delayimp.lib $(PERL_DIR)\lib\core\perl$(PERLV).lib
41PERLI    = -I$(PERL_DIR)\lib\core
42PERLD    = -DDO_PERL -DWIN32 -DNO_STRICT -DHAVE_DES_FCRYPT -DPERL_IMPLICIT_CONTEXT -DPERL_IMPLICIT_SYS -DPERL_MSVCRT_READFIX
43PERLDLL  = /delayload:perl$(PERLV).dll
44PERLOBJ  = $(O)perl$(_OBJ)
45!else
46PERLOBJ  =
47PERLI    =
48PERLD    =
49PERLDLL  =
50!endif
51
52
53!if $(USE_HPTZIP) == 1
54
55!if $(DYNLIBS)==1
56HPTZIPL = $(LIBOUT)/$(IMPLIBPREFIX)hptzip$(DLLSUFFIX)$(_LIB)
57!else
58HPTZIPL = $(LIBOUT)/$(LIBPREFIX)hptzip$(LIBSUFFIX)$(_LIB)
59!endif
60
61# path to "hptzip/hptzip.h"
62HPTZIPI = -I../../hptzip
63
64HPTZIPD = -DUSE_HPTZIP
65
66ZLIBH	= ../../hptzip/zlib-win32
67# or set it to directory with zlib sources
68#ZLIBH	=
69
70!if $(DEBUG) == 1
71# You can set both to the same value if no debug version exist or if
72# no zlib debug is needed.
73# ZLIBL can point to static library or import library for dll.
74# This choice does not depend on DYNLIBS value. Do keep in mind though
75# that official zlib1.dll is linked against msvcrt.dll and it is recommended
76# to link any app using it against same dll, which is not possible
77# 'out of the box' for MSVC2003 and newer. Therefore linking zlib statically
78# seems to be preferable, especially if you build hptzip itself as dll.
79ZLIBL   = ../../hptzip/zlib-win32/zlib.lib
80!else
81ZLIBL   = ../../hptzip/zlib-win32/zlib.lib
82!endif
83
84!endif
85
86
87## programs ##
88
89# C-Compiler
90CC      = cl
91# archiver (for object-files)
92AR      = lib
93# linker
94LINK    = link
95#
96RANLIB  =
97# remove file
98RM      = del
99#copy a file
100CP      = copy
101# rename a file
102MV       = move
103# create directory
104MKDIR    = mkdir
105
106## directories ##
107!if $(DEBUG)==1
108TOPDIR=../../Debug/
109!else
110TOPDIR=../../Release/
111!endif
112
113!ifndef JUSTDEFINES
114
115!if [if not exist $(TOPDIR:/=\) $(MKDIR) $(TOPDIR:/=\)] == 0
116OBJOUT2=$(TOPDIR)obj/
117BINOUT=$(TOPDIR)bin/
118LIBOUT=$(TOPDIR)lib/
119
120!if [if not exist $(OBJOUT2:/=\) $(MKDIR) $(OBJOUT2:/=\)] != 0
121OBJOUT2=
122OBJOUT=
123!endif
124!if [if not exist $(BINOUT:/=\) $(MKDIR) $(BINOUT:/=\)] != 0
125BINOUT=$(TOPDIR)
126!endif
127!if [if not exist $(LIBOUT:/=\) $(MKDIR) $(LIBOUT:/=\)] != 0
128LIBOUT=$(TOPDIR)
129!endif
130
131!else
132OBJOUT=
133BINOUT=
134LIBOUT=
135!endif
136
137!if "$(OBJOUT2)" != "" && "$(LIBNAME)" != ""
138
139OBJOUT1=$(OBJOUT2)$(LIBNAME)/
140
141!if [if not exist $(OBJOUT1:/=\) $(MKDIR) $(OBJOUT1:/=\)] == 0
142OBJOUT=$(OBJOUT1)
143!else
144OBJOUT=$(OBJOUT2)
145!endif
146
147!endif
148
149!endif
150
151## macroses for makefile.inc ##
152O=$(OBJOUT)
153B=$(BINOUT)
154L=$(LIBOUT)
155H=$(H_DIR)
156
157## file suffixes ##
158_C      = .c
159_OBJ    = .obj
160_LIB    = .lib
161_EXE    = .exe
162_DLL    = .dll
163_EXP    = .exp
164_ILK    = .ilk
165_PDB    = .pdb
166
167## Library filename elements ##
168
169# Prefix to construct static library name
170LIBPREFIX=
171# Prefix to construct dll name
172DLLPREFIX=
173# Suffix to construct library name
174LIBSUFFIX=mvc
175# Suffix to construct dll name
176DLLSUFFIX=mvc
177
178!if $(DEBUG)==1
179LIBSUFFIX=$(LIBSUFFIX)d
180DLLSUFFIX=$(DLLSUFFIX)d
181!endif
182
183IMPLIBPREFIX=imp_$(DLLPREFIX)
184
185## Some common constructed filenames ##
186PROGRAMSILK=$(PROGRAMS:.exe=.ilk)
187PROGRAMSPDB=$(PROGRAMS:.exe=.pdb)
188
189IMPLIBNAME=$(LIBOUT)$(IMPLIBPREFIX)$(LIBNAME)$(DLLSUFFIX)
190DLLNAME=$(BINOUT)$(DLLPREFIX)$(LIBNAME)$(DLLSUFFIX)
191DLLIMPORTLIB=$(IMPLIBNAME)$(_LIB)
192
193#############################################################################
194# program options
195#############################################################################
196
197# type of operating system (UNIX,MSDOS,OS2,WINNT)
198# for BeOS, use UNIX!
199OSTYPE=WINNT
200
201# short name of operating system (used for PID lines etc.)
202UNAME=WIN32
203#UNAME=LNX
204#UNAME=BSD
205#UNAME=OS2
206#UNAME=BEOS
207
208# C-compiler: specify name of executable
209EXENAMEOPT= -Fe
210# C-compiler: specify name of object file
211OBJNAMEOPT= -Fo
212# LIB: specify output file name
213LIBNAMEOPT= /out:
214# LINK: specify output file name
215LINKNAMEOPT= /OUT:
216LINKPDBOPT= /PDB:
217
218# C-compiler: options for compile only (link is off)
219OBJOPT  = -c
220
221# C-compiler: generate warnings
222WARNFLAGS=-Wall
223
224# C-compiler: defines
225CDEFS =-D__NT__ -D_CONSOLE $(HPTZIPD) $(PERLD) $(NTDEF)
226
227!if $(DYNLIBS)==1
228CDEFS = $(CDEFS) -D_MAKE_DLL
229!endif
230
231!if $(DEBUG)==1
232DEBCDEFS =-D_DEBUG -DDEBUG -D_CRTDBG_MAP_ALLOC -D_CRT_SECURE_NO_DEPRECATE -D_CRT_SECURE_NO_WARNINGS
233!else
234DEBCDEFS =-DNDEBUG -D_CRT_SECURE_NO_DEPRECATE -D_CRT_SECURE_NO_WARNINGS
235!endif
236
237CFLAGS =-nologo
238
239# C-compiler: debug
240!if $(DEBUG)==1
241
242# -Wall produces screenfulls of useless warnings about win header files unless the following warnings are omitted:
243# c4255 == 'function' : no function prototype given: converting '()' to '(void)'
244# c4668 == 'symbol' is not defined as a preprocessor macro, replacing with '0' for 'directives'
245# c4820 == padding added into a struct
246# other superfluous warnings:
247# c4100 == unreferenced formal parameter
248# c4005 == macro redefinition (crtdbg.h <=> msvc.h)
249# c4826 == Conversion from 'const void *' to 'void *' is sign-extended. I have no clue what it means, but basetsd.h triggered it.
250DEBCFLAGS=/nologo /Zi /GS /Wall /wd4668 /wd4255 /wd4820 /wd4100 /wd4005 /wd4826
251
252!else
253
254DEBCFLAGS=/nologo /W2
255
256!endif
257
258# It is not recommended to build dlls with static linkage against crt
259# as it may cause problems with resource management.
260# Check if it will actually work if you like.
261!if $(STATICCRT)==1 && $(DYNLIBS)==0
262# use /ML for mvc before 2005
263!if $(DEBUG)==1
264CFLAGS =$(CFLAGS) /MTd
265!else
266CFLAGS =$(CFLAGS) /MT
267!endif
268
269!else
270
271!if $(DEBUG)==1
272CFLAGS =$(CFLAGS) /MDd
273!else
274CFLAGS =$(CFLAGS) /MD
275!endif
276
277!endif
278
279# C-compiler: optimization
280!if $(OPTIMIZATION)==1
281OPTCFLAGS=/O2 /Oi-
282!else
283OPTCFLAGS=/Od
284!endif
285
286CFLAGS =$(CFLAGS) $(DEBCFLAGS) $(OPTFLAGS) $(CDEFS) $(DEBCDEFS)
287
288
289LFLAGS=/NOLOGO /LIBPATH:$(LIBOUT)
290
291# object linker: optimization
292!if $(OPTIMIZATION)==1
293OPTLFLAGS=/OPT:REF
294!else
295OPTLFLAGS=/OPT:NOREF
296!endif
297
298# object linker: debug
299!if $(DEBUG)==1
300DEBLFLAGS=/DEBUG
301!else
302DEBLFLAGS=
303!endif
304
305COMMONLIBS=
306
307# Common linker options
308LFLAGS=$(LFLAGS) $(OPTLFLAGS) $(DEBLFLAGS) $(COMMONLIBS)
309
310# Linker options passed via compiler command-line
311CLFLAGS =/link $(LFLAGS)
312
313# Linker options for building dll
314LDLLFLAGS=$(LFLAGS) /DLL
315
316# options for removing files (e.g. for clean, distclean, uninstall)
317RMOPT =
318
319# archiver options
320ARFLAGS = /nologo
321
322# options for creating directories
323MKDIROPT=-p
324
325