37c2648717f98bb720c1a2b5a9ef923a58a027cc
[platform/upstream/curl.git] / lib / Makefile.b32
1 ############################################################
2 #
3 #  Makefile.b32 - Borland's C++ Compiler 5.X
4 #
5 #  'lib' directory
6 #
7 #  'BCCDIR' has to be set up to point to the base directory
8 #  of the compiler, i.e. SET BCCDIR = c:\Borland\BCC55
9 #
10 #  Initially written by Jaepil Kim, pit@paradise.net.nz
11 ############################################################
12
13 !if "$(__MAKE__)" == ""
14 !error __MAKE__ not defined. Use Borlands's MAKE to process this makefile.
15 !endif
16
17 # Borland's $(MAKEDIR) expands to the path where make.exe is located,
18 # use this feature to define BCCDIR when user has not defined BCCDIR.
19 !ifndef BCCDIR
20 BCCDIR = $(MAKEDIR)\..
21 !endif
22
23 # Edit the path below to point to the base of your Zlib sources.
24 !ifndef ZLIB_PATH
25 ZLIB_PATH = ..\..\zlib-1.2.8
26 !endif
27
28 # Edit the path below to point to the base of your OpenSSL package.
29 !ifndef OPENSSL_PATH
30 OPENSSL_PATH = ..\..\openssl-1.0.2a
31 !endif
32
33 # Set libcurl static lib, dll and import lib
34 LIBCURL_LIB    = libcurl.lib
35 LIBCURL_DLL    = libcurl.dll
36 LIBCURL_IMPLIB = libcurl_imp.lib
37
38 # Setup environment
39 PP_CMD   = cpp32 -q -P-
40 CC_CMD   = bcc32 -q -c
41 LD       = bcc32
42 RM       = del 2>NUL
43 MKDIR    = md
44 RMDIR    = rd /q
45 LIB      = tlib
46 IMPLIB   = implib
47
48 CC_FLAGS = -5 -O2 -tWM -w -w-aus -w-ccc -w-dup -w-prc -w-pro -w-rch -w-sig -w-spa -w-inl -w-pia -w-pin -Dinline=__inline
49 LIBFLAGS = /C /P32
50 LDFLAGS  = -q -lq -laa -tWD
51
52 SRCDIR   = .;.\vtls
53 OBJDIR   = .\BCC_objs
54 INCDIRS  = -I.;.\lib;..\include
55 LINKLIB  = $(BCCDIR)\lib\cw32mt.lib $(BCCDIR)\lib\ws2_32.lib
56 DEFINES  = -DNDEBUG -DWIN32 -DBUILDING_LIBCURL
57
58 # By default SSPI support is enabled for BCC
59 !ifndef DISABLE_SSPI
60 DEFINES  = $(DEFINES) -DUSE_WINDOWS_SSPI
61 !endif
62
63 # By default LDAP support is disabled for BCC
64 !ifndef WITH_LDAP
65 DEFINES  = $(DEFINES) -DCURL_DISABLE_LDAP
66 !endif
67
68 # ZLIB support is enabled setting WITH_ZLIB=1
69 !ifdef WITH_ZLIB
70 DEFINES  = $(DEFINES) -DHAVE_LIBZ -DHAVE_ZLIB_H
71 INCDIRS  = $(INCDIRS);$(ZLIB_PATH)
72 LINKLIB  = $(LINKLIB) $(ZLIB_PATH)\zlib.lib
73 !endif
74
75 # SSL support is enabled setting WITH_SSL=1
76 !ifdef WITH_SSL
77 DEFINES  = $(DEFINES) -DUSE_OPENSSL
78 INCDIRS  = $(INCDIRS);$(OPENSSL_PATH)\inc32;$(OPENSSL_PATH)\inc32\openssl
79 LINKLIB  = $(LINKLIB) $(OPENSSL_PATH)\out32\ssleay32.lib $(OPENSSL_PATH)\out32\libeay32.lib
80 !endif
81
82 .autodepend
83
84 .path.c   = $(SRCDIR)
85 .path.obj = $(OBJDIR)
86 .path.int = $(OBJDIR)
87
88 # Makefile.inc provides the CSOURCES and HHEADERS defines
89 !include Makefile.inc
90
91 # Borland's command line librarian program TLIB version 4.5 is not capable
92 # of building a library when any of its objects contains an hypen in its
93 # name, due to a command line parsing bug. In order to workaround this, we
94 # build source files with hyphens in their name as objects with underscores
95 # using explicit compilation build rules instead of implicit ones.
96
97 NOHYPHEN1 = $(CSOURCES:-=_)
98 NOHYPHEN2 = $(NOHYPHEN1:vtls/=)
99
100 OBJECTS = $(NOHYPHEN2:.c=.obj)
101 PREPROCESSED = $(NOHYPHEN2:.c=.int)
102
103 # Borland's command line compiler (BCC32) version 5.5.1 integrated
104 # preprocessor has a bug which results in silently generating wrong
105 # definitions for libcurl macros such as CURL_OFF_T_C, on the other
106 # hand Borland's command line preprocessor (CPP32) version 5.5.1 does
107 # not have the bug and achieves proper results. In order to avoid the
108 # silent bug we first preprocess source files and later compile the
109 # preprocessed result.
110
111 .c.obj:
112         @-$(RM) $(@R).int
113         $(PP_CMD) $(CC_FLAGS) $(INCDIRS) $(DEFINES) -o$(@R).int $(<)
114         $(CC_CMD) $(CC_FLAGS) -o$(@) $(@R).int
115
116 all:    $(OBJDIR) $(LIBCURL_LIB) $(LIBCURL_DLL)
117
118 asyn_ares.obj: asyn-ares.c
119         @-$(RM) $(@R).int
120         $(PP_CMD) $(CC_FLAGS) $(INCDIRS) $(DEFINES) -o$(@R).int $(?)
121         $(CC_CMD) $(CC_FLAGS) -o$(@) $(@R).int
122
123 asyn_thread.obj: asyn-thread.c
124         @-$(RM) $(@R).int
125         $(PP_CMD) $(CC_FLAGS) $(INCDIRS) $(DEFINES) -o$(@R).int $(?)
126         $(CC_CMD) $(CC_FLAGS) -o$(@) $(@R).int
127
128 non_ascii.obj: non-ascii.c
129         @-$(RM) $(@R).int
130         $(PP_CMD) $(CC_FLAGS) $(INCDIRS) $(DEFINES) -o$(@R).int $(?)
131         $(CC_CMD) $(CC_FLAGS) -o$(@) $(@R).int
132
133 clean:
134         cd $(OBJDIR)
135         @-$(RM) $(OBJECTS)
136         @-$(RM) $(PREPROCESSED)
137         cd ..
138         @-$(RMDIR) $(OBJDIR)
139         @-$(RM) $(LIBCURL_LIB)
140         @-$(RM) $(LIBCURL_IMPLIB)
141         @-$(RM) libcurl.tds
142
143 $(OBJDIR):
144         @-$(RMDIR) $(OBJDIR)
145         @-$(MKDIR) $(OBJDIR)
146
147 $(LIBCURL_LIB): $(OBJECTS)
148         @-$(RM) $(LIBCURL_LIB)
149         $(LIB) $(LIBFLAGS) $@ @&&!
150 +$(**: = &^
151 +)
152 !
153
154 $(LIBCURL_DLL) $(LIBCURL_IMPLIB): $(OBJECTS) $(LINKLIB)
155         @-$(RM) $(LIBCURL_DLL)
156         @-$(RM) $(LIBCURL_IMPLIB)
157         $(LD) $(LDFLAGS) -e$(LIBCURL_DLL) @&&!
158 $(**: = ^
159 )
160 !
161         $(IMPLIB) $(LIBCURL_IMPLIB) $(LIBCURL_DLL)
162
163
164 # End of Makefile.b32