Initial commit of Command & Conquer Red Alert source code.
This commit is contained in:
113
WWFLAT32/DESCMGMT/DESCMGMT.CPP
Normal file
113
WWFLAT32/DESCMGMT/DESCMGMT.CPP
Normal file
@@ -0,0 +1,113 @@
|
||||
/*
|
||||
** Command & Conquer Red Alert(tm)
|
||||
** Copyright 2025 Electronic Arts Inc.
|
||||
**
|
||||
** 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/***************************************************************************
|
||||
** C O N F I D E N T I A L --- W E S T W O O D S T U D I O S **
|
||||
***************************************************************************
|
||||
* *
|
||||
* Project Name : Descriptor management *
|
||||
* *
|
||||
* File Name : DESCMGMT.CPP *
|
||||
* *
|
||||
* Programmer : Jeff Wilson *
|
||||
* *
|
||||
* Start Date : March 28, 1994 *
|
||||
* *
|
||||
* Last Update : March 28, 1994 [] *
|
||||
* *
|
||||
*-------------------------------------------------------------------------*
|
||||
* Functions: *
|
||||
* MAP_SEGMENT_TO_ADDRESS -- Maps a physical address into a selector *
|
||||
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
|
||||
|
||||
#include "descmgmt.h"
|
||||
#include "misc.h"
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
* MAP_SEGMENT_TO_ADDRESS -- Maps a physical address into a selector *
|
||||
* *
|
||||
* *
|
||||
* *
|
||||
* INPUT: *
|
||||
* *
|
||||
* OUTPUT: selector UWORD The selector mapped to address. exit on error. *
|
||||
* *
|
||||
* WARNINGS: *
|
||||
* *
|
||||
* HISTORY: *
|
||||
* 03/25/1994 jaw: Created. *
|
||||
*=========================================================================*/
|
||||
|
||||
ULONG Map_Segment_To_Address(ULONG address, ULONG length)
|
||||
{
|
||||
|
||||
// this function is not longer needed by RATIONAL SYSTEM DOS4GW
|
||||
// linear addressing mode.
|
||||
// a> the first megabyte of memory is mapped to linear adress 0 - 0x10000h
|
||||
// b> all other addresses are linear offset from either ds: or es:
|
||||
|
||||
/*
|
||||
UWORD segment;
|
||||
UWORD curDS;
|
||||
CD_DES desc;
|
||||
CD_DES cur_desc;
|
||||
|
||||
// allocate a selector
|
||||
if(_dos_allocmem(0, &segment) != 0) {
|
||||
Exit(1, "Allocation of Descriptor.\n");
|
||||
}
|
||||
|
||||
// get the data for this selector
|
||||
if(_dx_ldt_rd(segment, (UCHAR *)&desc) != 0) {
|
||||
Exit(1, "Reading Descriptor.\n");
|
||||
}
|
||||
|
||||
// get the data for current data segment
|
||||
curDS = GetDs();
|
||||
if(_dx_ldt_rd(curDS, (UCHAR *)&cur_desc) != 0) {
|
||||
Exit(1, "Reading Descriptor.\n");
|
||||
}
|
||||
|
||||
// set limit
|
||||
desc.limit0_15 = (USHORT)(length & 0xffff);
|
||||
desc.limit16_19 = ((UCHAR)(length >> 16L)) | DOS_32;
|
||||
|
||||
// set base address
|
||||
desc.base0_15 = (USHORT)(address & 0xffff);
|
||||
desc.base16_23 = (UCHAR)((address >> 16) & 0xff);
|
||||
desc.base24_31 = (UCHAR)((address >> 24) & 0xff);
|
||||
|
||||
// set rights mark as icurrent data segment
|
||||
desc.arights = cur_desc.arights;
|
||||
|
||||
// write to LDT selector
|
||||
if(_dx_ldt_wr(segment, (UCHAR *)&desc) != 0) {
|
||||
Exit(1, "Failed writing descriptor.\n");
|
||||
}
|
||||
|
||||
// return selector number
|
||||
return segment;
|
||||
*/
|
||||
|
||||
if ( address & 0xfff0ffff )
|
||||
Exit ( 1 , "Error mapping real address to lineal address.\n" ) ;
|
||||
|
||||
return address ;
|
||||
}
|
||||
|
93
WWFLAT32/DESCMGMT/DESCMGMT.H
Normal file
93
WWFLAT32/DESCMGMT/DESCMGMT.H
Normal file
@@ -0,0 +1,93 @@
|
||||
/*
|
||||
** Command & Conquer Red Alert(tm)
|
||||
** Copyright 2025 Electronic Arts Inc.
|
||||
**
|
||||
** 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/***************************************************************************
|
||||
** C O N F I D E N T I A L --- W E S T W O O D S T U D I O S **
|
||||
***************************************************************************
|
||||
* *
|
||||
* Project Name : WWLIB32 library *
|
||||
* *
|
||||
* File Name : DESCMGMT.H *
|
||||
* *
|
||||
* Programmer : Scott K. Bowen *
|
||||
* *
|
||||
* Start Date : August 3, 1994 *
|
||||
* *
|
||||
* Last Update : August 3, 1994 [SKB] *
|
||||
* *
|
||||
*-------------------------------------------------------------------------*
|
||||
* Functions: *
|
||||
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
|
||||
|
||||
#ifndef DESCMGMT_H
|
||||
#define DESCMGMT_H
|
||||
|
||||
|
||||
#ifndef WWSTD_H
|
||||
#include "wwstd.h"
|
||||
#endif
|
||||
|
||||
//=====================================================================
|
||||
// C type include files
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <dos.h>
|
||||
#include <bios.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
// ====================================================================
|
||||
|
||||
|
||||
// types
|
||||
// These where taken from dos.h
|
||||
//==========================================
|
||||
|
||||
// external functions
|
||||
// ===================================================
|
||||
extern ULONG Map_Segment_To_Address(ULONG address, ULONG length);
|
||||
|
||||
extern "C" {
|
||||
// Assemble functions
|
||||
extern UWORD FixSelector(UWORD sel);
|
||||
extern UWORD GetDs(void);
|
||||
extern UWORD GetCs(void);
|
||||
extern VOID GetDefaultSelectors(VOID);
|
||||
extern UWORD Get_Standard_Selector(void);
|
||||
|
||||
|
||||
// Assembly data variables
|
||||
extern UWORD CodeSelector;
|
||||
extern UWORD DataSelector;
|
||||
extern UWORD ScreenSelector;
|
||||
extern UWORD GraphicsSelector;
|
||||
extern UWORD PspSelector;
|
||||
extern UWORD EnvSelector;
|
||||
extern UWORD DosMemSelector;
|
||||
extern UWORD Fp1167Selector;
|
||||
extern UWORD FpWeitekSelector;
|
||||
extern UWORD FpCyrixSelector;
|
||||
}
|
||||
|
||||
#endif // DESCMGMT_H
|
||||
|
||||
|
94
WWFLAT32/DESCMGMT/FFIXSEL.ASM
Normal file
94
WWFLAT32/DESCMGMT/FFIXSEL.ASM
Normal file
@@ -0,0 +1,94 @@
|
||||
;
|
||||
; Command & Conquer Red Alert(tm)
|
||||
; Copyright 2025 Electronic Arts Inc.
|
||||
;
|
||||
; 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
;
|
||||
|
||||
;***************************************************************************
|
||||
;** C O N F I D E N T I A L --- W E S T W O O D S T U D I O S **
|
||||
;***************************************************************************
|
||||
;* *
|
||||
;* Project Name : Fix a selector *
|
||||
;* *
|
||||
;* File Name : FFIXSEL.ASM *
|
||||
;* *
|
||||
;* Programmer : Jeff Wilson *
|
||||
;* *
|
||||
;* Start Date : March 28, 1994 *
|
||||
;* *
|
||||
;* Last Update : March 28, 1994 [] *
|
||||
;* *
|
||||
;*-------------------------------------------------------------------------*
|
||||
;* Functions: *
|
||||
;* FixSelector -- Fix the Priviledge level of a selector *
|
||||
;* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *
|
||||
|
||||
|
||||
|
||||
IDEAL
|
||||
P386
|
||||
MODEL USE32 FLAT
|
||||
|
||||
|
||||
EXTRN exit : near
|
||||
GLOBAL FixSelector :NEAR
|
||||
|
||||
;============================================================================
|
||||
CODESEG
|
||||
|
||||
;***************************************************************************
|
||||
;* FIXSELECTOR -- Fix the Priviledge level of a selector *
|
||||
;* *
|
||||
;* *
|
||||
;* *
|
||||
;* INPUT: sel the selector to fix-up *
|
||||
;* *
|
||||
;* OUTPUT: UWORD The fixed up selector *
|
||||
;* *
|
||||
;* WARNINGS: *
|
||||
;* *
|
||||
;* HISTORY: *
|
||||
;* 03/28/1994 jaw Created. *
|
||||
;*=========================================================================*
|
||||
|
||||
PROC FixSelector C near
|
||||
|
||||
USES ecx,edx
|
||||
|
||||
ARG sel:WORD
|
||||
|
||||
; Copy the Table Bit and IOPL from the Current CS
|
||||
|
||||
; Something is wrong the program should not be here unthe any circunstance
|
||||
; movzx ecx,[sel]
|
||||
; xor eax,eax
|
||||
; mov ax,cs
|
||||
; and ax,7
|
||||
; or ax,cx
|
||||
push 0
|
||||
call exit
|
||||
|
||||
ret
|
||||
;====================
|
||||
ENDP FixSelector
|
||||
|
||||
|
||||
|
||||
END
|
||||
|
||||
|
||||
|
||||
|
||||
|
78
WWFLAT32/DESCMGMT/FGETCS.ASM
Normal file
78
WWFLAT32/DESCMGMT/FGETCS.ASM
Normal file
@@ -0,0 +1,78 @@
|
||||
;
|
||||
; Command & Conquer Red Alert(tm)
|
||||
; Copyright 2025 Electronic Arts Inc.
|
||||
;
|
||||
; 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
;
|
||||
|
||||
;***************************************************************************
|
||||
;** C O N F I D E N T I A L --- W E S T W O O D S T U D I O S **
|
||||
;***************************************************************************
|
||||
;* *
|
||||
;* Project Name : Get the code selector *
|
||||
;* *
|
||||
;* File Name : FGETCS.ASM *
|
||||
;* *
|
||||
;* Programmer : Jeff Wilson *
|
||||
;* *
|
||||
;* Start Date : March 28, 1994 *
|
||||
;* *
|
||||
;* Last Update : March 28, 1994 [] *
|
||||
;* *
|
||||
;*-------------------------------------------------------------------------*
|
||||
;* Functions: *
|
||||
;* GetCs -- Return the current Data selector. *
|
||||
;* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *
|
||||
|
||||
|
||||
IDEAL
|
||||
P386
|
||||
MODEL USE32 FLAT
|
||||
|
||||
|
||||
GLOBAL GetCs :NEAR
|
||||
|
||||
;============================================================================
|
||||
CODESEG
|
||||
|
||||
;***************************************************************************
|
||||
;* GETCS -- Return the current Data selector. *
|
||||
;* *
|
||||
;* *
|
||||
;* *
|
||||
;* INPUT: NONE *
|
||||
;* *
|
||||
;* OUTPUT: UWORD selector of the default code segment *
|
||||
;* *
|
||||
;* WARNINGS: *
|
||||
;* *
|
||||
;* HISTORY: *
|
||||
;* 03/28/1994 jaw: Created. *
|
||||
;*=========================================================================*
|
||||
|
||||
PROC GetCs C near
|
||||
|
||||
xor eax,eax
|
||||
mov ax,cs
|
||||
ret
|
||||
;====================
|
||||
ENDP GetCs
|
||||
|
||||
|
||||
END
|
||||
|
||||
|
||||
|
||||
|
||||
|
77
WWFLAT32/DESCMGMT/FGETDS.ASM
Normal file
77
WWFLAT32/DESCMGMT/FGETDS.ASM
Normal file
@@ -0,0 +1,77 @@
|
||||
;
|
||||
; Command & Conquer Red Alert(tm)
|
||||
; Copyright 2025 Electronic Arts Inc.
|
||||
;
|
||||
; 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
;
|
||||
|
||||
;***************************************************************************
|
||||
;** C O N F I D E N T I A L --- W E S T W O O D S T U D I O S **
|
||||
;***************************************************************************
|
||||
;* *
|
||||
;* Project Name : Get the data selector *
|
||||
;* *
|
||||
;* File Name : FGETDS.ASM *
|
||||
;* *
|
||||
;* Programmer : Jeff Wilson *
|
||||
;* *
|
||||
;* Start Date : March 28, 1994 *
|
||||
;* *
|
||||
;* Last Update : March 28, 1994 [] *
|
||||
;* *
|
||||
;*-------------------------------------------------------------------------*
|
||||
;* Functions: *
|
||||
;* GetDs -- Return the current Data selector. *
|
||||
;* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *
|
||||
|
||||
|
||||
IDEAL
|
||||
P386
|
||||
MODEL USE32 FLAT
|
||||
|
||||
|
||||
GLOBAL GetDs :NEAR
|
||||
|
||||
;============================================================================
|
||||
CODESEG
|
||||
|
||||
;***************************************************************************
|
||||
;* GETDS -- Return the current Data selector. *
|
||||
;* *
|
||||
;* *
|
||||
;* *
|
||||
;* INPUT: NONE *
|
||||
;* *
|
||||
;* OUTPUT: UWORD selector of the default data segment *
|
||||
;* *
|
||||
;* WARNINGS: *
|
||||
;* *
|
||||
;* HISTORY: *
|
||||
;* 03/28/1994 jaw: Created. *
|
||||
;*=========================================================================*
|
||||
|
||||
PROC GetDs C near
|
||||
|
||||
xor eax,eax
|
||||
mov ax,ds
|
||||
ret
|
||||
;====================
|
||||
ENDP GetDs
|
||||
|
||||
|
||||
END
|
||||
|
||||
|
||||
|
||||
|
118
WWFLAT32/DESCMGMT/FGETSEL.ASM
Normal file
118
WWFLAT32/DESCMGMT/FGETSEL.ASM
Normal file
@@ -0,0 +1,118 @@
|
||||
;
|
||||
; Command & Conquer Red Alert(tm)
|
||||
; Copyright 2025 Electronic Arts Inc.
|
||||
;
|
||||
; 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
;
|
||||
|
||||
;***************************************************************************
|
||||
;** C O N F I D E N T I A L --- W E S T W O O D S T U D I O S **
|
||||
;***************************************************************************
|
||||
;* *
|
||||
;* Project Name : Get the Defines selectors *
|
||||
;* *
|
||||
;* File Name : FGETSEL.ASM *
|
||||
;* *
|
||||
;* Programmer : Jeff Wilson *
|
||||
;* *
|
||||
;* Start Date : March 28, 1994 *
|
||||
;* *
|
||||
;* Last Update : March 28, 1994 [] *
|
||||
;* *
|
||||
;*-------------------------------------------------------------------------*
|
||||
;* Functions: *
|
||||
;* GetDefaultSelectors -- Return the current default selectors. *
|
||||
;* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *
|
||||
|
||||
|
||||
IDEAL
|
||||
P386
|
||||
MODEL USE32 FLAT
|
||||
|
||||
|
||||
GLOBAL GetDefaultSelectors :NEAR
|
||||
|
||||
GLOBAL DataSelector :WORD
|
||||
GLOBAL ScreenSelector :WORD
|
||||
GLOBAL GraphicsSelector :WORD
|
||||
GLOBAL PspSelector :WORD
|
||||
GLOBAL EnvSelector :WORD
|
||||
GLOBAL DosMemSelector :WORD
|
||||
GLOBAL Fp1167Selector :WORD
|
||||
GLOBAL FpWeitekSelector :WORD
|
||||
GLOBAL FpCyrixSelector :WORD
|
||||
GLOBAL CodeSelector :WORD
|
||||
|
||||
|
||||
DATASEG
|
||||
|
||||
; It is very important that this section remain untouch
|
||||
; is not really needed by Rational System but is here to
|
||||
; keep compatibility with the TNT dos extender.
|
||||
DataSelector dw 0
|
||||
ScreenSelector dw 0
|
||||
GraphicsSelector dw 0
|
||||
|
||||
PspSelector dw 0
|
||||
EnvSelector dw 0
|
||||
DosMemSelector dw 0
|
||||
|
||||
Fp1167Selector dw 0
|
||||
FpWeitekSelector dw 0
|
||||
FpCyrixSelector dw 0
|
||||
|
||||
CodeSelector dw 0
|
||||
|
||||
|
||||
;============================================================================
|
||||
CODESEG
|
||||
|
||||
;***************************************************************************
|
||||
;* GetDefaultSelectors -- Setup the defaults selector values to have the *
|
||||
;* Correct Descriptor table and IOPL. *
|
||||
;* *
|
||||
;* *
|
||||
;* *
|
||||
;* INPUT: NONE *
|
||||
;* *
|
||||
;* OUTPUT: *
|
||||
;* *
|
||||
;* WARNINGS: *
|
||||
;* *
|
||||
;* HISTORY: *
|
||||
;* 03/28/1994 jaw: Created. *
|
||||
;*=========================================================================*
|
||||
|
||||
PROC GetDefaultSelectors C near
|
||||
USES eax,esi,ecx
|
||||
|
||||
lea edi,[DataSelector]
|
||||
lea ecx,[CodeSelector]
|
||||
sub ecx,edi
|
||||
shr ecx,1
|
||||
mov ax,ds
|
||||
rep stosw
|
||||
mov ax,cs
|
||||
mov [word ptr CodeSelector] , ax
|
||||
|
||||
ret
|
||||
;====================
|
||||
ENDP GetDefaultSelectors
|
||||
|
||||
|
||||
END
|
||||
|
||||
|
||||
|
||||
|
183
WWFLAT32/DESCMGMT/MAKEFILE
Normal file
183
WWFLAT32/DESCMGMT/MAKEFILE
Normal file
@@ -0,0 +1,183 @@
|
||||
#
|
||||
# Command & Conquer Red Alert(tm)
|
||||
# Copyright 2025 Electronic Arts Inc.
|
||||
#
|
||||
# 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
|
||||
#***************************************************************************
|
||||
#** C O N F I D E N T I A L --- W E S T W O O D S T U D I O S **
|
||||
#***************************************************************************
|
||||
#* *
|
||||
#* Project Name : Westwood Library .LIB makefile *
|
||||
#* *
|
||||
#* File Name : MAKEFILE *
|
||||
#* *
|
||||
#* Programmer : Julio R. Jerez *
|
||||
#* *
|
||||
#* Start Date : jan 24, 1994 *
|
||||
#* *
|
||||
#* *
|
||||
#*-------------------------------------------------------------------------*
|
||||
#* *
|
||||
#* Required environment variables: *
|
||||
#* WWFLAT = your root WWFLAT path *
|
||||
#* WWVCS = root directory for wwlib version control archive *
|
||||
#* WATCOM = your Watcom installation path *
|
||||
#* *
|
||||
#* Required changes to makefile: *
|
||||
#* PROJ_NAME = name of the library you're building *
|
||||
#* OBJECTS = list of objects in your library *
|
||||
#* *
|
||||
#* Optional changes to makefile: *
|
||||
#* PROJ_DIR = full pathname of your working directory *
|
||||
#* = full pathname where various file types live *
|
||||
#* *
|
||||
#***************************************************************************
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# Verify user's environment
|
||||
#---------------------------------------------------------------------------
|
||||
!ifndef %WWFLAT
|
||||
!error WWFLAT Environment var not configured.
|
||||
!endif
|
||||
|
||||
|
||||
!ifndef %WWVCS
|
||||
!error WWVCS Environment var not configured.
|
||||
!endif
|
||||
|
||||
!ifndef %WATCOM
|
||||
!error WATCOM Environment var not configured.
|
||||
!endif
|
||||
|
||||
|
||||
#===========================================================================
|
||||
# User-defined section: the user should tailor this section for each project
|
||||
#===========================================================================
|
||||
|
||||
PROJ_NAME = descmgmt
|
||||
PROJ_DIR = $(%WWFLAT)\$(PROJ_NAME)
|
||||
LIB_PATH = $(%WWFLAT)\lib
|
||||
|
||||
!include $(%WWFLAT)\project.cfg
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# Project-dependent variables
|
||||
#---------------------------------------------------------------------------
|
||||
OBJECTS = &
|
||||
descmgmt.obj &
|
||||
fgetsel.obj &
|
||||
fgetcs.obj &
|
||||
fgetds.obj &
|
||||
ffixsel.obj
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# Path macros: one path for each file type.
|
||||
# These paths are used to tell make where to find/put each file type.
|
||||
#---------------------------------------------------------------------------
|
||||
.asm: $(PROJ_DIR)
|
||||
.c: $(PROJ_DIR)
|
||||
.cpp: $(PROJ_DIR)
|
||||
.h: $(PROJ_DIR)
|
||||
.obj: $(PROJ_DIR)
|
||||
.lib: $(%WWFLAT)\lib
|
||||
.exe: $(PROJ_DIR)
|
||||
|
||||
#===========================================================================
|
||||
# Pre-defined section: there should be little need to modify this section.
|
||||
#===========================================================================
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# Tools/commands
|
||||
#---------------------------------------------------------------------------
|
||||
C_CMD = wcc386
|
||||
CPP_CMD = wpp386
|
||||
LIB_CMD = wlib
|
||||
LINK_CMD = wlink
|
||||
ASM_CMD = tasm32
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# Include & library paths
|
||||
# If LIB & INCLUDE are already defined, they are used in addition to the
|
||||
# WWLIB32 lib & include; otherwise, they're constructed from
|
||||
# BCDIR & TNTDIR
|
||||
#---------------------------------------------------------------------------
|
||||
LIBPATH = $(%WWFLAT)\LIB;$(%WATCOM)\LIB
|
||||
INCLUDEPATH = $(%WWFLAT)\INCLUDE;$(%WATCOM)\H
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# Implicit rules
|
||||
# Compiler:
|
||||
# ($< = full dependent with path)
|
||||
# Assembler:
|
||||
# output obj's are constructed from .obj: & the $& macro
|
||||
# ($< = full dependent with path)
|
||||
# tasm's cfg file is not invoked as a response file.
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
.c.obj: $(%WWFLAT)\project.cfg .AUTODEPEND
|
||||
$(C_CMD) $(CC_CFG) $<
|
||||
|
||||
.cpp.obj: $(%WWFLAT)\project.cfg .AUTODEPEND
|
||||
$(CPP_CMD) $(CC_CFG) $<
|
||||
|
||||
.asm.obj: $(%WWFLAT)\project.cfg
|
||||
$(ASM_CMD) $(ASM_CFG) $<
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# Default target: configuration files & library (in that order)
|
||||
#---------------------------------------------------------------------------
|
||||
all: $(LIB_PATH)\$(PROJ_NAME).lib .SYMBOLIC
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# Build the library
|
||||
# The original library is deleted by the librarian
|
||||
# Lib objects & -+ commands are constructed by substituting within the
|
||||
# $^@ macro (which expands to all target dependents, separated with
|
||||
# spaces)
|
||||
# Tlib's cfg file is not invoked as a response file.
|
||||
# All headers & source files are copied into WWFLAT\SRCDEBUG, for debugging
|
||||
#---------------------------------------------------------------------------
|
||||
$(LIB_PATH)\$(PROJ_NAME).lib: $(OBJECTS) objects.lbc
|
||||
copy *.h $(%WWFLAT)\include
|
||||
copy *.inc $(%WWFLAT)\include
|
||||
copy *.cpp $(%WWFLAT)\srcdebug
|
||||
copy *.asm $(%WWFLAT)\srcdebug
|
||||
$(LIB_CMD) $(LIB_CFG) $^@ @objects.lbc
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# Objects now have a link file which is NOT generated everytime. Instead
|
||||
# it just has its own dependacy rule.
|
||||
#---------------------------------------------------------------------------
|
||||
objects.lbc : $(OBJECTS)
|
||||
%create $^@
|
||||
for %index in ($(OBJECTS)) do %append $^@ +%index
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# Create the test directory and make it.
|
||||
#---------------------------------------------------------------------------
|
||||
test:
|
||||
mkdir test
|
||||
cd test
|
||||
copy $(%WWVCS)\$(PROJ_NAME)\test\vcs.cfg
|
||||
update
|
||||
wmake
|
||||
cd ..
|
||||
|
||||
#**************************** End of makefile ******************************
|
||||
|
Reference in New Issue
Block a user