### -*- Fundamental -*-
###
### $Id: makefile.wcc,v 1.8 2000/12/05 21:23:51 cph Exp $
###
### Copyright (c) 1994-2000 Massachusetts Institute of Technology
###
### This program is free software; you can redistribute it and/or
### modify it under the terms of the GNU General Public License as
### published by the Free Software Foundation; either version 2 of the
### License, or (at your option) any later version.
###
### This program is distributed in the hope that it will be useful,
### but WITHOUT ANY WARRANTY; without even the implied warranty of
### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
### General Public License for more details.
###
### You should have received a copy of the GNU General Public License
### along with this program; if not, write to the Free Software
### Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
###

#### Makefile for Scheme under OS/2 using Watcom C/C++

# This makefile is configured for use with GNU make, the Watcom C
# compiler, GNU m4, the Watcom assembler, and the RC program included
# with the IBM OS/2 Toolkit.

OBJ = obj
ASM = asm
CC = wcc386
M4 = m4
AS = wasm

# Compiler options.
# [DEBUG] marks options used for debugging.
# [OPTIMIZE] marks options used for optimization.
#
# /4r		386 instructions, 486 timings, register-based args
# /bm		build multi-thread binary
# /bt=os2	build OS/2 binary (default)
# /d1+		generate debug info [OPTIMIZE]
# /d2		generate debug info [DEBUG]
# /fpi		generate in-line 387 insns, emulate if none (default)
# /fp3		generate in-line 387 insns (default)
# /hw		generate Watcom debug info (default)
# /mf		use flat memory model (default)
# /od		disable optimization (default with /d2)
# /oe		enable in-line user-code expansion [OPTIMIZE]
# /ox		enable various optimizations [OPTIMIZE]
# /s		remove stack overflow checks
# /sg		generate calls to grow stack
# /w0		disable warning messages
# /zc		place literal strings in code segment
# /ze		enable language extensions (default)
# /zp4		use 4-byte alignment
# /zq		operate quietly
CFLAGS := /4r /bm /fpi /fp3 /s /sg /w0 /zc /zp4 /zq /dMIT_SCHEME

ifeq ($(debug_mode),debug)
CFLAGS := $(CFLAGS) /d2
else
ifeq ($(debug_mode),optimize)
CFLAGS := $(CFLAGS) /d1+ /oe /ox
endif
endif

# Linker options.
#
# debug all		include debug info in executable
# option caseexact	use case-sensitive comparison for identifiers
# option quiet		operate quietly
# option symfile	put debug info in .sym file
LDFLAGS := debug all option caseexact option quiet option symfile

# M4 options.
#
# -DOS2		Select OS/2 assembly-language conventions:
#		 * No leading underscore in C symbols.
#		 * 6-bit type codes.
#		 * OS/2 _System calling convention.
# -DDASM	Select Intel assembly language.
# -DWCC386R	Select Watcom 386 register-based conventions.
M4FLAGS = -DOS2 -DDASM -DWCC386R

# Assembler options.
#
# /d1		generate debug info
# /fpi		generate in-line 387 insns, emulate if none
# /fp3		generate in-line 387 insns
# /mf		use flat memory model
# /zq		operate quietly
ASFLAGS := /fpi /fp3 /mf /zq
ifeq ($(debug_mode),debug)
ASFLAGS := $(ASFLAGS) /d1
endif

%.obj : %.c
	$(CC) $(CFLAGS) $<

%.obj : %.asm
	$(AS) $(ASFLAGS) /fo=$@ $<

%.exe :
	wlink system os2v2 $(LDFLAGS) name $@ file { $^ }

include os2utl\makefile.cmn

cmpauxmd.asm : cmpauxmd.m4 asmcvt.exe
	.\asmcvt pre < $< | $(M4) $(M4FLAGS) | .\asmcvt post > $@

scheme.exe : $(OBJECTS) scheme.res
	wlink system os2v2_pm name $@ $(LDFLAGS) \
	file { $(OBJECTS) } $(SCHEME_LIB)
	rc scheme.res $@

bchschem.exe : $(BCHOBJECTS) bchschem.res
	wlink system os2v2_pm name $@ $(LDFLAGS) \
	file { $(BCHOBJECTS) } $(SCHEME_LIB)
	rc bchschem.res $@


syntax highlighted by Code2HTML, v. 0.9.1