#
#	Command & Conquer(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/>.
#

# Size of the program shape buffer (passed to MAKESHPS.EXE)
SHAPEBUFFSIZE = 20000

# Assign the paths
#
!if$d(DAVID)
ROOTDIR	= f:\projects\c&c\\
MAPDIR	= f:\projects\c&c\\
ROOTCODEDIR	= f:\projects\c&c\code\david
ROOTCDDIR	= f:\projects\c&c\cddavid\\
ROOTCDSDIR	= f:\projects\c&c\cddavid\\
ABSROOT = ..\\
WAVDIR  = f:\projects\c&c\audio\ingame\\
#WAVDIR  = r:\\
LANGDIR =
INGAMEDIR =ingame
VQADIR  = f:\projects\c&c\art\\
!else
!if$d(BARRY)
ROOTDIR	= f:\projects\c&c\\
MAPDIR	= c:\projects\c&c\\
ROOTCODEDIR	= f:\projects\c&c\code\barry
ROOTCDDIR	= s:\\
ROOTCDSDIR	= s:\\
ABSROOT = ..\\
#WAVDIR  = f:\projects\c&c\audio\ingame\\
WAVDIR  = r:\\
LANGDIR=\german
INGAMEDIR=german
VQADIR  = f:\projects\c&c\art\\
!else
ROOTDIR	= ..\\
MAPDIR	= ..\\
ROOTCODEDIR	= .\\
#ROOTCDDIR	= f:\projects\c&c95\cd\\
#ROOTCDSDIR	= f:\projects\c&c95\cd\\
#ROOTCDDIR       = f:\projects\c&c95\cd\japanese\\
#ROOTCDSDIR      = f:\projects\c&c95\cd\japanese\\
#ROOTCDSDIR	= v:\projects\c&c95\cdjapan\\
ROOTCDDIR      = ..\cd\\
ROOTCDSDIR     = ..\\
!if$d(SLAVE)
ABSROOT = $(SLAVE)
WAVDIR  = $(SLAVE)
VQADIR  = $(SLAVE)
!else
ABSROOT = ..\\
WAVDIR  = ..\audio\ingame\\	#..\\
VQADIR  = f:\projects\c&c\art\\
VQADIR  = f:\projects\c&c95\art\\
#VQADIR  = d:\\
!endif
LANGDIR = \\japan\\
#LANGDIR =
INGAMEDIR =ingame
!endif
!endif

