1!INCLUDE ..\win32\common.mak
2
3# WS2tcpip.h included in Visual Studio 7 provides getaddrinfo, ...
4# emulation on Windows, so there is no need to build getaddrinfo.c
5
6!IF "$(VCVER)" == "6"
7compat_sources = getaddrinfo.c getnameinfo.c
8compat_objs = getaddrinfo.obj getnameinfo.obj
9!ENDIF
10
11
12libsasl_sources = auxprop.c canonusr.c checkpw.c client.c common.c config.c external.c md5.c saslutil.c server.c seterror.c windlopen.c getsubopt.c plugin_common.c plugin_common.h $(compat_sources)
13libsasl_objs = auxprop.obj canonusr.obj checkpw.obj client.obj common.obj config.obj external.obj md5.obj saslutil.obj server.obj seterror.obj windlopen.obj getsubopt.obj plugin_common.obj $(compat_objs)
14libsasl_res = libsasl.res
15libsasl_out = libsasl.dll libsasl.exp libsasl.lib $(libsasl_res)
16
17CPPFLAGS = /wd4996 /Wp64 /D NEED_GETOPT /I "..\win32\include" /I "." /I "..\include" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LIBSASL_EXPORTS"
18
19!IF $(TARGET_WIN_SYSTEM) >= 51
20CPPFLAGS = /D TARGET_WIN_SYSTEM=$(TARGET_WIN_SYSTEM) $(CPPFLAGS)
21!ENDIF 
22
23all_objs = $(libsasl_objs)
24all_out = $(libsasl_out)
25
26libdir = $(prefix)\lib
27bindir = $(prefix)\bin
28exclude_list = binexclude.lst
29
30all: all-recursive
31
32#
33# /I flag to xcopy tells to treat the last parameter as directory and create all missing levels
34#
35# In order to force xcopy not to confirm if the second parameter is file or directory,
36# the first parameter has to contain a wildcard character. For example, we use libsasl.l*,
37# instead of libsasl.lib. Ugly, but works!
38#
39install: libsasl.dll
40	@echo libsasl.exp > $(exclude_list)
41	@echo libsasl.res >> $(exclude_list)
42	@echo libsasl.dll.manifest >> $(exclude_list)
43# .lib is excluded only because it is copied separately below
44	@echo libsasl.lib >> $(exclude_list)
45	@xcopy libsasl.* $(bindir) /I /F /Y /EXCLUDE:$(exclude_list)
46	@xcopy libsasl.l* $(libdir) /I /F /Y
47
48all-recursive: libsasl.dll
49
50libsasl.dll: $(libsasl_objs) $(libsasl_res)
51	$(LINK32DLL) @<< $(LINK32DLL_FLAGS) /out:"libsasl.dll" /implib:"libsasl.lib" /pdb:"libsasl.pdb" $(libsasl_objs) $(libsasl_res)
52<<
53	IF EXIST $@.manifest mt -manifest $@.manifest -outputresource:$@;2
54
55plugin_common.c: ..\plugins\plugin_common.c plugin_common.h
56	xcopy /D /Y ..\plugins\plugin_common.c .
57
58plugin_common.h: ..\plugins\plugin_common.h
59	xcopy /D /Y ..\plugins\plugin_common.h .
60
61auxprop.obj checkpw.obj client.obj common.obj external.obj plugin_common.obj server.obj seterror.obj: ..\include\saslplug.h
62
63auxprop.obj canonusr.obj checkpw.obj client.obj common.obj config.obj external.obj getsubopt.obj md5.obj plugin_common.obj server.obj seterror.obj windlopen.obj: ..\include\sasl.h ..\include\prop.h
64
65auxprop.obj canonusr.obj checkpw.obj client.obj common.obj config.obj dlopen.obj external.obj saslutil.obj server.obj seterror.obj windlopen.obj: saslint.h
66
67CLEAN :
68	-@erase $(all_objs)
69	-@erase "*.idb"
70	-@erase "*.pdb"
71	-@erase "*.manifest"
72	-@erase $(all_out)
73	-@erase plugin_common.h
74	-@erase plugin_common.c
75	-@erase $(exclude_list)
76
77$(libsasl_res): NTMakefile
78	rc /fo"$(libsasl_res)" <<
79#include "windows.h"
80
81VS_VERSION_INFO VERSIONINFO
82 FILEVERSION $(SASL_VERSION_MAJOR),$(SASL_VERSION_MINOR),$(SASL_VERSION_STEP),0
83 PRODUCTVERSION $(SASL_VERSION_MAJOR),$(SASL_VERSION_MINOR),$(SASL_VERSION_STEP),0
84 FILEFLAGSMASK 0x3fL
85#ifdef _DEBUG
86 FILEFLAGS 0x1L
87#else
88 FILEFLAGS 0x0L
89#endif
90 FILEOS 0x40004L
91 FILETYPE 0x1L
92 FILESUBTYPE 0x0L
93BEGIN
94    BLOCK "StringFileInfo"
95    BEGIN
96        BLOCK "040904b0"
97        BEGIN
98            VALUE "CompanyName", "Carnegie Mellon University\0"
99            VALUE "FileDescription", "CMU SASL API v2\0"
100            VALUE "FileVersion", "$(SASL_VERSION_MAJOR).$(SASL_VERSION_MINOR).$(SASL_VERSION_STEP).0\0"
101            VALUE "InternalName", "libsasl\0"
102            VALUE "LegalCopyright", "Copyright (c) Carnegie Mellon University 2002-2012\0"
103            VALUE "OriginalFilename", "libsasl.dll\0"
104            VALUE "ProductName", "Carnegie Mellon University SASL\0"
105            VALUE "ProductVersion", "$(SASL_VERSION_MAJOR).$(SASL_VERSION_MINOR).$(SASL_VERSION_STEP)-0"
106        END
107    END
108    BLOCK "VarFileInfo"
109    BEGIN
110        VALUE "Translation", 0x409, 1200
111    END
112END
113<<
114
115.c.obj::
116   $(CPP) @<<
117   $(CPP_PROJ) $< 
118<<
119
120.cpp.obj::
121   $(CPP) @<<
122   $(CPP_PROJ) $< 
123<<
124
125.cxx.obj::
126   $(CPP) @<<
127   $(CPP_PROJ) $< 
128<<
129