From 5669db8d3e3574aab7d1aab40e51ea5a2f65b673 Mon Sep 17 00:00:00 2001
From: Chris Hanson <org/chris-hanson/cph>
Date: Sat, 4 Nov 1995 00:59:53 +0000
Subject: [PATCH] Modify to customize resource files differently for scheme and
 bchscheme, and to allow debug/optimize to be selected by a setting in the
 main makefile.

---
 v7/src/microcode/os2utl/makefile     |  6 +++++-
 v7/src/microcode/os2utl/makefile.cmn | 10 +++++++--
 v7/src/microcode/os2utl/makefile.emx | 19 +++++++++--------
 v7/src/microcode/os2utl/makefile.gcc | 14 +++++++++----
 v7/src/microcode/os2utl/makefile.vac | 31 ++++++++++++++--------------
 v7/src/microcode/os2utl/makefile.wcc | 31 +++++++++++++++++-----------
 6 files changed, 68 insertions(+), 43 deletions(-)

diff --git a/v7/src/microcode/os2utl/makefile b/v7/src/microcode/os2utl/makefile
index 4a23395d1..691bae638 100644
--- a/v7/src/microcode/os2utl/makefile
+++ b/v7/src/microcode/os2utl/makefile
@@ -1,6 +1,6 @@
 ### -*- Fundamental -*-
 ###
-###	$Id: makefile,v 1.12 1995/10/15 00:42:29 cph Exp $
+###	$Id: makefile,v 1.13 1995/11/04 00:58:42 cph Exp $
 ###
 ###	Copyright (c) 1994-95 Massachusetts Institute of Technology
 ###
@@ -41,6 +41,10 @@
 
 all: scheme.exe bchschem.exe bintopsb.exe psbtobin.exe
 
+# Uncomment exactly one of the following two lines:
+debug_mode = debug
+#debug_mode = optimize
+
 # Uncomment exactly one of the following include statements to
 # customize this makefile for your compiler.  All of the
 # configurations require both GNU make and GNU m4.
diff --git a/v7/src/microcode/os2utl/makefile.cmn b/v7/src/microcode/os2utl/makefile.cmn
index b908c1a7c..f5a7bb2e3 100644
--- a/v7/src/microcode/os2utl/makefile.cmn
+++ b/v7/src/microcode/os2utl/makefile.cmn
@@ -1,6 +1,6 @@
 ### -*- Fundamental -*-
 ###
-###	$Id: makefile.cmn,v 1.5 1995/10/30 08:08:12 cph Exp $
+###	$Id: makefile.cmn,v 1.6 1995/11/04 00:58:50 cph Exp $
 ###
 ###	Copyright (c) 1994-95 Massachusetts Institute of Technology
 ###
@@ -259,6 +259,7 @@ clean :
 	-del *.$(OBJ)
 	-del *.exe
 	-del *.tch
+	-del *.res
 	-del *.err
 	-del *.sym
 	-del cmpauxmd.$(ASM)
@@ -384,7 +385,6 @@ os2file.$(OBJ) : osfile.h
 os2fs.$(OBJ) : osfs.h
 os2pm.$(OBJ) : os2pm-id.h os2pm-mi.h os2pm-dc.h os2pm-rp.h
 os2pmcon.$(OBJ) : os2pmcon.h version.h
-os2pmcon.res : os2pmcon.rc os2pmcon.h
 os2proc.$(OBJ) : osproc.h
 os2top.$(OBJ) : scheme.tch ostop.h option.h
 os2tty.$(OBJ) : ostty.h
@@ -392,3 +392,9 @@ os2xcpt.$(OBJ) : scheme.tch $(GC_HEAD_FILES)
 pros2fs.$(OBJ) : scheme.tch prims.h osfs.h
 pros2io.$(OBJ) : scheme.tch prims.h
 pros2pm.$(OBJ) : scheme.tch prims.h