.path.a6  = $(ABSROOT)code\cps\\			# Game formatted audio data
.path.a60 = $(ABSROOT)code\cps\\			# Game formatted audio data
.path.a61 = $(ABSROOT)code\cps\\			# Game formatted audio data
.path.a62 = $(ABSROOT)code\cps\\			# Game formatted audio data
.path.a63 = $(ABSROOT)code\cps\\			# Game formatted audio data
.path.a64 = $(ABSROOT)code\cps\\			# Game formatted audio data
.path.a6a = $(ABSROOT)code\cps\\			# Game formatted audio data
.path.a6j = $(ABSROOT)code\cps\\			# Game formatted audio data
.path.a8  = $(ABSROOT)code\cps\\			# Game formatted audio data
.path.a80 = $(ABSROOT)code\cps\\			# Game formatted audio data
.path.a81 = $(ABSROOT)code\cps\\			# Game formatted audio data
.path.a82 = $(ABSROOT)code\cps\\			# Game formatted audio data
.path.a83 = $(ABSROOT)code\cps\\			# Game formatted audio data
.path.a84 = $(ABSROOT)code\cps\\			# Game formatted audio data
.path.a8a = $(ABSROOT)code\cps\\			# Game formatted audio data
.path.a8j = $(ABSROOT)code\cps\\			# Game formatted audio data
.path.anm = $(ROOTDIR)art\$(INGAMEDIR)\\		# Raw animation file
.path.ash = .\\								# Autogenerated assembly header file
.path.asm = .\\								# Raw assembly file
.path.aud = $(ABSROOT)code\cps\\			# Game formatted audio data
.path.bin = $(MAPDIR)maps\\				# Scenario map data files.
.path.c   = .\\								# Raw C file
.path.dmo = $(ROOTCDSDIR)DEMO\\			# CD for Demo Version
.path.dm2 = $(ROOTCDSDIR)DEMO2\\		# CD for Demo Version
.path.exp = $(ROOTCDSDIR)COVERT\\		# CD #1 expansion missions
.path.cpp = .\\								# Raw C++ file
.path.cps = $(ROOTCODEDIR)cps\\			# Compressed art
.path.dat = $(ROOTCODEDIR)cps\\			# Generic data
.path.des = $(ROOTCODEDIR)cps\\			# Desert icons
.path.dip = $(ROOTCODEDIR)cps\\			# Generic compressed text (obsolete)
.path.eng = $(ROOTCODEDIR)cps\\			# English compressed text
.path.exe = $(ROOTDIR)run\\				# Executable (relative path from OBJ directory)
.path.fin = $(ROOTDIR)art\$(INGAMEDIR)\fin\\	# Finale source animation
.path.fnt = $(ROOTCODEDIR)cps\\			# Font (compressed)
.path.foc = $(ROOTDIR)audio\french\\	# French digitized voices
.path.fre = $(ROOTCODEDIR)cps\\			# French compressed text
.path.gdi = $(ROOTCODEDIR)cps\\			# Good guy compressed files
.path.ger = $(ROOTCODEDIR)cps\\			# German compressed text
.path.goc = $(ROOTDIR)audio\german\\	# German digitized voices
.path.h   = .\\								# C header file
.path.i   = .\\								# Assembly header
.path.icn = $(ROOTCODEDIR)cps\\			# Icon file (compressed)
.path.ini = $(MAPDIR)maps\\				# INI control files
.path.jp  = $(ROOTCODEDIR)cps\\			# Dinosaur compressed files
.path.jun = $(ROOTCODEDIR)cps\\			# Jungle icons
.path.juv = $(ABSROOT)code\cps\\			# Juvenile sound effects.
.path.lbm = $(ROOTDIR)art\$(INGAMEDIR)\\		# Source art (uncompressed)
.path.mak = .\\								# Shape making control file
.path.map = $(ROOTCODEDIR)cps\\			# Icon map data file
.path.mid = $(ROOTDIR)audio\mid\\		# Midi file
.path.cd1 = $(ROOTCDSDIR)CD1\\				# CD #1 (GDI)
.path.cd2 = $(ROOTCDSDIR)CD2\\				# CD #2 (NOD)
.path.mix = $(ROOTCDDIR)					# Mix-file location.
.path.mrf = $(ROOTCODEDIR)cps\\			# Palette morph data files
.path.nod = $(ROOTCODEDIR)cps\\			# Bad guy compressed files
.path.o   = obj\\								# Overlay object file
.path.obj = obj\\								# Object file
.path.out = .\\								# Temporary parser file.
.path.pak = $(ROOTDIR)run\\				# Packed file
.path.pal = $(ROOTCODEDIR)cps\\			# Palette file (processed)
.path.shp = $(ROOTCODEDIR)cps\\			# Shape file (processed)
.path.sym = .\\								# Precompiled header symbol file.
.path.tbl = $(ROOTCODEDIR)cps\\	      # Remap table file.
.path.tem = $(ROOTCODEDIR)cps\\			# Temperate icons
.path.txt = $(ROOTDIR)eng\\				# Default location for text files.
.path.v00 = $(ABSROOT)code\cps\\			# Infantry response.
.path.v01 = $(ABSROOT)code\cps\\			# Infantry response.
.path.v02 = $(ABSROOT)code\cps\\			# Infantry response.
.path.v03 = $(ABSROOT)code\cps\\			# Infantry response.
.path.v04 = $(ABSROOT)code\cps\\			# Infantry response.
.path.v16 = $(ABSROOT)code\cps\\			# Game formatted audio data
.path.v8  = $(ABSROOT)code\cps\\			# Game formatted audio data
.path.vqa = $(VQADIR)movies$(LANGDIR)\\			# VQA movie files location.
.path.vqp = $(ABSROOT)code\cps\\			# VQA Movie Interpolated palette files
.path.wav = $(WAVDIR)						# Digitized sample file (generic)
.path.win = $(ROOTCODEDIR)cps\\			# Winter icons
.path.wsa = $(ROOTCODEDIR)cps\\			# Processed animation file
.path.wv  = $(ROOTDIR)audio\wv\\			# Digitized sample file (generic)
.path.xmi = $(ROOTDIR)audio\xmi\\		# MT-32 midi scores
.path.pcx = $(ROOTCODEDIR)cps\\			#.pcx files


