1# -*- Makefile -*- for libcharset/lib
2
3#### Start of system configuration section. ####
4
5# Flags that can be set on the nmake command line:
6#   DLL=1     for compiling a .dll with a stub .lib (default is a static .lib)
7#             Note that this works only with MFLAGS=-MD.
8#   MFLAGS={-ML|-MT|-MD} for defining the compilation model
9#     MFLAGS=-ML (the default)  Single-threaded, statically linked - libc.lib
10#     MFLAGS=-MT                Multi-threaded, statically linked  - libcmt.lib
11#     MFLAGS=-MD                Multi-threaded, dynamically linked - msvcrt.lib
12#   DEBUG=1   for compiling with debugging information
13#   PREFIX=Some\Directory   Base directory for installation
14# Note that nmake command line flags are automatically passed to subdirectory
15# Makefiles. Therefore we don't need to pass them explicitly to subdirectory
16# Makefiles, but the subdirectory Makefiles need to have the same defaults.
17!if !defined(DLL)
18DLL=0
19!endif
20!if !defined(DEBUG)
21DEBUG=0
22!endif
23!if !defined(MFLAGS)
24!if !$(DLL)
25MFLAGS=
26!else
27MFLAGS=-MD
28!endif
29!endif
30!if !defined(PREFIX)
31PREFIX = c:\usr
32!endif
33!if !defined(IIPREFIX)
34IIPREFIX = c:\\usr
35!endif
36
37# Directories used by "make":
38srcdir = .
39
40# Directories used by "make install":
41prefix = $(PREFIX)
42exec_prefix = $(prefix)
43bindir = $(exec_prefix)\bin
44libdir = $(exec_prefix)\lib
45IIprefix = $(IIPREFIX)
46IIexec_prefix = $(IIprefix)
47IIbindir = $(IIexec_prefix)\\bin
48IIlibdir = $(IIexec_prefix)\\lib
49
50# Programs used by "make":
51
52CC = cl
53
54# Set to -W3 if you want to see maximum amount of warnings, including stupid
55# ones. Set to -W1 to avoid warnings about signed/unsigned combinations.
56WARN_CFLAGS = -W1
57
58!if !$(DLL)
59PICFLAGS =
60!else
61# "-GD" (msvc5) optimizes for DLL.
62# mscv4 doesn't know about this flag and ignores it.
63# -DBUILDING_LIBCHARSET: Change expansion of LIBCHARSET_DLL_EXPORTED macro.
64# -DBUILDING_DLL: Change expansion of RELOCATABLE_DLL_EXPORTED macro.
65PICFLAGS = -GD -DBUILDING_LIBCHARSET -DBUILDING_DLL -DPIC
66!endif
67
68!if $(DEBUG)
69OPTIMFLAGS = -Od -Z7
70DEBUGFLAGS = -Z7
71!else
72# Some people prefer -O2 -G6 instead of -O1, but -O2 is not reliable in MSVC5.
73OPTIMFLAGS = -D_NDEBUG -O1
74DEBUGFLAGS =
75!endif
76
77CFLAGS = $(MFLAGS) $(WARN_CFLAGS) $(OPTIMFLAGS) -DHAVE_CONFIG_H -DENABLE_RELOCATABLE=1 -DIN_LIBRARY -DINSTALLPREFIX=\"$(IIprefix)\" -DINSTALLDIR=\"$(IIbindir)\" -DNO_XMALLOC -Dset_relocation_prefix=libcharset_set_relocation_prefix -Drelocate=libcharset_relocate
78
79INCLUDES = -I. -I.. -I..\include
80
81AR = lib
82AR_FLAGS = /out:
83
84LN = copy
85RM = -del
86
87# Programs used by "make install":
88INSTALL = copy
89INSTALL_PROGRAM = copy
90INSTALL_DATA = copy
91
92#### End of system configuration section. ####
93
94SHELL = /bin/sh
95
96OBJECTS = localcharset.obj relocatable.obj
97
98RESOURCES = charset.res
99
100all : charset.lib
101
102localcharset.obj : $(srcdir)/localcharset.c
103	$(CC) $(INCLUDES) $(CFLAGS) $(PICFLAGS) -c $(srcdir)/localcharset.c
104
105relocatable.obj : $(srcdir)/relocatable.c
106	$(CC) $(INCLUDES) $(CFLAGS) $(PICFLAGS) -c $(srcdir)/relocatable.c
107
108!if !$(DLL)
109
110charset.lib : $(OBJECTS)
111	-$(RM) charset.lib
112	$(AR) $(AR_FLAGS)charset.lib $(OBJECTS)
113
114!else
115
116# charset.dll and charset.lib are created together.
117charset.lib : $(OBJECTS) $(RESOURCES)
118	$(CC) $(MFLAGS) $(DEBUGFLAGS) -LD $(OBJECTS) $(RESOURCES) -Fecharset.dll
119
120charset.res : $(srcdir)/../windows/charset.rc
121	rc -Fo charset.res $(srcdir)/../windows/charset.rc
122
123!endif
124
125install : all force
126	-mkdir $(prefix)
127	-mkdir $(exec_prefix)
128!if $(DLL)
129	-mkdir $(bindir)
130	$(INSTALL_DATA) charset.dll $(bindir)\charset.dll
131!endif
132	-mkdir $(libdir)
133	$(INSTALL_DATA) charset.lib $(libdir)\charset.lib
134
135installdirs : force
136	-mkdir $(prefix)
137	-mkdir $(exec_prefix)
138!if $(DLL)
139	-mkdir $(bindir)
140!endif
141	-mkdir $(libdir)
142
143uninstall : force
144!if $(DLL)
145	$(RM) $(bindir)\charset.dll
146!endif
147	$(RM) $(libdir)\charset.lib
148
149check : all
150
151mostlyclean : clean
152
153clean : force
154	$(RM) *.obj
155	$(RM) *.lib
156	$(RM) *.exp
157	$(RM) *.dll
158	$(RM) charset.res
159	$(RM) charset.alias
160
161distclean : clean
162
163maintainer-clean : distclean
164
165force :
166
167