+
+scheme.res : os2pmcon.rc os2pmcon.h
+	rc -r -DSCHEME os2pmcon.rc scheme.res
+
+bchschem.res : os2pmcon.rc os2pmcon.h
+	rc -r -DBCHSCHEM os2pmcon.rc bchschem.res
diff --git a/v7/src/microcode/os2utl/makefile.emx b/v7/src/microcode/os2utl/makefile.emx
index 8f96b746b..0649e1fab 100644
--- a/v7/src/microcode/os2utl/makefile.emx
+++ b/v7/src/microcode/os2utl/makefile.emx
@@ -1,6 +1,6 @@
 ### -*- Fundamental -*-
 ###
-###	$Id: makefile.emx,v 1.5 1995/10/30 08:08:32 cph Exp $
+###	$Id: makefile.emx,v 1.6 1995/11/04 00:59:46 cph Exp $
 ###
 ###	Copyright (c) 1994-95 Massachusetts Institute of Technology
 ###
@@ -44,10 +44,14 @@
 # macro preprocessor, and the RC program included with the IBM OS/2
 # Toolkit.
 
+GCCFLAGS := -Zmt -O
+ifeq ($(debug_mode),debug)
+GCCFLAGS := $(GCCFLAGS) -g
+endif
+
 OBJ = o
 ASM = s
 CC = gcc
-GCCFLAGS = -Zmt -O -g
 CFLAGS = $(GCCFLAGS) -DMIT_SCHEME -D__OS2__
 LDFLAGS = $(GCCFLAGS)
 M4 = m4
@@ -64,9 +68,6 @@ ASFLAGS =
 %.o : %.s
 	$(AS) $(ASFLAGS) -o $@ $<
 
-%.res : %.rc
-	rc -r $<
-
 %.exe :
 	$(CC) $(LDFLAGS) -o $(basename $@) $^
 	emxbind -bq $(basename $@)
@@ -74,14 +75,14 @@ ASFLAGS =
 
 include os2utl\makefile.cmn
 
-scheme.exe : $(OBJECTS) $(SCHEME_OBJECTS) os2pmcon.res
+scheme.exe : $(OBJECTS) $(SCHEME_OBJECTS) scheme.res
 	$(CC) $(LDFLAGS) -o $(basename $@) \
 	$(OBJECTS) $(SCHEME_OBJECTS) $(SCHEME_LIB)
-	emxbind -bpq $(basename $@) -ros2pmcon.res
+	emxbind -bpq $(basename $@) -rscheme.res
 	del $(basename $@)
 
-bchschem.exe : $(BCHOBJECTS) $(SCHEME_OBJECTS)
+bchschem.exe : $(BCHOBJECTS) $(SCHEME_OBJECTS) bchschem.res
 	$(CC) $(LDFLAGS) -o $(basename $@) \
 	$(OBJECTS) $(SCHEME_OBJECTS) $(SCHEME_LIB)
-	emxbind -bpq $(basename $@) -ros2pmcon.res
+	emxbind -bpq $(basename $@) -rbchschem.res
 	del $(basename $@)
diff --git a/v7/src/microcode/os2utl/makefile.gcc b/v7/src/microcode/os2utl/makefile.gcc
index d873cbe27..43684c6ef 100644
--- a/v7/src/microcode/os2utl/makefile.gcc
+++ b/v7/src/microcode/os2utl/makefile.gcc
@@ -1,6 +1,6 @@
 ### -*- Fundamental -*-
 ###
-###	$Id: makefile.gcc,v 1.4 1995/10/17 23:06:21 cph Exp $
+###	$Id: makefile.gcc,v 1.5 1995/11/04 00:59:53 cph Exp $
 ###
 ###	Copyright (c) 1995 Massachusetts Institute of Technology
 ###
@@ -43,10 +43,14 @@
 # development system (compiler, assembler, linker, etc.), and the GNU
 # m4 macro preprocessor.
 
+GCCFLAGS := -O
+ifeq ($(debug_mode),debug)
+GCCFLAGS := $(GCCFLAGS) -g
+endif
+
 OBJ = obj
 ASM = asm
 CC = gcc -Uunix -U__unix__ -U__unix -D__GCC2__