##########################################################################
# Rules

#
# Rule for converting anim files.
#
.anm.wsa:
	utils\animate $*.anm $(.path.anm)$&.lbm $(.path.wsa)$&.wsa -l -f -p

#
# Rule for converting art files.
#
.lbm.cps:
	utils\wwcomp $*.lbm $(.path.cps)$&.cps -ex -i

#
# Rule for converting outtake first frame art files.
#
{$(.path.lbm)outtake}.lbm.cps:
	utils\wwcomp $*.lbm $(.path.cps)$&.cps -ex

{$(.path.anm)outtake}.anm.wsa:
	utils\animate $*.anm $(.path.anm)outtake\$&.lbm $(.path.wsa)$&.wsa -l -f -p

{$(.path.anm)score}.anm.wsa:
	utils\animate $*.anm $(.path.wsa)$&.wsa -p

{$(.path.anm)score\\$(LANGDIR)\\}.anm.wsa:
	utils\animate $*.anm $(.path.wsa)$&.wsa -p

#########################################################
# Rule for creating palette files.
#
{$(.path.lbm)palettes}.lbm.pal:
	utils\wwcomp $*.lbm -ppal
	copy $&.pal $(.path.pal)$&.pal
	del $&.pal

{$(.path.lbm)score}.lbm.pal:
	utils\wwcomp $*.lbm -ppal
	copy $&.pal $(.path.pal)$&.pal
	del $&.pal

#########################################################
# Rule for creating vehicles.
{$(.path.anm)units}.anm.shp:
	utils\keyframe $*.anm $(.path.shp)$&.shp -l

#########################################################
# Rule for creating buildings.
{$(.path.anm)building}.anm.shp:
	utils\keyframe $*.anm $(.path.shp)$&.shp -l

#########################################################
# Rule for creating misc shape animations.
{$(.path.anm)anim}.anm.shp:
	utils\keyframe $*.anm $(.path.shp)$&.shp -l

#########################################################
# Rule for converting font files.
{$(.path.lbm)fonts}.lbm.fnt:
	echo Creating font file "$&.fnt".
	utils\fontmake $*.lbm -o$(.path.fnt)$&.fnt

#########################################################
# Rules for creating overlay files.
{$(.path.lbm)overlay}.lbm.cps:
	utils\wwcomp $*.lbm $(.path.cps)$&.cps

{$(.path.anm)overlay}.anm.shp:
	utils\keyframe $*.anm $(.path.shp)$&.shp -l

#########################################################
# Rules for creating temperate files.
{$(.path.lbm)temperat\\$(LANGDIR)\\}.lbm.tem:
	utils\iconmap -r -w3 -o$(.path.tem)$&.tem $*.lbm

{$(.path.anm)temperat\\$(LANGDIR)\\}.anm.tem:
	utils\keyframe $*.anm $(.path.tem)$&.tem -l

#########################################################
# Rules for creating winter files.
{$(.path.lbm)winter\\$(LANGDIR)\\}.lbm.win:
	utils\iconmap -r -w3 -o$(.path.win)$&.win $*.lbm

{$(.path.anm)winter\\$(LANGDIR)\\}.anm.win:
	utils\keyframe $*.anm $(.path.win)$&.win -l

#########################################################
# Rules for creating desert files.
{$(.path.lbm)desert\\$(LANGDIR)\\}.lbm.des:
	utils\iconmap -r -w3 -o$(.path.des)$&.des $*.lbm

{$(.path.anm)desert\\$(LANGDIR)\\}.anm.des:
	utils\keyframe $*.anm $(.path.des)$&.des -l

