1# Makefile for OS/2.  Generated from Makefile.in when CVS is
2# configured for a dist-build.  Configure never gets run on OS/2, so
3# we must include the generated Makefile in the distribution.  See the
4# `dist-dir' rule.
5
6project: cvs.exe
7# .SUFFIXES .c .o .exe
8
9# Directory in which to install executables.
10install_dir = s:/gnu/util
11
12# srcdir is usually "."
13srcdir     = .
14
15# top_srcdir is usually ".."
16top_srcdir = ..
17
18
19subdir     = emx
20
21lib_dir     = ${top_srcdir}/lib
22cvs_srcdir = ${top_srcdir}/src
23diff_srcdir = ${top_srcdir}/diff
24zlib_dir = ${top_srcdir}/zlib
25
26# Do we need these?
27# prefix = /usr/local
28# exec_prefix = ${prefix}
29
30# Used to say -lufc, but that would only be needed for crypt().
31LIB = -lsocket
32
33CINC =
34# This says we are building an object file, not a full executable.
35OBJ_CFLAGS = -c
36CFLAGS = -pedantic -Wall -fno-builtin ${CINC} \
37  -I${srcdir} -I${lib_dir} -I${cvs_srcdir} -I${zlib_dir} \
38  -DUNIX -DHAVE_CONFIG_H
39
40
41# headers specific to OS/2
42
43# We list OS2_HEADERS so we know what to include when we make dist-dir
44# here.
45OS2_HEADERS = \
46       config.h \
47       rcmd.h
48
49# headers we use from the common src dir, ../src
50COMMON_HEADERS = \
51       ${cvs_srcdir}/client.h \
52       ${cvs_srcdir}/cvs.h \
53       ${cvs_srcdir}/rcs.h \
54       ${cvs_srcdir}/hash.h \
55       ${cvs_srcdir}/myndbm.h \
56       ${cvs_srcdir}/patchlevel.h \
57       ${cvs_srcdir}/update.h \
58       ${cvs_srcdir}/server.h \
59       ${cvs_srcdir}/error.h
60
61# headers in ../diff
62DIFF_HEADERS = \
63       ${diff_srcdir}/cmpbuf.h \
64	   ${diff_srcdir}/diff.h \
65	   ${diff_srcdir}/system.h
66
67# sources specific to OS/2
68OS2_SOURCES = \
69       filesubr.c \
70       startserver.c \
71       savecwd.c \
72       system.c
73
74# sources we use from the common src dir, ../src
75# FIXME: Is this used anywhere?  I don't think it is.
76COMMON_SOURCES = \
77       ${cvs_srcdir}/add.c \
78       ${cvs_srcdir}/admin.c \
79       ${cvs_srcdir}/buffer.c \
80       ${cvs_srcdir}/checkin.c \
81       ${cvs_srcdir}/checkout.c \
82       ${cvs_srcdir}/classify.c \
83       ${cvs_srcdir}/client.c \
84       ${cvs_srcdir}/commit.c \
85       ${cvs_srcdir}/create_adm.c \
86       ${cvs_srcdir}/cvsrc.c \
87       ${cvs_srcdir}/diff.c \
88       ${cvs_srcdir}/edit.c \
89       ${cvs_srcdir}/entries.c \
90       ${cvs_srcdir}/error.c \
91       ${cvs_srcdir}/expand_path.c \
92       ${cvs_srcdir}/fileattr.c \
93       ${cvs_srcdir}/find_names.c \
94       ${cvs_srcdir}/hash.c \
95       ${cvs_srcdir}/history.c \
96       ${cvs_srcdir}/ignore.c \
97       ${cvs_srcdir}/import.c \
98       ${cvs_srcdir}/lock.c \
99       ${cvs_srcdir}/log.c \
100       ${cvs_srcdir}/login.c \
101       ${cvs_srcdir}/logmsg.c \
102       ${cvs_srcdir}/main.c \
103       ${cvs_srcdir}/mkmodules.c \
104       ${cvs_srcdir}/modules.c \
105       ${cvs_srcdir}/myndbm.c \
106       ${cvs_srcdir}/no_diff.c \
107       ${cvs_srcdir}/parseinfo.c \
108       ${cvs_srcdir}/patch.c \
109       ${cvs_srcdir}/rcs.c \
110       ${cvs_srcdir}/rcscmds.c \
111       ${cvs_srcdir}/recurse.c \
112       ${cvs_srcdir}/release.c \
113       ${cvs_srcdir}/remove.c \
114       ${cvs_srcdir}/repos.c \
115       ${cvs_srcdir}/root.c \
116       ${cvs_srcdir}/scramble.c \
117       ${cvs_srcdir}/server.c \
118       ${cvs_srcdir}/status.c \
119       ${cvs_srcdir}/subr.c \
120       ${cvs_srcdir}/run.c \
121       ${cvs_srcdir}/tag.c \
122       ${cvs_srcdir}/update.c \
123       ${cvs_srcdir}/watch.c \
124       ${cvs_srcdir}/wrapper.c \
125       ${cvs_srcdir}/vers_ts.c \
126       ${cvs_srcdir}/version.c \
127       ${cvs_srcdir}/zlib.c
128# end of $COMMON_SOURCES
129
130# sources in ../diff
131DIFF_SOURCES = \
132	   ${diff_srcdir}/analyze.c \
133	   ${diff_srcdir}/cmpbuf.c \
134	   ${diff_srcdir}/context.c \
135	   ${diff_srcdir}/diff.c \
136	   ${diff_srcdir}/diff3.c \
137	   ${diff_srcdir}/dir.c \
138	   ${diff_srcdir}/ed.c \
139	   ${diff_srcdir}/ifdef.c \
140	   ${diff_srcdir}/io.c \
141	   ${diff_srcdir}/normal.c \
142	   ${diff_srcdir}/side.c \
143	   ${diff_srcdir}/util.c \
144	   ${diff_srcdir}/version.c
145
146# sources from ../lib
147# FIXME: Is this used anywhere?  I don't think it is.
148LIB_SOURCES = \
149       ${lib_dir}/argmatch.c \
150       ${lib_dir}/getline.c \
151       ${lib_dir}/getopt.c \
152       ${lib_dir}/getopt1.c \
153       ${lib_dir}/md5.c \
154       ${lib_dir}/regex.c \
155       ${lib_dir}/sighandle.c \
156       ${lib_dir}/valloc.c \
157       ${lib_dir}/yesno.c \
158       ${lib_dir}/getdate.c
159
160# object files from OS/2 sources
161# was       ${srcdir}/rcmd.o
162OS2_OBJECTS = \
163       ${srcdir}/filesubr.o \
164       ${srcdir}/startserver.o \
165       ${top_srcdir}/windows-NT/rcmd.o \
166       ${srcdir}/savecwd.o \
167       ${srcdir}/system.o
168
169# object files from ../src
170COMMON_OBJECTS = \
171       ${cvs_srcdir}/add.o \
172       ${cvs_srcdir}/admin.o \
173       ${cvs_srcdir}/buffer.o \
174       ${cvs_srcdir}/checkin.o \
175       ${cvs_srcdir}/checkout.o \
176       ${cvs_srcdir}/classify.o \
177       ${cvs_srcdir}/client.o \
178       ${cvs_srcdir}/commit.o \
179       ${cvs_srcdir}/create_adm.o \
180       ${cvs_srcdir}/cvsrc.o \
181       ${cvs_srcdir}/diff.o \
182       ${cvs_srcdir}/edit.o \
183       ${cvs_srcdir}/entries.o \
184       ${cvs_srcdir}/expand_path.o \
185       ${cvs_srcdir}/fileattr.o \
186       ${cvs_srcdir}/find_names.o \
187       ${cvs_srcdir}/hash.o \
188       ${cvs_srcdir}/history.o \
189       ${cvs_srcdir}/ignore.o \
190       ${cvs_srcdir}/import.o \
191       ${cvs_srcdir}/lock.o \
192       ${cvs_srcdir}/log.o \
193       ${cvs_srcdir}/login.o \
194       ${cvs_srcdir}/logmsg.o \
195       ${cvs_srcdir}/main.o \
196       ${cvs_srcdir}/mkmodules.o \
197       ${cvs_srcdir}/modules.o \
198       ${cvs_srcdir}/myndbm.o \
199       ${cvs_srcdir}/no_diff.o \
200       ${cvs_srcdir}/parseinfo.o \
201       ${cvs_srcdir}/patch.o \
202       ${cvs_srcdir}/rcs.o \
203       ${cvs_srcdir}/rcscmds.o \
204       ${cvs_srcdir}/recurse.o \
205       ${cvs_srcdir}/release.o \
206       ${cvs_srcdir}/remove.o \
207       ${cvs_srcdir}/repos.o \
208       ${cvs_srcdir}/root.o \
209       ${cvs_srcdir}/scramble.o \
210       ${cvs_srcdir}/server.o \
211       ${cvs_srcdir}/status.o \
212       ${cvs_srcdir}/tag.o \
213       ${cvs_srcdir}/update.o \
214       ${cvs_srcdir}/watch.o \
215       ${cvs_srcdir}/wrapper.o \
216       ${cvs_srcdir}/vers_ts.o \
217       ${cvs_srcdir}/subr.o \
218       ${cvs_srcdir}/run.o \
219       ${cvs_srcdir}/version.o \
220       ${cvs_srcdir}/error.o \
221       ${cvs_srcdir}/zlib.o
222# end of $COMMON_OBJECTS
223
224# object files in ../diff
225DIFF_OBJECTS = \
226       ${diff_srcdir}/analyze.o \
227	   ${diff_srcdir}/cmpbuf.o \
228	   ${diff_srcdir}/context.o \
229	   ${diff_srcdir}/diff.o \
230	   ${diff_srcdir}/diff3.o \
231	   ${diff_srcdir}/dir.o \
232	   ${diff_srcdir}/ed.o \
233	   ${diff_srcdir}/ifdef.o \
234	   ${diff_srcdir}/io.o \
235	   ${diff_srcdir}/normal.o \
236	   ${diff_srcdir}/side.o \
237	   ${diff_srcdir}/util.o \
238	   ${diff_srcdir}/version.o
239
240# objects from ../lib
241LIB_OBJECTS = \
242       ${lib_dir}/argmatch.o \
243       ${lib_dir}/getline.o \
244       ${lib_dir}/getopt.o \
245       ${lib_dir}/getopt1.o \
246       ${lib_dir}/md5.o \
247       ${lib_dir}/regex.o \
248       ${lib_dir}/sighandle.o \
249       ${lib_dir}/valloc.o \
250       ${lib_dir}/yesno.o \
251       ${lib_dir}/getdate.o
252
253ZLIB_OBJECTS = ${zlib_dir}/adler32.o \
254       ${zlib_dir}/compress.o \
255       ${zlib_dir}/crc32.o \
256       ${zlib_dir}/gzio.o \
257       ${zlib_dir}/uncompr.o \
258       ${zlib_dir}/deflate.o \
259       ${zlib_dir}/trees.o \
260       ${zlib_dir}/zutil.o \
261       ${zlib_dir}/inflate.o \
262       ${zlib_dir}/infblock.o \
263       ${zlib_dir}/inftrees.o \
264       ${zlib_dir}/infcodes.o \
265       ${zlib_dir}/infutil.o \
266       ${zlib_dir}/inffast.o
267
268SOURCES = ${COMMON_SOURCES} ${LIB_SOURCES} ${OS2_SOURCES} ${DIFF_SOURCES}
269HEADERS = ${COMMON_HEADERS} ${OS2_HEADERS} ${DIFF_HEADERS}
270OBJECTS = ${COMMON_OBJECTS} ${LIB_OBJECTS} ${OS2_OBJECTS} ${DIFF_OBJECTS} \
271  ${ZLIB_OBJECTS}
272
273DISTFILES = ${OS2_HEADERS} ${OS2_SOURCES} \
274  README ChangeLog \
275  Makefile.in .cvsignore \
276  Makefile
277
278all:
279
280# Automake
281.PHONY: all install installcheck uninstall check info dvi
282all install installcheck uninstall check:
283
284.PHONY: dvi info pdf ps
285dvi info pdf ps:
286
287installdirs:
288.PHONY: installdirs
289
290.PHONY: tags TAGS
291tags TAGS:
292
293.PHONY: clean distclean realclean mostlyclean
294clean distclean realclean maintainer-clean mostlyclean:
295
296.PHONY: lint
297lint:
298
299# distdir added for compatibility with CVS automake.
300top_distdir = ..
301PACKAGE = cvs
302VERSION = 1.12.13
303distdir = $(top_distdir)/$(PACKAGE)-$(VERSION)
304distdir: $(DISTFILES)
305	@list='$(DISTFILES)'; for file in $$list; do \
306	  if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
307	  dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
308	  if test "$$dir" != "$$file" && test "$$dir" != "."; then \
309	    dir="/$$dir"; \
310	    $(mkinstalldirs) "$(distdir)$$dir"; \
311	  else \
312	    dir=''; \
313	  fi; \
314	  if test -d $$d/$$file; then \
315	    if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
316	      cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
317	    fi; \
318	    cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
319	  else \
320	    test -f $(distdir)/$$file \
321	    || cp -p $$d/$$file $(distdir)/$$file \
322	    || exit 1; \
323	  fi; \
324	done
325	list='$(SUBDIRS)'; for subdir in $$list; do \
326	  if test "$$subdir" = .; then :; else \
327	    test -d $(distdir)/$$subdir \
328	    || mkdir $(distdir)/$$subdir \
329	    || exit 1; \
330	    (cd $$subdir && \
331	      $(MAKE) $(AM_MAKEFLAGS) \
332	        top_distdir="$(top_distdir)" \
333	        distdir=../$(distdir)/$$subdir \
334	        distdir) \
335	      || exit 1; \
336	  fi; \
337	done
338.PHONY: distdir
339
340# We don't have a real distclean or anything like that, but at least
341# we can get rid of the obj files and cvs.exe.
342.PHONY: clean distclean realclean mostlyclean maintainer-clean
343clean distclean realclean maintainer-clean mostlyclean:
344	rm -f cvs.exe cvs.out
345	rm -f ${srcdir}/*.o
346	rm -f ${diff_srcdir}/*.o
347	rm -f ${lib_dir}/*.o ${lib_dir}/*.a
348	rm -f ${zlib_dir}/*.o ${zlib_dir}/*.a
349	rm -f ${cvs_srcdir}/*.o
350
351clean-cvs:
352	del cvs.exe cvs.out
353	del $(subst /,\,${srcdir}/*.o)
354	del $(subst /,\,${diff_srcdir}/*.o)
355	del $(subst /,\,${lib_dir}/*.o ${lib_dir}/*.a)
356	del $(subst /,\,${zlib_dir}/*.o ${zlib_dir}/*.a)
357	del $(subst /,\,${cvs_srcdir}/*.o)
358
359install-cvs: cvs.exe
360	copy $(subst /,\,${srcdir}/cvs.exe ${install_dir}/cvs.exe)
361
362%.o: %.c
363	gcc ${OBJ_CFLAGS} ${CFLAGS} -o $@ -c $*.c
364
365${cvs_srcdir}/rcscmds.o: ${cvs_srcdir}/rcscmds.c ${top_srcdir}/diff/diffrun.h
366	gcc ${OBJ_CFLAGS} ${CFLAGS} -I${top_srcdir}/diff -o $@ -c $*.c
367
368${lib_dir}/libcvs.a: $(LIB_OBJECTS)
369	$(AR) cr $@ $(LIB_OBJECTS)
370
371${zlib_dir}/libz.a: $(ZLIB_OBJECTS)
372	$(AR) cr $@ $(ZLIB_OBJECTS)
373
374# Eventually probably static linking (cvs-static.exe) will be the
375# default, but even so we'll want to preserve this rule so we can
376# create a dynamically linked executable when we want coredumps.
377cvs.exe: ${OBJECTS} ${lib_dir}/libcvs.a ${zlib_dir}/libz.a
378	gcc $(COMMON_OBJECTS) $(OS2_OBJECTS) ${DIFF_OBJECTS} ${lib_dir}/libcvs.a ${zlib_dir}/libz.a $(LIB) -o cvs.out
379	emxbind -w -o $@.exe cvs.out
380
381${lib_dir}/libcvs.lib: ${lib_dir}/libcvs.a
382	emxomf ${lib_dir}/libcvs.a
383
384${zlib_dir}/libz.lib: ${zlib_dir}/libz.a
385	emxomf ${zlib_dir}/libz.a
386
387# Where do -Zomf -Zsys go?  When we compile the .o's?
388# When I tried this rule, I had problems with (1) could not find
389# socket.lib.  Hmm.  I thought I converted it from socket.a
390# in the EMX distribution.  Probably my EMX installation at fault.
391# (2) could not find miscellaneous system routines like strerror.
392# This might be a matter of learning to live without them (EMX
393# doc is supposed to describe which are present and which are not).
394# (3) some linker errors like no stack and the like.  Maybe I am
395# missing some options?
396cvs-static.exe: ${OBJECTS} ${lib_dir}/libcvs.lib ${zlib_dir}/libz.lib
397	emxomf ${OBJECTS}
398	emxomfld -o $@ $(subst .o,.obj,${OBJECTS}) \
399	  ${lib_dir}/libcvs.lib ${zlib_dir}/libz.lib ${LIB}
400
401# cvs.o: ${OBJECTS} ${SOURCES} ${HEADERS}
402
403# Hmm.  This rule wants to exist on unix, so that "make dist" works.
404# And it doesn't want to exist on OS/2, because configure doesn't
405# run on OS/2 and so ../config.status won't exist.  For now we just
406# say, in emx/README, that people will need to comment it out.
407Makefile: ../config.status $(srcdir)/Makefile.in
408	cd .. && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= ./config.status
409
410