1# $Id: mk_os2.mak 74 2002-01-27 21:20:55Z darren $
2#
3# A Makefile for OS/2 using EMX/gcc
4# You may want to use the OS/2 port of autoconf for building
5# and comment-out the according statements in this Makefile.
6# You need a library to provide regex support.
7# libExt might do this, but currently (2/2001) it doesn't work well
8# together with ctags ...
9#
10# Provided and supported by
11# Alexander Mai
12# <st002279@hrzpub.tu-darmstadt.de> or <amai@users.sf.net>
13
14default:
15	@echo "Enter $(MAKE) -f mk_os2.mak target"
16	@echo "where target is one of:"
17	@echo "   small    (small executable req. EMX runtime)"
18	@echo "   debug    (executable for debugging purposes)"
19	@echo "   release  (stand-alone executable)"
20	@echo "   clean    (remove all files built)"
21
22# Use this to create a small binary
23# (requires EMX runtime libraries)
24small:
25	$(MAKE) -f mk_os2.mak all \
26	CC="gcc" \
27	CFLAGS="-O5 -mpentium -Wall" \
28	LFLAGS="-Zcrtdll -s" \
29	LIBS="-lregex" \
30	OBJEXT="o"
31
32# Use this to create a binary for debugging purposes
33# (requires EMX runtime libraries)
34debug:
35	$(MAKE) -f mk_os2.mak all \
36	CC="gcc" \
37	CFLAGS="-O0 -Wall -g" \
38	LFLAGS="-Zcrtdll -g" \
39	LIBS="-lregex" \
40	OBJEXT="o"
41
42# Use this to create a stand-alone binary for distribution
43# (requires link386 for linking but no EMX runtime libraries)
44release:
45	$(MAKE) -f mk_os2.mak all \
46	CC="gcc" \
47	CFLAGS="-g -O5 -mpentium -Wall" \
48	LFLAGS="-s -Zomf -Zsys -Zlinker /PM:VIO" \
49	LIBS="-lregex" \
50	OBJEXT="obj"
51
52# Use the line below if you have created config.h
53# (manually or by running configure)
54# Otherwise use built-in defaults (#ifdef OS2)!
55# DEFINES=-DHAVE_CONFIG_H
56DEFINES=-DOS2
57
58
59# General rules and definitions
60
61.SUFFIXES: .c .exe .h .o .obj
62
63include source.mak
64
65all: ctags.exe readtags.exe readtags.a readtags.lib
66ctags: ctags.exe
67etags: etags.exe
68
69ctags.exe: $(OBJECTS)
70	$(CC) $(CFLAGS) $(LFLAGS) -o $@ $^ $(LIBS)
71
72etags.exe: ctags.exe
73	@copy $< $@
74
75# The readtags executable
76readtags.exe: readtags.c
77	$(CC) $(CFLAGS) $(DEFINES) $(LFLAGS) -DREADTAGS_MAIN -o $@ $^ $(LIBS)
78
79# We build a.out and omf version of the readtags library
80readtags.o: readtags.c
81	$(CC) $(CFLAGS) $(DEFINES) -c -o $@ $^
82
83readtags.a: readtags.o
84	if exist $@ del $@
85	ar rc $@ $^
86
87readtags.lib: readtags.a
88	emxomf $<
89
90.c.o:
91	$(CC) $(CFLAGS) $(DEFINES) -I. -c $< -o $@
92
93.c.obj:
94	$(CC) $(CFLAGS) -Zomf $(DEFINES) -I. -c $< -o $@
95
96# Delete all files that are not part of the source distribution
97clean:
98	@if exist ctags.exe     del ctags.exe
99	@if exist etags.exe     del etags.exe
100	@if exist readtags.exe  del readtags.exe
101	@if exist readtags.a    del readtags.a
102	@if exist readtags.lib  del readtags.lib
103	@if exist *.obj         del *.obj
104	@if exist *.o           del *.o
105