#########################################################
# Rules for creating jungle files.
{$(.path.lbm)jungle}.lbm.jun:
	utils\iconmap -r -w3 -o$(.path.jun)$&.jun $*.lbm

{$(.path.anm)jungle}.anm.jun:
	utils\keyframe $*.anm $(.path.jun)$&.jun -l


#########################################################
# Generic icon file creation.
.lbm.icn:
	utils\iconmap -r -w3 -o$(.path.icn)$&.icn $*.lbm


#########################################################
# Text files.
{eng}.txt.eng:
	utils\textmake $*.txt $(.path.eng)$&.eng $&.h

{ger}.txt.ger:
	utils\textmake $*.txt $(.path.ger)$&.ger $&.h

{fre}.txt.fre:
	utils\textmake $*.txt $(.path.fre)$&.fre $&.h

#########################################################
# Score/mapsel files.
{$(.path.anm)score}.anm.shp:
	utils\keyframe $*.anm $(.path.shp)$&.shp -l

{$(.path.lbm)score}.lbm.cps:
	utils\wwcomp $*.lbm $(.path.cps)$&.cps -ex -i


#########################################################
# Generic shape files.
#.lbm.shp:
#	utils\makeshps -q $*.lbm $&.mak $(.path.cps)$&.shp $(SHAPEBUFFSIZE)

{$(.path.anm)generic}.anm.shp:
	utils\keyframe $*.anm $(.path.shp)$&.shp -l

.c.lob:
	utils\LINT -ml -si2 -sl4 +v $(WWLIB)WWLIB.LNT $*.c >$&.err

# Generic shape file creation.
{$(.path.anm)}.anm.shp:
	utils\keyframe $*.anm $(.path.shp)$&.shp -l

{$(.path.lbm)units}.lbm.cps:
	utils\wwcomp $*.lbm $(.path.cps)$&.cps -ex -i


##########################################################
# Hi-res shape files
#
{$(.path.anm)hires}.anm.shp:
	utils\keyframe $*.anm $(.path.shp)$&.shp -l
# Hi-res font files
{$(.path.lbm)hires}.lbm.fnt:
	echo Creating font file "$&.fnt".
	utils\fontmake $*.lbm -o$(.path.fnt)$&.fnt


###################################
# NOD data file creation rules.
{$(.path.anm)nod}.anm.nod:
	utils\keyframe $*.anm $(.path.nod)$&.nod -l

{$(.path.lbm)nod}.lbm.nod:
	utils\wwcomp $*.lbm $(.path.nod)$&.nod -ex -i

###################################
# GDI data file creation rules.
{$(.path.anm)gdi}.anm.gdi:
	utils\keyframe $*.anm $(.path.gdi)$&.gdi -l

{$(.path.lbm)gdi}.lbm.gdi:
	utils\wwcomp $*.lbm $(.path.gdi)$&.gdi -ex -i

###################################
# Dino data file creation rules.
{$(.path.anm)jp}.anm.jp:
	utils\keyframe $*.anm $(.path.jp)$&.jp -l

{$(.path.lbm)jp}.lbm.jp:
	utils\wwcomp $*.lbm $(.path.jp)$&.jp -ex -i

#######################################
# Rules to convert 8 bit audio files.
{$(.path.wav)audio8\scores\mono}.wav.a8:
	utils\audiomak $(.path.wav)audio8\scores\mono\$&.wav $(.path.aud)$&.a8

{$(.path.wav)audio8\scores\mono\olf}.wav.v8:
	utils\audiomak $(.path.wav)audio8\scores\mono\old\$&.wav $(.path.aud)$&.v8

{$(.path.wav)audio8\speech}.wav.a8:
	utils\audiomak $(.path.wav)audio8\speech\$&.wav $(.path.aud)$&.a8

{$(.path.wav)audio8\sfx\juvenile}.wav.a8j:
	utils\audiomak $(.path.wav)audio8\sfx\juvenile\$&.wav $(.path.juv)$&.a8j

{$(.path.wav)audio8\sfx\adult}.wav.a8a:
	utils\audiomak $(.path.wav)audio8\sfx\adult\$&.wav $(.path.aud)$&.a8a

