my @obj_files;

### Do asm build ###
push(@obj_files, include_targets('asm/targets.pl'));
### End asm build ###

### Compile game ###
@targets = qw(
AM.cpp
ODPLAY.cpp
OGAMESET.cpp
ORAIN2.cpp
OSPRITE2.cpp
OUNITIF.cpp
OAI_ACT.cpp
ODYNARR.cpp
OGAMHALL.cpp
ORAIN3.cpp
OSPRITEA.cpp
OUNITIND.cpp
OAI_ACT2.cpp
ODYNARRB.cpp
OGAMMAIN.cpp
ORAWRES.cpp
OSPRTRES.cpp
OUNITM.cpp
OAI_ATTK.cpp
OEFFECT.cpp
OGAMMENU.cpp
OREBEL.cpp
OSPY.cpp
OUNITRES.cpp
OAI_BUIL.cpp
OERRCTRL.cpp
OGAMSCE2.cpp
OREGION.cpp
OSPY2.cpp
OUNITS.cpp
OAI_CAP2.cpp
OERROR.cpp
OGAMSCEN.cpp
OREGIONS.cpp
OSPYA.cpp
OU_CARA.cpp
OAI_CAPT.cpp
OEXPMASK.cpp
OGAMSING.cpp
OREMOTE.cpp
OSTR.cpp
OU_CARA2.cpp
OAI_DEFE.cpp
OFILE.cpp
OGENHILL.cpp
OREMOTE2.cpp
OSYS.cpp
OU_CARAS.cpp
OAI_DIPL.cpp
OFILETXT.cpp
OGENMAP.cpp
OREMOTEM.cpp
OSYS2.cpp
OU_CARAT.cpp
OAI_ECO.cpp
OFIRM.cpp
OGETA.cpp
OREMOTEQ.cpp
OSYS3.cpp
OU_CART.cpp
OAI_GRAN.cpp
OFIRM2.cpp
OGFILE.cpp
ORES.cpp
OTALKENG.cpp
OU_GOD.cpp
OAI_INFO.cpp
OFIRMA.cpp
OGFILE2.cpp
ORESDB.cpp
OTALKMSG.cpp
OU_GOD2.cpp
OAI_MAIN.cpp
OFIRMAI.cpp
OGFILE3.cpp
ORESX.cpp
OTALKRES.cpp
OU_MARI.cpp
OAI_MAR2.cpp
OFIRMDIE.cpp
OGFILEA.cpp
OROCK.cpp
OTECHRES.cpp
OU_MARI2.cpp
OAI_MAR3.cpp
OFIRMDRW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ER.cpp
ONEWSFRE.cpp
ONEWSSPA.cpp
ONEWSGER.cpp
OSPREDBG.cpp
OLONGLOG.cpp
ico.rc
);

@defines = qw( AMPLUS );
if (defined($debug) && $debug) {
  push (@defines, "DEBUG");
}

@includes = qw( include );
 
if (defined($wine_prefix)) {
  push (@includes, "$wine_prefix/include/wine/windows",
                   "$wine_prefix/include/wine/msvcrt");
}

if (defined($dxsdk_path)) {
  push (@includes, "$dxsdk_path/include");
}

push(@obj_files, build_targets(\@targets, \@includes, \@defines));
### End compile game ###

### Linking targets ###
@libs = qw(
  gdi32 ddraw msvcrt ole32 dinput dplayx dsound winmm
);

if (defined($dxsdk_path)) {
  push (@lib_dirs, "$dxsdk_path/lib");
}

link_exe ('7kaa-legacy.exe', \@obj_files, \@libs, \@lib_dirs);
### End linking ###
