1# -*- Makefile -*- for gperf
2
3# Copyright (C) 2003 Free Software Foundation, Inc.
4# Written by Bruno Haible <bruno@clisp.org>.
5#
6# This file is part of GNU GPERF.
7#
8# This program is free software: you can redistribute it and/or modify
9# it under the terms of the GNU General Public License as published by
10# the Free Software Foundation; either version 3 of the License, or
11# (at your option) any later version.
12#
13# This program is distributed in the hope that it will be useful,
14# but WITHOUT ANY WARRANTY; without even the implied warranty of
15# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16# GNU General Public License for more details.
17#
18# You should have received a copy of the GNU General Public License
19# along with this program.  If not, see <http://www.gnu.org/licenses/>.
20
21#### Start of system configuration section. ####
22
23# Flags that can be set on the nmake command line:
24#   MFLAGS={-ML|-MT|-MD} for defining the compilation model
25#     MFLAGS=-ML (the default)  Single-threaded, statically linked - libc.lib
26#     MFLAGS=-MT                Multi-threaded, statically linked  - libcmt.lib
27#     MFLAGS=-MD                Multi-threaded, dynamically linked - msvcrt.lib
28#   DEBUG=1   for compiling with debugging information
29!if !defined(DEBUG)
30DEBUG=0
31!endif
32!if !defined(MFLAGS)
33MFLAGS=
34!endif
35
36# Directories used by "make":
37srcdir = .
38
39# Directories used by "make install":
40prefix = c:\usr
41exec_prefix = $(prefix)
42datadir = $(prefix)\share
43bindir = $(exec_prefix)\bin
44mandir = $(datadir)\man
45man1dir = $(mandir)\man1
46docdir = $(datadir)\doc\gperf
47
48# Programs used by "make":
49
50CC = cl
51CXX = cl -TP
52
53# Set to -W3 if you want to see maximum amount of warnings, including stupid
54# ones. Set to -W1 to avoid warnings about signed/unsigned combinations.
55WARN_CFLAGS = -W1
56
57!if $(DEBUG)
58OPTIMFLAGS = -Od -Z7
59DEBUGFLAGS = -Z7
60!else
61# Some people prefer -O2 -G6 instead of -O1, but -O2 is not reliable in MSVC5.
62OPTIMFLAGS = -D_NDEBUG -O1
63DEBUGFLAGS =
64!endif
65
66CFLAGS = $(MFLAGS) $(WARN_CFLAGS) $(OPTIMFLAGS)
67CXXFLAGS = $(MFLAGS) $(WARN_CFLAGS) $(OPTIMFLAGS)
68
69INCLUDES = -Ilib -Isrc
70
71LN = copy
72RM = -del
73
74# Programs used by "make install":
75INSTALL = copy
76INSTALL_PROGRAM = copy
77INSTALL_DATA = copy
78
79#### End of system configuration section. ####
80
81SHELL = /bin/sh
82
83LIB_OBJECTS = lib\getopt.obj lib\getopt1.obj lib\getline.obj lib\hash.obj
84SRC_OBJECTS = src\version.obj src\positions.obj src\options.obj src\keyword.obj src\keyword-list.obj src\input.obj src\bool-array.obj src\hash-table.obj src\search.obj src\output.obj src\main.obj
85OBJECTS = $(LIB_OBJECTS) $(SRC_OBJECTS)
86
87all : gperf.exe
88
89src\config.h : src\config.h.msvc
90	-$(RM) src\config.h
91	$(LN) src\config.h.msvc src\config.h
92
93lib\getopt.obj : lib\getopt.c
94	$(CC) $(INCLUDES) $(CFLAGS) -c lib\getopt.c -Folib\getopt.obj
95
96lib\getopt1.obj : lib\getopt1.c
97	$(CC) $(INCLUDES) $(CFLAGS) -c lib\getopt1.c -Folib\getopt1.obj
98
99lib\getline.obj : lib\getline.cc
100	$(CXX) $(INCLUDES) $(CXXFLAGS) -c lib\getline.cc -Folib\getline.obj
101
102lib\hash.obj : lib\hash.cc
103	$(CXX) $(INCLUDES) $(CXXFLAGS) -c lib\hash.cc -Folib\hash.obj
104
105# Dependencies.
106CONFIG_H = src\config.h
107VERSION_H = src\version.h
108POSITIONS_H = src\positions.h src\positions.icc
109OPTIONS_H = src\options.h src\options.icc $(POSITIONS_H)
110KEYWORD_H = src\keyword.h src\keyword.icc
111KEYWORD_LIST_H = src\keyword-list.h src\keyword-list.icc $(KEYWORD_H)
112INPUT_H = src\input.h $(KEYWORD_LIST_H)
113BOOL_ARRAY_H = src\bool-array.h src\bool-array.icc $(OPTIONS_H)
114HASH_TABLE_H = src\hash-table.h $(KEYWORD_H)
115SEARCH_H = src\search.h $(KEYWORD_LIST_H) $(POSITIONS_H) $(BOOL_ARRAY_H)
116OUTPUT_H = src\output.h $(KEYWORD_LIST_H) $(POSITIONS_H)
117
118src\version.obj : src\version.cc $(VERSION_H)
119	$(CXX) $(INCLUDES) $(CXXFLAGS) -c src\version.cc -Fosrc\version.obj
120
121src\positions.obj : src\positions.cc $(POSITIONS_H)
122	$(CXX) $(INCLUDES) $(CXXFLAGS) -c src\positions.cc -Fosrc\positions.obj
123
124src\options.obj : src\options.cc $(OPTIONS_H) $(VERSION_H)
125	$(CXX) $(INCLUDES) $(CXXFLAGS) -c src\options.cc -Fosrc\options.obj
126
127src\keyword.obj : src\keyword.cc $(KEYWORD_H) $(POSITIONS_H)
128	$(CXX) $(INCLUDES) $(CXXFLAGS) -c src\keyword.cc -Fosrc\keyword.obj
129
130src\keyword-list.obj : src\keyword-list.cc $(KEYWORD_LIST_H)
131	$(CXX) $(INCLUDES) $(CXXFLAGS) -c src\keyword-list.cc -Fosrc\keyword-list.obj
132
133src\input.obj : src\input.cc $(INPUT_H) $(OPTIONS_H)
134	$(CXX) $(INCLUDES) $(CXXFLAGS) -c src\input.cc -Fosrc\input.obj
135
136src\bool-array.obj : src\bool-array.cc $(BOOL_ARRAY_H) $(OPTIONS_H)
137	$(CXX) $(INCLUDES) $(CXXFLAGS) -c src\bool-array.cc -Fosrc\bool-array.obj
138
139src\hash-table.obj : src\hash-table.cc $(HASH_TABLE_H) $(OPTIONS_H)
140	$(CXX) $(INCLUDES) $(CXXFLAGS) -c src\hash-table.cc -Fosrc\hash-table.obj
141
142src\search.obj : src\search.cc $(SEARCH_H) $(OPTIONS_H) $(HASH_TABLE_H) $(CONFIG_H)
143	$(CXX) $(INCLUDES) $(CXXFLAGS) -c src\search.cc -Fosrc\search.obj
144
145src\output.obj : src\output.cc $(OUTPUT_H) $(OPTIONS_H) $(VERSION_H)
146	$(CXX) $(INCLUDES) $(CXXFLAGS) -c src\output.cc -Fosrc\output.obj
147
148src\main.obj : src\main.cc $(OPTIONS_H) $(INPUT_H) $(SEARCH_H) $(OUTPUT_H)
149	$(CXX) $(INCLUDES) $(CXXFLAGS) -c src\main.cc -Fosrc\main.obj
150
151gperf.exe : $(OBJECTS)
152	$(CC) $(MFLAGS) $(DEBUGFLAGS) $(OBJECTS) -Fegperf.exe
153
154install : all force
155	-mkdir $(prefix)
156	-mkdir $(exec_prefix)
157	-mkdir $(bindir)
158	$(INSTALL_PROGRAM) gperf.exe $(bindir)\gperf.exe
159	-mkdir $(datadir)
160	-mkdir $(mandir)
161	-mkdir $(man1dir)
162	$(INSTALL_DATA) doc\gperf.1 $(man1dir)\gperf.1
163	-mkdir $(datadir)\doc
164	-mkdir $(docdir)
165	$(INSTALL_DATA) doc\gperf.html $(docdir)\gperf.html
166
167installdirs : force
168	-mkdir $(prefix)
169	-mkdir $(exec_prefix)
170	-mkdir $(bindir)
171	-mkdir $(datadir)
172	-mkdir $(mandir)
173	-mkdir $(man1dir)
174	-mkdir $(datadir)\doc
175	-mkdir $(docdir)
176
177uninstall : force
178	$(RM) $(bindir)\gperf.exe
179	$(RM) $(man1dir)\gperf.1
180	$(RM) $(docdir)\gperf.html
181
182check : all
183
184mostlyclean : clean
185
186clean : force
187	$(RM) lib\*.obj
188	$(RM) src\*.obj
189	$(RM) gperf.exe
190	$(RM) core
191
192distclean : clean
193	$(RM) src\config.h
194
195maintainer-clean : distclean
196
197force :
198
199