{$(.path.wav)audio8\sfx\generic}.wav.a8:
	utils\audiomak $(.path.wav)audio8\sfx\generic\$&.wav $(.path.aud)$&.a8

{$(.path.wav)audio8\sfx\b&b}.wav.a8:
	utils\audiomak $(.path.wav)audio8\sfx\b&b\$&.wav $(.path.aud)$&.a8

{$(.path.wav)audio8\sfx\v00}.wav.a80:
	utils\audiomak $(.path.wav)audio8\sfx\v00\$&.wav $(.path.aud)$&.a80

{$(.path.wav)audio8\sfx\v01}.wav.a81:
	utils\audiomak $(.path.wav)audio8\sfx\v01\$&.wav $(.path.aud)$&.a81

{$(.path.wav)audio8\sfx\v02}.wav.a82:
	utils\audiomak $(.path.wav)audio8\sfx\v02\$&.wav $(.path.aud)$&.a82

{$(.path.wav)audio8\sfx\v03}.wav.a83:
	utils\audiomak $(.path.wav)audio8\sfx\v03\$&.wav $(.path.aud)$&.a83

{$(.path.wav)audio8\sfx\v04}.wav.a84:
	utils\audiomak $(.path.wav)audio8\sfx\v04\$&.wav $(.path.aud)$&.a84


#######################################
# Rules to convert 16 bit audio files.
{$(.path.wav)audio16\sfx\mobius$(LANGDIR)}.wav.a6:
	utils\audiomak $(.path.wav)audio16\sfx\mobius$(LANGDIR)\$&.wav $(.path.aud)$&.a6

{$(.path.wav)audio16\scores\mono}.wav.a6:
	utils\audiomak $(.path.wav)audio16\scores\mono\$&.wav $(.path.aud)$&.a6

{$(.path.wav)audio16\scores\mono\old}.wav.v16:
	utils\audiomak $(.path.wav)audio16\scores\mono\old\$&.wav $(.path.aud)$&.v16

{$(.path.wav)audio16\speech$(LANGDIR)}.wav.a6:
	utils\audiomak $(.path.wav)audio16\speech$(LANGDIR)\$&.wav $(.path.aud)$&.a6

{$(.path.wav)audio16\sfx\juvenile}.wav.a6j:
	utils\audiomak $(.path.wav)audio16\sfx\juvenile\$&.wav $(.path.juv)$&.a6j

{$(.path.wav)audio16\sfx\adult$(LANGDIR)}.wav.a6a:
	utils\audiomak $(.path.wav)audio16\sfx\adult$(LANGDIR)\$&.wav $(.path.aud)$&.a6a

{$(.path.wav)audio16\sfx\generic$(LANGDIR)}.wav.a6:
	utils\audiomak $(.path.wav)audio16\sfx\generic$(LANGDIR)\$&.wav $(.path.aud)$&.a6

{$(.path.wav)audio16\sfx\b&b$(LANGDIR)}.wav.a6:
	utils\audiomak $(.path.wav)audio16\sfx\b&b$(LANGDIR)\$&.wav $(.path.aud)$&.a6

{$(.path.wav)audio16\sfx\v00$(LANGDIR)}.wav.a60:
	utils\audiomak $(.path.wav)audio16\sfx\v00$(LANGDIR)\$&.wav $(.path.aud)$&.a60

{$(.path.wav)audio16\sfx\v01$(LANGDIR)}.wav.a61:
	utils\audiomak $(.path.wav)audio16\sfx\v01$(LANGDIR)\$&.wav $(.path.aud)$&.a61

{$(.path.wav)audio16\sfx\v02$(LANGDIR)}.wav.a62:
	utils\audiomak $(.path.wav)audio16\sfx\v02$(LANGDIR)\$&.wav $(.path.aud)$&.a62

{$(.path.wav)audio16\sfx\v03$(LANGDIR)}.wav.a63:
	utils\audiomak $(.path.wav)audio16\sfx\v03$(LANGDIR)\$&.wav $(.path.aud)$&.a63

{$(.path.wav)audio16\sfx\v04}.wav.a64:
	utils\audiomak $(.path.wav)audio16\sfx\v04\$&.wav $(.path.aud)$&.a64