-GCCFLAGS = -O -g
 CFLAGS = $(GCCFLAGS) -DMIT_SCHEME
 LDFLAGS = $(GCCFLAGS)
 M4 = m4
@@ -68,8 +72,10 @@ ASFLAGS = -I
 
 include os2utl\makefile.cmn
 
-scheme.exe : $(OBJECTS) $(SCHEME_OBJECTS)
+scheme.exe : $(OBJECTS) $(SCHEME_OBJECTS) scheme.res
 	$(CC) $(LDFLAGS) -o $@ $^ $(SCHEME_LIB)
+	rc scheme.res $@
 
-bchschem.exe : $(BCHOBJECTS) $(SCHEME_OBJECTS)
+bchschem.exe : $(BCHOBJECTS) $(SCHEME_OBJECTS) bchschem.res
 	$(CC) $(LDFLAGS) -o $@ $^ $(SCHEME_LIB)
+	rc bchschem.res $@
diff --git a/v7/src/microcode/os2utl/makefile.vac b/v7/src/microcode/os2utl/makefile.vac
index e2cc89feb..a2cd85cbe 100644
--- a/v7/src/microcode/os2utl/makefile.vac
+++ b/v7/src/microcode/os2utl/makefile.vac
@@ -1,6 +1,6 @@
 ### -*- Fundamental -*-
 ###
-###	$Id: makefile.vac,v 1.4 1995/10/30 08:09:24 cph Exp $
+###	$Id: makefile.vac,v 1.5 1995/11/04 00:58:57 cph Exp $
 ###
 ###	Copyright (c) 1994-95 Massachusetts Institute of Technology
 ###
@@ -44,16 +44,20 @@
 # included with the EMX/GCC package, and the RC program included with
 # the IBM OS/2 Toolkit.
 
-# For optimization, replace /Ti+ with /O+.
-# For OS/2 2.x, replace /B"/EXEPACK:2" with /B"/EXEPACK"
+ICCFLAGS := /Gm+ /Q+ /Wall-
+ifeq ($(debug_mode),debug)
+ICCFLAGS := $(ICCFLAGS) /Ti+
+else
+ifeq ($(debug_mode),optimize)
+ICCFLAGS := $(ICCFLAGS) /O+
+endif
+endif
 
 OBJ = obj
 ASM = asm
 CC = icc
-ICCFLAGS = /Gm+ /Q+ /Wall- /Ti+
 CFLAGS = $(ICCFLAGS) /DMIT_SCHEME
-LDFLAGS = $(ICCFLAGS) /B"/EXEPACK:2"
-SCHEME_LDFLAGS = $(LDFLAGS)
+LDFLAGS = $(ICCFLAGS) /B"/EXEPACK"
 M4 = m4
 M4FLAGS = -DOS2
 AS = as
@@ -68,20 +72,17 @@ ASFLAGS = -Zomf
 %.obj : %.asm
 	$(AS) $(ASFLAGS) -o $@ $<
 
-%.res : %.rc
-	rc -r $<
-
 %.exe :
 	$(CC) $(LDFLAGS) /Fe$@ $^
 
 include os2utl\makefile.cmn
 
-scheme.exe : $(OBJECTS) $(SCHEME_OBJECTS) os2pmcon.res
-	$(CC) $(SCHEME_LDFLAGS) /B"/PMTYPE:PM" /Fe$@ \
+scheme.exe : $(OBJECTS) $(SCHEME_OBJECTS) scheme.res
+	$(CC) $(LDFLAGS) /B"/PMTYPE:PM" /Fe$@ \
 	$(OBJECTS) $(SCHEME_OBJECTS) $(SCHEME_LIB)
-	rc os2pmcon.res $@
+	rc scheme.res $@
 
-bchschem.exe : $(BCHOBJECTS) $(SCHEME_OBJECTS) os2pmcon.res
-	$(CC) $(SCHEME_LDFLAGS) /B"/PMTYPE:PM" /Fe$@ \
+bchschem.exe : $(BCHOBJECTS) $(SCHEME_OBJECTS) bchschem.res
+	$(CC) $(LDFLAGS) /B"/PMTYPE:PM" /Fe$@ \
 	$(OBJECTS) $(SCHEME_OBJECTS) $(SCHEME_LIB)
