1# This file is part of the FreeType project.
2#
3# It builds the library for Microsoft Visual C++ 1.x for 16-bit Windows,
4# large model.  It also works for Microsoft C/C++ v.7.0 16-bit compiler,
5# but not for previous versions (see Makefile.MS instead).
6#
7# You will need NMAKE.
8#
9# Use this file while in the lib directory with the following statement:
10#
11#   nmake /f arch\win16\Makefile.VC
12#
13#
14# A DLL version of the library can be built with
15#
16#   nmake DLL=1 /f arch\win16\Makefile.VC dll
17#
18# Debug versions can be obtained with
19#
20#   nmake DEBUG=1 /f arch\win16\Makefile.VC
21#
22# Special versions enabled to handle big fonts (with more than 16,384
23# glyphs) can be obtained with
24#
25#   nmake BIGFONTS=1 /f arch\win16\Makefile.VC
26
27ARCH = arch\win16
28FT_MAKEFILE = $(ARCH)\Makefile.VC
29FT_DLL = ft13_16.dll
30
31CC = cl /nologo
32LIB = lib /noignorecase /nologo
33IMPLIB = implib /noignorecase /nologo
34
35# One can also consider using "set MSC_CMD_FLAGS=/Gr /Op- /Gy /YX".
36# With Microsoft C/C++ 7.0, use /G2 instead of /G3.
37!ifndef DEBUG
38CFLAGS =     /Ox /AL /Za /W2 /G3 -I$(ARCH) -I. -Iextend
39DLLFLAGS =  /AL /Ld
40!else
41CFLAGS = /Zi /Ge /AL /Za /W2 /G3 -I$(ARCH) -I. -Iextend
42DLLFLAGS =  /AL /Lw /Zi
43!endif
44
45FT_DEF = $(FT_DLL:.dll=.def)
46!ifdef DLL
47CFLAGS = $(CFLAGS) /GD /GEf
48!else
49CFLAGS = $(CFLAGS) /GA
50!endif
51
52
53!ifdef BIGFONTS
54CFLAGS = $(CFLAGS) /DTT_HUGE_PTR=__huge
55
56TTFILE = $(ARCH)\hugefile.c
57TTMEMORY = $(ARCH)\hugemem.c
58!else
59TTFILE = .\ttfile.c
60TTMEMORY = .\ttmemory.c
61!endif
62TTMUTEX = .\ttmutex.c
63
64PORT = $(TTFILE) $(TTMEMORY) $(TTMUTEX)
65
66# Do not insert spaces between the file names or at end of line, otherwise
67# the substitution for LIB command line will fail. Thank you.
68#
69SRC_X = extend\ftxgasp.c extend\ftxkern.c extend\ftxpost.c\
70extend\ftxcmap.c extend\ftxwidth.c extend\ftxerr18.c extend\ftxsbit.c\
71extend\ftxopen.c extend\ftxgsub.c extend\ftxgpos.c extend\ftxgdef.c
72OBJS_X = $(SRC_X:.c=.obj)
73
74SRC_M = ttapi.c ttcache.c ttcalc.c ttcmap.c ttdebug.c\
75ttgload.c ttinterp.c ttload.c ttobjs.c ttraster.c ttextend.c $(PORT)
76OBJS_M = $(SRC_M:.c=.obj) $(OBJS_X)
77
78SRC_S = $(ARCH)\freetype.c
79OBJ_S = $(SRC_S:.c=.obj)
80OBJS_S = $(OBJ_S) $(OBJS_X)
81
82
83# Since Microsoft's NMAKE does not handle $($(LIB_FILES)), and using
84# LIB_FILES="$(OBJS_S)" will excess the capacity of COMMAND.COM, we cheat
85# by constructing LIB's response file directly in the `all' target.
86#
87# Another solution, useful during debugging of part of the library,
88# would be to include each .obj in the library as soon as it is compiled.
89# See ..\msdos\Makefile.TC for an application.
90.c.obj:
91	@$(CC) /c /Fo$@ @<<
92	    $(CFLAGS) $*.c
93<<
94
95
96!ifndef DEBUG
97# Skipped if DEBUG build
98all: $(OBJS_S)
99	-del libttf.lib
100	$(LIB) libttf.lib @<<response
101+ $(OBJS_S: = + );
102<<KEEP
103!endif
104
105
106debug: $(OBJS_M)
107	-del libttf.lib
108	$(LIB) libttf.lib @<<response
109+ $(OBJS_M: = + );
110<<KEEP
111
112$(FT_DEF): $(ARCH)\ttf.def
113	-copy $(ARCH)\ttf.def $(FT_DEF)
114
115dll $(FT_DLL): $(OBJS_M) $(FT_DEF)
116!ifdef DLL
117	$(CC) /Fe$(FT_DLL) @<<
118	      $(DLLFLAGS) $**
119<<
120	$(IMPLIB) libttf.lib $(FT_DEF)
121!else
122# Re-invoke with flag set.  Unfortunately, this discards the other flags.
123	$(MAKE) DLL=1 /f $(ARCH)/Makefile.VC dll
124!endif
125
126install: $(FT_DLL)
127!ifdef INSTALL_DIR
128	copy $(FT_DLL) $(INSTALL_DIR)
129!else
130	copy $(FT_DLL) C:\WINDOWS
131!endif
132
133
134$(OBJ_S): $(SRC_S) $(SRC_M)
135
136# Not used here because it excesses the capacity of COMMAND.COM...
137libttf.lib: $(LIB_FILES)
138	$(LIB) $@ +-$(?: =-+);
139
140!ifdef BIGFONTS
141$(TTFILE:.c=.obj):
142	$(CC) /c /Fo$@ @<<
143	         $(CFLAGS) /Ze $*.c
144
145$(TTMEMORY:.c=.obj):
146	$(CC) /c /Fo$@ @<<
147	         $(CFLAGS) /Ze $*.c
148<<
149
150$(OBJ_S):
151	$(CC) /c /Fo$@ @<<
152	         $(CFLAGS) /Ze $*.c
153<<
154!endif
155
156
157clean:
158	-del *.obj
159	-del extend\*.obj
160	-del $(ARCH)\*.obj
161	-del libttf.bak
162	-del response
163
164distclean: clean
165	-del libttf.lib
166	-del *.dll
167	-del $(FT_DLL:.dll=.def)
168	-del C:\WINDOWS\$(FT_DLL)
169!ifdef INSTALL_DIR
170	-del $(INSTALL_DIR)\$(FT_DLL)
171!endif
172
173!include "$(ARCH)\depend.win"
174
175# end of Makefile.VC
176