-	rc os2pmcon.res $@
+	rc bchschem.res $@
diff --git a/v7/src/microcode/os2utl/makefile.wcc b/v7/src/microcode/os2utl/makefile.wcc
index 9778bc616..183c92684 100644
--- a/v7/src/microcode/os2utl/makefile.wcc
+++ b/v7/src/microcode/os2utl/makefile.wcc
@@ -1,6 +1,6 @@
 ### -*- Fundamental -*-
 ###
-###	$Id: makefile.wcc,v 1.5 1995/10/30 08:09:51 cph Exp $
+###	$Id: makefile.wcc,v 1.6 1995/11/04 00:59:37 cph Exp $
 ###
 ###	Copyright (c) 1994-95 Massachusetts Institute of Technology
 ###
@@ -64,7 +64,6 @@ AS = wasm
 # /mf		use flat memory model (default)
 # /od		disable optimization (default with /d2)
 # /oe		enable in-line user-code expansion [OPTIMIZE]
-# /op		force IEEE floating-point semantics
 # /ox		enable various optimizations [OPTIMIZE]
 # /s		remove stack overflow checks
 # /sg		generate calls to grow stack
@@ -73,7 +72,15 @@ AS = wasm
 # /ze		enable language extensions (default)
 # /zp4		use 4-byte alignment
 # /zq		operate quietly
-CFLAGS = /4r /bm /d2 /fpi /fp3 /op /s /sg /w0 /zc /zp4 /zq /dMIT_SCHEME
+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.
 #
@@ -81,7 +88,7 @@ CFLAGS = /4r /bm /d2 /fpi /fp3 /op /s /sg /w0 /zc /zp4 /zq /dMIT_SCHEME
 # 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
+LDFLAGS := debug all option caseexact option quiet option symfile
 
 # M4 options.
 #
@@ -100,7 +107,10 @@ M4FLAGS = -DOS2 -DDASM -DWCC386R
 # /fp3		generate in-line 387 insns
 # /mf		use flat memory model
 # /zq		operate quietly
-ASFLAGS = /d1 /fpi /fp3 /mf /zq
+ASFLAGS := /fpi /fp3 /mf /zq
+ifeq ($(debug_mode),debug)
+ASFLAGS := $(ASFLAGS) /d1
+endif
 
 %.obj : %.c
 	$(CC) $(CFLAGS) $<
@@ -108,9 +118,6 @@ ASFLAGS = /d1 /fpi /fp3 /mf /zq
 %.obj : %.asm
 	$(AS) $(ASFLAGS) /fo=$@ $<
 
-%.res : %.rc
-	rc -r $<
-
 %.exe :
 	wlink system os2v2 $(LDFLAGS) name $@ file { $^ }
 
@@ -119,12 +126,12 @@ include os2utl\makefile.cmn
 cmpauxmd.asm : cmpauxmd.m4 asmcvt.exe
 	.\asmcvt pre < $< | $(M4) $(M4FLAGS) | .\asmcvt post > $@
 
-scheme.exe : $(OBJECTS) $(SCHEME_OBJECTS) os2pmcon.res
+scheme.exe : $(OBJECTS) $(SCHEME_OBJECTS) scheme.res
 	wlink system os2v2_pm name $@ $(LDFLAGS) \
 	file { $(OBJECTS) $(SCHEME_OBJECTS) } $(SCHEME_LIB)
-	rc os2pmcon.res $@
+	rc scheme.res $@
 
-bchschem.exe : $(BCHOBJECTS) $(SCHEME_OBJECTS) os2pmcon.res
+bchschem.exe : $(BCHOBJECTS) $(SCHEME_OBJECTS) bchschem.res
 	wlink system os2v2_pm name $@ $(LDFLAGS) \
 	file { $(OBJECTS) $(SCHEME_OBJECTS) } $(SCHEME_LIB)
-	rc os2pmcon.res $@
+	rc bchschem.res $@
-- 
2.25.1