!if 0
Copyright (c) Microsoft Corporation.  All rights reserved.
!endif
!if 0
Use of this source code is subject to the terms of the Microsoft end-user
license agreement (EULA) under which you licensed this SOFTWARE PRODUCT.
If you did not accept the terms of the EULA, you are not authorized to use
this source code. For a copy of the EULA, please see the LICENSE.RTF on your
install media.
!endif

WINCEPROJ=common
#
# Include shared SYSGEN makefile
#
!INCLUDE $(_PUBLICROOT)\common\cesysgen\cesysgen.mak


!IFNDEF NK_COMPONENTS
NK_COMPONENTS=nkcompr nkmapfile
!ENDIF

!IFNDEF CORELIBC_COMPONENTS
CORELIBC_COMPONENTS=ccrtstrt
COREDLL_COMPONENTS=$(COREDLL_COMPONENTS) corecrt corestrw
!ENDIF

!IFNDEF FATFS_COMPONENTS
FATFS_COMPONENTS=fatmain fatui
!ENDIF

!IFNDEF DEVICE_COMPONENTS
DEVICE_COMPONENTS=devmain pmapi
!ENDIF

!IF "$(GWES_LANGID)" == ""
GWES_LANGID=.
!ENDIF
!IF "$(COREDLL_LANGID)" == ""
COREDLL_LANGID=.
!ENDIF
!IF "$(COMMCTRL_LANGID)" == ""
COMMCTRL_LANGID=.
!ENDIF

!IF "$(OS_COMPONENT_DIR)" == ""
OS_COMPONENT_DIR=$(_PUBLICROOT)\$(_TGTPROJ)\oak\lib\$(_CPUINDPATH)
!ENDIF

au1x00_drivers_ceddk = au1x00_ddk_dma au1x00_ddk_intr au1x00_ddk_io au1x00_ddk_map au1x00_ddk_stall
au1x00_drivers = au1x00_ethernet au1x00_gpio au1x00_cardserv au1x00_au16550 au1x00_sermouse au1x00_ausir au1x00_auusb au1x00_usbsl au1x00_wavemdd au1x00_wavepdd $(au1x00_drivers_ceddk)

au1x00_csp: $(au1x00_drivers)

preproc:makedirs corelibc fulllibc coredll driverlibs $(CE_MODULES) includes files tokens nls tools

postproc:$(COPY_OS_MODULES) $(REPLACE_MODULES) postlocalize

driverlibs:\
aablt emul emulrotate wrap2bpp wrap2dr wavemdd cardserv pcc_com tch_cal ser_card ser_card2 com_mdd com_mdd2 ser16550 ceosutil authhlp \
ddk_bus ddk_map ddk_io ddk_dma ddk_time ohcdmdd2 hcdlib uhcdmdd ntcompat bclib lci ldi loadauth mincrypt traverse cclib libc \
usbclient i486oal csp_mips csp_sh3 csp_sh4 csp_arm csp_arm720t csp_arm920t csp_sa11x0 csp_xscale \
SLCD2LIB sa11dma \
LayoutManager PS2_AT_00000409 PS2_AT_00000411 PS2_AT_00000412 PS2_AT_00010411 NumPadRmp \
InputLang_0409 InputLang_0411 InputLang_0412 KeybdIst PS2_8042_KbdCommon Nop_KbdCommon Nop_PddList \
SA11X1_KbdCommon sa11uart sa11ohci \
HD465irda HD465_KbdCommon HD465ccuart HD465ohcdpdd HD465wavedev \
Vr412x_serial VR4173_KbdCommon VR4173_KbdPddList Vr4173_wavedev Vr4173_touch Vr4173_ohci Vr4173_pcmcia vr4122_irsir Vr4122_irmacutl \
smc8xx_SCToVK ppc_lcd8xx \
swg ctblt rctblt drvgradfill rdrvgradfill gpe gperotate ddgpe dxdrvguid rndismini bthguid tchmdd tch_trns tchbasic battdrvr_lib kerbcomm pm_mdd_lib pm_battery_lib pm_default_pdd_lib pm_pda_pdd_lib pmstubs_lib $(au1x00_drivers)



tools:kd kd2 hd dbg ethdbg kitl kitleth ne2kdbg rtl8139dbg fetdbg dp83815dbg dec21140dbg am79c970dbg cs8900dbg vbridge vbridgestub smc9000 smsc100 net2890lib rne_mdd 3c90xdbg eboot blcommon bootpart memtool nkprof schedlog celog shimeng kcover PCIreg cecap \
fal ecclib sdnpcik stratak


rt_tests: iltiming osbench celogflush oscapture coversrv

# Empty rule to allow components target in sysgen
keybd pointer nled stansdk:

clean:
        @echo Cleaning up sysgen directories
        -@del $(DELRECURSEFLAG) $(DELFLAGS) $(SG_OUTPUT_SDKLIB)\*.* > nul $(SG_XCOPYREDIRECT)
        -@del $(DELRECURSEFLAG) $(DELFLAGS) $(SG_OUTPUT_OAKLIB)\*.* > nul $(SG_XCOPYREDIRECT)
        -@del $(DELRECURSEFLAG) $(DELFLAGS) $(SG_OUTPUT_OAKTGT)\*.* > nul $(SG_XCOPYREDIRECT)
        -@del $(DELFLAGS) $(SG_OUTPUT_ROOT)\sdk\inc\*.* > nul $(SG_XCOPYREDIRECT)
        -@del $(DELFLAGS) $(SG_OUTPUT_ROOT)\oak\inc\*.* > nul $(SG_XCOPYREDIRECT)
        -@del $(DELFLAGS) $(SG_OUTPUT_ROOT)\ddk\inc\*.* > nul $(SG_XCOPYREDIRECT)
        -@del $(DELFLAGS) $(SG_OUTPUT_ROOT)\oak\java\*.* > nul $(SG_XCOPYREDIRECT)
        -@del $(DELFLAGS) $(SG_OUTPUT_ROOT)\oak\files\*.* > nul $(SG_XCOPYREDIRECT)
        -@del $(DELFLAGS) $(SG_OUTPUT_ROOT)\oak\tokens\jpn\*.* > nul $(SG_XCOPYREDIRECT)
        -@del $(DELFLAGS) $(SG_OUTPUT_ROOT)\oak\tokens\ger\*.* > nul $(SG_XCOPYREDIRECT)
        -@del $(DELFLAGS) $(SG_OUTPUT_ROOT)\oak\tokens\*.* > nul $(SG_XCOPYREDIRECT)

makedirs:
        @echo Creating appropriate directories and deleting COMMON.LOC
        -@del $(DELFLAGS) $(SG_OUTPUT_OAKTGT)\*.loc > nul $(SG_XCOPYREDIRECT)
        -@xcopy /T /I *.* $(SG_OUTPUT_SDKLIB)
        -@xcopy /T /I *.* $(SG_OUTPUT_OAKLIB)
        -@xcopy /T /I *.* $(SG_OUTPUT_OAKTGT)
        -@xcopy /T /I *.* $(SG_OUTPUT_ROOT)\sdk\inc
        -@xcopy /T /I *.* $(SG_OUTPUT_ROOT)\oak\inc
        -@xcopy /T /I *.* $(SG_OUTPUT_ROOT)\ddk\inc
        -@xcopy /T /I *.* $(SG_OUTPUT_ROOT)\oak\java
        -@xcopy /T /I *.* $(SG_OUTPUT_ROOT)\oak\files
        -@xcopy /T /I *.* $(SG_OUTPUT_ROOT)\oak\tokens
        -@xcopy /T /I *.* $(SG_OUTPUT_ROOT)\ddk\lib\$(_CPUINDPATH)
        -@mkdir $(SG_OUTPUT_OAKTGT)\0409 > nul $(SG_XCOPYREDIRECT)


#
# At END of SYSGEN we recurse for each language in _LANGIDLIST to build
# the combined RESs for GWES & COREDLL once for each language.
# See comments below near GWES & COREDLL resp.
#

!IF "$(_LANGIDLIST)" != ""
$(_LANGIDLIST)::
        @set GWES_LANGID=$@
        $(MAKE) /NOLOGO gwes
        @set COREDLL_LANGID=$@
        $(MAKE) /NOLOGO coredll
!IF EXIST($(SG_OUTPUT_SDKLIB)\commctrl.lib)
        @set COMMCTRL_LANGID=$@
        $(MAKE) /NOLOGO commctrl
!ENDIF

# !IF "$(WINCEREL)" == "1"
#       -@echo WINCEREL set--Copying GWES/COREDLL resources from $(SG_OUTPUT_OAKTGT)\$@ to $(_FLATRELEASEDIR)\$@
#       -@xcopy /I $(SG_OUTPUT_OAKTGT)\$@\gwes.res $(_FLATRELEASEDIR)\$@ > nul
#       -@xcopy /I $(SG_OUTPUT_OAKTGT)\$@\coredll.res $(_FLATRELEASEDIR)\$@ > nul
# !ENDIF
!ENDIF

#
# These are parts of the sysgen process not associated with any modules. They are
# always run.

includes:
        @echo Processing include files
        $(SG_TOKENFILTER) $(SG_INPUT_ROOT)\sdk\inc\*.* $(SG_OUTPUT_ROOT)\sdk\inc
        $(SG_TOKENFILTER) $(SG_INPUT_ROOT)\oak\inc\*.* $(SG_OUTPUT_ROOT)\oak\inc
        $(SG_TOKENFILTER) $(SG_INPUT_ROOT)\ddk\inc\*.* $(SG_OUTPUT_ROOT)\ddk\inc
        copy $(SG_OUTPUT_ROOT)\sdk\inc\ceconfig.h $(SG_OUTPUT_ROOT)\oak\files\ceconfig.h


fonts:

files:
        -@xcopy /D /I $(SG_INPUT_ROOT)\oak\files\*.lex $(SG_OUTPUT_ROOT)\oak\files
        -@xcopy /D /I $(SG_INPUT_ROOT)\oak\files\*.2bp $(SG_OUTPUT_ROOT)\oak\files
        -@xcopy /D /I $(SG_INPUT_ROOT)\oak\files\*.bmp $(SG_OUTPUT_ROOT)\oak\files
        -@xcopy /D /I $(SG_INPUT_ROOT)\oak\files\*.wav $(SG_OUTPUT_ROOT)\oak\files
        -@xcopy /D /I $(SG_INPUT_ROOT)\oak\files\*.p7b $(SG_OUTPUT_ROOT)\oak\files
        $(SG_TOKENFILTER) $(SG_INPUT_ROOT)\oak\files\common.* $(SG_OUTPUT_ROOT)\oak\files

tokens:
        -@xcopy /i /e /q /c /D $(SG_INPUT_ROOT)\oak\tokens $(SG_OUTPUT_ROOT)\oak\tokens
        -@xcopy /i /e /q /c /D $(SG_INPUT_ROOT)\oak\files\intltrns $(SG_OUTPUT_ROOT)\oak\files\intltrns

remove:

crt_cpp_seh:

crt_rtti:

NLSSRC=$(SG_INPUT_ROOT)\oak\files\

$(SG_OUTPUT_ROOT)\oak\files\nlssrc.txt: \
        $(NLSSRC)\codepage.txt $(NLSSRC)\unicode.txt         \
        $(NLSSRC)\ctype.txt $(NLSSRC)\unisort.txt $(NLSSRC)\l_intl.txt
        -@copy $(NLSSRC)\codepage.txt+$(NLSSRC)\unicode.txt+$(NLSSRC)\ctype.txt+$(NLSSRC)\unisort.txt+$(NLSSRC)\l_intl.txt $(SG_OUTPUT_ROOT)\oak\files\nlssrc.txt /B

nlscopy: \
        $(NLSSRC)\437.txt $(NLSSRC)\708.txt $(NLSSRC)\720.txt $(NLSSRC)\737.txt $(NLSSRC)\775.txt  \
        $(NLSSRC)\850.txt $(NLSSRC)\852.txt $(NLSSRC)\855.txt $(NLSSRC)\857.txt $(NLSSRC)\860.txt  \
        $(NLSSRC)\861.txt $(NLSSRC)\862.txt $(NLSSRC)\863.txt $(NLSSRC)\864.txt $(NLSSRC)\865.txt  \
        $(NLSSRC)\866.txt $(NLSSRC)\869.txt $(NLSSRC)\874.txt $(NLSSRC)\932.txt $(NLSSRC)\936.txt  \
        $(NLSSRC)\949.txt $(NLSSRC)\950.txt $(NLSSRC)\1250.txt $(NLSSRC)\858.txt \
        $(NLSSRC)\20000.txt $(NLSSRC)\20001.txt $(NLSSRC)\20002.txt $(NLSSRC)\20003.txt $(NLSSRC)\20004.txt $(NLSSRC)\20005.txt \
        $(NLSSRC)\20127.txt $(NLSSRC)\20261.txt $(NLSSRC)\20866.txt $(NLSSRC)\21027.txt $(NLSSRC)\21866.txt $(NLSSRC)\29001.txt \
        $(NLSSRC)\20269.txt $(NLSSRC)\28591.txt $(NLSSRC)\28592.txt $(NLSSRC)\28593.txt $(NLSSRC)\28594.txt $(NLSSRC)\28595.txt \
        $(NLSSRC)\28596.txt $(NLSSRC)\28597.txt $(NLSSRC)\28598.txt $(NLSSRC)\28599.txt $(NLSSRC)\28605.txt \
        $(NLSSRC)\1251.txt $(NLSSRC)\1252.txt $(NLSSRC)\1253.txt                  \
        $(NLSSRC)\1254.txt $(NLSSRC)\1255.txt $(NLSSRC)\1256.txt                  \
        $(NLSSRC)\1257.txt $(NLSSRC)\1258.txt $(NLSSRC)\1361.txt                  \
        $(NLSSRC)\big5.txt $(NLSSRC)\ksc.txt $(NLSSRC)\prc.txt $(NLSSRC)\prcp.txt \
        $(NLSSRC)\xjis.txt $(NLSSRC)\bopomofo.txt $(NLSSRC)\nlscfg.inf $(NLSSRC)\locale.txt
        !xcopy /I /D /Q $? $(SG_OUTPUT_ROOT)\oak\files

nlsextra:

nls:$(SG_OUTPUT_ROOT)\oak\files\nlssrc.txt nlscopy nlsextra


!IF "$(COPY_OS_MODULES)" != ""
$(COPY_OS_MODULES):
    @echo copying $*_$(_TGTPROJ) to $*
    @copy $(OS_COMPONENT_DIR)\$*_$(_TGTPROJ).lib $(OS_COMPONENT_DIR)\$*.lib
    @copy $(OS_COMPONENT_DIR)\$*_$(_TGTPROJ).pdb $(OS_COMPONENT_DIR)\$*.pdb
    -@copy $(OS_COMPONENT_DIR)\$*_$(_TGTPROJ).res $(OS_COMPONENT_DIR)\$*.res
!ENDIF




#
# This part has the "sources" files for every componentized module. This part lists every
# component which is part of a module. There are some default rules to build actual dll/exes
# using a two phase link process so that you avoid picking imports from stub libraries
#
# GWES link modifications for Localization: We localize the individual GWES resources, not the
# combined resource file. This is because doing the latter is incompatible with component
# replacement, and is also harder for the loc folks.
#
# So the component selection & RES2RES step to build the big RES file has to happen once
# for EACH language. We first build the straight US RES & LIB, and then recurse for each language
#

gwe1 gwe2 gwe3 gwe4::
        echo $(GWE1_COMPONENTS)
        echo $(GWE2_COMPONENTS)
        echo $(GWE3_COMPONENTS)
        echo $(GWE4_COMPONENTS)
        @set SOURCELIBS=
gwe1::$(GWE1_COMPONENTS)
gwe2::$(GWE2_COMPONENTS)
gwe3::$(GWE3_COMPONENTS)
gwe4::$(GWE4_COMPONENTS)
gwe1 gwe2 gwe3 gwe4::
        @set TARGETNAME=$@
        @set RELEASETYPE=OAK
        @set TARGETLIBS=
        @set TARGETTYPE=LIBRARY
        $(MAKECMD) /NOLOGO $(SG_OUTPUT_OAKLIB)\$@.lib
        @set GWELIBS=%%GWELIBS%% $(SG_OUTPUT_OAKLIB)\$@.lib


# OEM can specify where to place their replaced components
!IF "$(REPLACE_ROOT)" == ""
REPLACE_ROOT=$(_PROJECTROOT)
!ENDIF

!IF "$(GWES_REPLACE)" != ""
$(GWES_REPLACE):
        @set GWELIBS=%%GWELIBS%% $(REPLACE_ROOT)\oak\lib\$(_CPUINDPATH)\$@.lib
        @set GWE_RESOURCES=%%GWE_RESOURCES%% $(REPLACE_ROOT)\oak\lib\$(_CPUINDPATH)\$(GWES_LANGID)\$@.res
!ENDIF

!IF "$(GWES_REPLACE_COMPONENTS)" != ""
$(GWES_REPLACE_COMPONENTS):
        @set GWELIBS=%%GWELIBS%% $(REPLACE_ROOT)\oak\lib\$(_CPUINDPATH)\$@.lib
!ENDIF

calibrui oomui menu startui notifpub msgbox_hpc msgbox_ppc gcacheview gcacheviewxp:
        @set SOURCELIBS=%%SOURCELIBS%% $(SG_INPUT_LIB)\$@.lib
        @set GWE_RESOURCES=%%GWE_RESOURCES%% $(SG_INPUT_LIB)\$(GWES_LANGID)\$@.res

cursor2 cursor8 mcursor1:
        @set GWE_RESOURCES=%%GWE_RESOURCES%% $(SG_INPUT_LIB)\$(GWES_LANGID)\$@.res

# Backward compatibility rule
mcursor8: mcursor1

# These are arranged in order of dependencies
ceptr wmbase immthunk gwesmain msgque gsetwinlong \
uibase accessib kbdui journal hotkey foregnd idle getpower nled msgbeep audio \
mgbase mgblt mgblt2 mgbitmap mgdc mgdibsec mgdraw mggradfill mggradfillstub mgpalmin mgrgn mgwinmgr mgrast mgrast2 decompdrv mgtt \
mgfntfix mgpal mgprint mgdrwtxt mgpalnat mgdx mgtci mgfe mgalias \
tchui iconcmn icon iconcurs \
atom winmgr defwndproc gcache nclientview nclientviewxp nclient sbcmnview sbcmnviewxp \
sbcmn syscolor loadimg loadbmp caret accel clipbd timer  \
gwectrl btnctl_tpc btnctlview btnctlviewxp btnctl cmbctlview cmbctlviewxp cmbctl cdlctl \
edctl EditControlOs EditControlPpc EditControlTpc edimefe edimefek EdImeFeTpc edimejpn edimechn edimekor imgctl lbctlview lbctlviewxp lbctl_ppc lbctl_tpc lbctl scbctl stcctlview \
stcctlviewxp stcctl cursor mcursor \
MouseCursorOnly TouchCursorOnly MouseAndTouchCursor msgbox msgbox_tpc column menu_hpc menu_ppc menu_tpc menuscrl menubc drawmbar mOverlap mNoOver mTapUI mNoTapUI cascade \
oom startup dlgmgr_hpc dlgmgr_ppc dlgmgr_tpc dlgmgr dlgmnem notify notifmin gweshare:
        @set SOURCELIBS=%%SOURCELIBS%% $(SG_INPUT_LIB)\$@.lib


gwes::
        @set GWELIBS=
        @set GWE_RESOURCES=dummy

gwes::$(GWES_REPLACE) $(GWES_REPLACE_COMPONENTS) $(GWES_COMPONENTS) ceosutil

gwes::
        @set TARGETTYPE=LIBRARY
        @set TARGETNAME=$@
        @set RELEASETYPE=OAK
        @set TARGETLIBS=
        @set SOURCELIBS=%%GWELIBS%% $(SG_OUTPUT_SDKLIB)\ceosutil.lib
        @set SOURCEPDBS=$(SG_INPUT_LIB)\mgdi.pdb
!IF "$(GWES_LANGID)" != "."
        echo %%GWE_RESOURCES%%
        -res2res -c %%GWE_RESOURCES%% -fo $(SG_OUTPUT_OAKTGT)\$(GWES_LANGID)\$@.res
!ELSE
        xcopy /I /D /Q $(SG_INPUT_LIB)\gwestubs.* $(SG_OUTPUT_OAKLIB)
        $(MAKECMD) /NOLOGO $(SG_OUTPUT_OAKLIB)\$@.lib
        echo %%GWE_RESOURCES%%
        res2res -c %%GWE_RESOURCES%% -fo $(SG_OUTPUT_OAKTGT)\0409\$@.res
!ENDIF

filesys::
        @set SOURCELIBS=
        @set TARGETLIBS=$(SG_OUTPUT_SDKLIB)\coredll.lib $(SG_INPUT_LIB)\rsa32.lib $(SG_INPUT_LIB)\fsstubs.lib $(SG_INPUT_LIB)\fsdnot.lib $(SG_INPUT_LIB)\$@.res

!IF "$(FILESYS_COMPONENTS)" != ""
$(FILESYS_COMPONENTS)::$(FILESYS_REPLACE_COMPONENTS)
        @set SOURCELIBS=%%SOURCELIBS%% $(SG_INPUT_LIB)\$@.lib
!ENDIF

!IF "$(FILESYS_REPLACE_COMPONENTS)" != ""
$(FILESYS_REPLACE_COMPONENTS)::
	@set SOURCELIBS=%%SOURCELIBS%% $(_PROJECTROOT)\oak\lib\$(_CPUINDPATH)\$@.lib
!ENDIF

filesys::$(FILESYS_COMPONENTS) $(FILESYS_REPLACE_COMPONENTS)
        @set TARGETNAME=$@
        @set RELEASETYPE=OAK
        @set EXEENTRY=WinMain
        $(MAKECMD) /NOLOGO $@.exe

!IF "$(PM_COMPONENTS)" != ""

pm::
        @set SOURCELIBS=
        @set TARGETLIBS=$(SG_OUTPUT_SDKLIB)\coredll.lib
        
pm_mdd pm_battery pm_default_pdd pm_pda_pdd pmstubs:
        @set SOURCELIBS=%%SOURCELIBS%% $(SG_INPUT_LIB)\$@_lib.lib
        
pm:: $(PM_COMPONENTS)
        @set RELEASETYPE=OAK
        @set TARGETTYPE=DYNLINK
        @set DLLENTRY=DllEntry
        @set DEFFILE=$(_COMMONOAKROOT)\inc\$@.def
        @set TARGETNAME=$@
        $(MAKECMD) /NOLOGO $(SG_OUTPUT_OAKTGT)\$@.dll

!ELSE   #  "$(PM_COMPONENTS)" != ""

pm::

!ENDIF #  "$(PM_COMPONENTS)" != ""

device:: pm
        @set SOURCELIBS=
        @set TARGETLIBS=$(SG_OUTPUT_SDKLIB)\coredll.lib

device::$(DEVICE_COMPONENTS)
        @set TARGETNAME=$@
        @set RELEASETYPE=OAK
        @set EXEENTRY=WinMain
        $(MAKECMD) /NOLOGO $@.exe

pmif::
        @set TARGETLIBS=%%TARGETLIBS%% $(SG_OUTPUT_OAKLIB)\pm.lib

devmain pmif nopmif::
        @set SOURCELIBS=%%SOURCELIBS%% $(SG_INPUT_LIB)\$@.lib


!IFNDEF FSDMGR_COMPONENTS
FSDMGR_COMPONENTS=fsdmain fsdserv storemgr fsdnot
!ENDIF

fsdmgr::
        @set SOURCELIBS=
        @set TARGETLIBS=$(SG_OUTPUT_SDKLIB)\coredll.lib
fsdmgr::$(FSDMGR_COMPONENTS)
        @set TARGETNAME=$@
        @set RELEASETYPE=OAK
        @set DLLENTRY=DllMain
        @set DEFFILE=$(SG_INPUT_LIB)\$@.def
        $(MAKECMD) /NOLOGO $@.dll
storemgr:
        @set SOURCELIBS=%%SOURCELIBS%% $(SG_INPUT_LIB)\$@.lib
        -@xcopy /D /I $(SG_INPUT_LIB)\storeapi.lib $(SG_OUTPUT_OAKLIB)
fsdmain:
        @set SOURCELIBS=%%SOURCELIBS%% $(SG_INPUT_LIB)\$@.lib
fsdserv:
        @set SOURCELIBS=%%SOURCELIBS%% $(SG_INPUT_LIB)\$@.lib
fsdnot:
        @set SOURCELIBS=%%SOURCELIBS%% $(SG_INPUT_LIB)\$@.lib


coredll::
        @set SOURCELIBS=
        @set COREDLL_RES=$(SG_INPUT_LIB)\$(COREDLL_LANGID)\coreres.res
coredll::$(COREDLL_REPLACE) $(COREDLL_REPLACE_COMPONENTS) $(COREDLL_MESSAGEDIALOGBOXCUSTOMIZE_COMPONENT) $(COREDLL_COMPONENTS)
        @set TARGETNAME=$@
        @set RELEASETYPE=SDK
        @set SOURCEPDBS=$(SG_INPUT_LIB)\mgdi.pdb
        @set DLLENTRY=CoreDllInit
!IF "$(COREDLL_LANGID)" != "."
        -res2res -c %%COREDLL_RES%% -fo $(SG_OUTPUT_OAKTGT)\$(COREDLL_LANGID)\$@.res
!ELSE
        res2res -c %%COREDLL_RES%% -fo $(SG_OUTPUT_OAKTGT)\0409\$@.res
        @set TARGETLIBS=$(SG_INPUT_LIB)\corestub.lib $(SG_OUTPUT_OAKTGT)\0409\$@.res
        $(MAKECMD) /NOLOGO $@.dll
!ENDIF


# COREDLL_REPLACE needs to come *before* the explict rules for coredll components. That way the
# first rule (i.e. this one) will get used when we are replacing.
#
# If we are doing coredll component replacement or have the Message/Dialog Box component,
# then coredll is being built for a 2nd time during
# postproc. However during preproc the coredll_all.lib was already built. We now need to force it
# to be rebuilt. We do this by deleting it. Ugh.

# Component and resource files.
!IF "$(COREDLL_REPLACE)" != ""
$(COREDLL_REPLACE):
        -@del $(DELFLAGS) $(SG_OUTPUT_OAKLIB)\coredll_ALL.lib > nul $(SG_XCOPYREDIRECT)
        @set SOURCELIBS=%%SOURCELIBS%% $(_PROJECTROOT)\oak\lib\$(_CPUINDPATH)\$@.lib
        @set COREDLL_RES=%%COREDLL_RES%% $(_PROJECTROOT)\oak\lib\$(_CPUINDPATH)\$(COREDLL_LANGID)\$@.res
!ENDIF

# Component only, no resource files.
!IF "$(COREDLL_REPLACE_COMPONENTS)" != ""
$(COREDLL_REPLACE_COMPONENTS):
        -@del $(DELFLAGS) $(SG_OUTPUT_OAKLIB)\coredll_ALL.lib > nul $(SG_XCOPYREDIRECT)
        @set SOURCELIBS=%%SOURCELIBS%% $(_PROJECTROOT)\oak\lib\$(_CPUINDPATH)\$@.lib
!ENDIF

# Message/Dialog Box component.
!IF "$(COREDLL_MESSAGEDIALOGBOXCUSTOMIZE_COMPONENT)" != ""
$(COREDLL_MESSAGEDIALOGBOXCUSTOMIZE_COMPONENT):
        -@del $(DELFLAGS) $(SG_OUTPUT_OAKLIB)\coredll_ALL.lib > nul $(SG_XCOPYREDIRECT)
        @set SOURCELIBS=%%SOURCELIBS%% $(SG_INPUT_LIB)\$@.lib
!ENDIF

## The components of COREDLL ##
coremain coreloc locusa lmem thunks fiber serdev devload rectapi wmgr_c accel_c tapilib mmacm mmacmui mmwave mmsnd mmmix fmtmsg cryptapi rsa32 mgdi_c fpemul corecrt coreimm coreimmstub coregwestub coresip asyncio multiui messagedialogboxthunk devmgmt fileinfo:
        @set SOURCELIBS=%%SOURCELIBS%% $(SG_INPUT_LIB)\$@.lib
## Filter only components of COREDLL, these filter in/out features from coredll.def
full_crt nostrsafe muireg secloader crypthash:

## Mini version of locale support.  Uses LocUSA but restricts the API's supported
locmini:
        @set SOURCELIBS=%%SOURCELIBS%% $(SG_INPUT_LIB)\locusa.lib

# These components have RES files that go with them
shexec shcore shortcut shmisc fileopen:
        @set SOURCELIBS=%%SOURCELIBS%% $(SG_INPUT_LIB)\$@.lib
        @set COREDLL_RES=%%COREDLL_RES%% $(SG_INPUT_LIB)\$(COREDLL_LANGID)\$@.res
# These components have ONLY RES files
fmtres:
        @set COREDLL_RES=%%COREDLL_RES%% $(SG_INPUT_LIB)\$(COREDLL_LANGID)\$@.res
# These components are used for filtering in sysgen. They aren't real libs ...
shellapis corestra corestrw coresioa coresiow battery:


corelibc::
        @set SOURCELIBS=
		@xcopy $(SG_INPUT_LIB)\ccrt*.pdb $(SG_OUTPUT_OAKLIB)
		@xcopy $(SG_INPUT_LIB)\strsafea.pdb $(SG_OUTPUT_OAKLIB)
corelibc::$(CORELIBC_COMPONENTS)
        @set TARGETNAME=$@
        @set RELEASETYPE=SDK
        @set TARGETLIBS=
        @set SOURCEPDBS=
        @set TARGETTYPE=LIBRARY
        $(MAKECMD) /NOLOGO $(SG_OUTPUT_SDKLIB)\$@.lib
ccrtstrt:
        @set SOURCELIBS=%%SOURCELIBS%% $(SG_INPUT_LIB)\$@.lib

ws2::
        @set SOURCELIBS=$(SG_INPUT_LIB)\ws2.lib
ws2::$(WS2_COMPONENTS)
        @set TARGETNAME=$@
        @set RELEASETYPE=SDK
        @set TARGETLIBS=$(SG_OUTPUT_SDKLIB)\coredll.lib
        @set DLLENTRY=dllentry
        $(MAKECMD) /NOLOGO $@.dll

winsock::ws2
        @set SOURCELIBS=$(SG_INPUT_LIB)\winsock.lib $(SG_OUTPUT_SDKLIB)\ws2.lib
winsock::$(WINSOCK_COMPONENTS)
        @set TARGETNAME=$@
        @set RELEASETYPE=SDK
        @set TARGETLIBS=$(SG_OUTPUT_SDKLIB)\coredll.lib
        @set DLLENTRY=dllentry
        $(MAKECMD) /NOLOGO $@.dll
sslsock:
        @set SOURCELIBS=%%SOURCELIBS%% $(SG_INPUT_LIB)\$@.lib

cxport::
        @set SOURCELIBS=$(SG_INPUT_LIB)\cxport.lib
cxport::$(CXPORT_COMPONENTS)
        @set TARGETNAME=$@
        @set RELEASETYPE=SDK
        @set TARGETLIBS=$(SG_OUTPUT_SDKLIB)\coredll.lib
        @set DLLENTRY=dllentry
        $(MAKECMD) /NOLOGO $@.dll

dubftp:
        @set SOURCELIBS=%%SOURCELIBS%% $(SG_INPUT_LIB)\$@.lib

audevman:
        @set TARGETNAME=$@
        @set RELEASETYPE=OAK
        @set TARGETLIBS=$(SG_OUTPUT_SDKLIB)\coredll.lib
        @set DLLENTRY=DllMain
        @set SOURCELIBS=$(SG_INPUT_LIB)\audevman.lib $(SG_INPUT_LIB)\swmixer.lib
        @set TARGETTYPE=DYNLINK
        @set DEFFILE=$(SG_INPUT_LIB)\$@.def
        $(MAKECMD) /NOLOGO $(SG_OUTPUT_OAKTGT)\$@.dll

## The possible components of WaveAPI ##
wapiwave wapiacm wapiacmui wapimap:
        @set SOURCELIBS=%%SOURCELIBS%% $(SG_INPUT_LIB)\$@.lib

waveapi:: audevman
waveapi::
        @set SOURCELIBS=
        -@del $(DELFLAGS) $(SG_OUTPUT_OAKLIB)\$@_ALL.lib > nul $(SG_XCOPYREDIRECT)

waveapi:: $(WAVEAPI_COMPONENTS)
        @set TARGETNAME=$@
        @set RELEASETYPE=OAK
        @set DLLENTRY=WaveApiDllEntry
        @set TARGETLIBS=%%TARGETLIBS%% $(SG_OUTPUT_OAKLIB)\audevman.lib
        @set TARGETLIBS=%%TARGETLIBS%% $(SG_INPUT_LIB)\wapistub.lib
!IF "$(WAVEAPI_REPLACE)" != ""
        @echo Replacing the WaveAPI UI!
        @set SOURCELIBS=%%SOURCELIBS%% $(_PROJECTROOT)\oak\lib\$(_CPUINDPATH)\waveui.lib $(_PROJECTROOT)\oak\lib\$(_CPUINDPATH)\$@.res
!ELSE
        @set SOURCELIBS=%%SOURCELIBS%% $(SG_INPUT_LIB)\waveui.lib
!ENDIF
        @set TARGETTYPE=DYNLINK
        @set DEFFILE=$(SG_INPUT_LIB)\$@.def
        $(MAKECMD) /NOLOGO $@.dll

btd::ceosutil bthguid $(BTD_DRIVERS)
        @set SOURCELIBS=
btd::$(BTD_COMPONENTS)
        @set TARGETNAME=$@
        @set RELEASETYPE=SDK
        @set TARGETLIBS=$(SG_INPUT_LIB)\cclib.lib $(SG_OUTPUT_SDKLIB)\ceosutil.lib $(SG_OUTPUT_SDKLIB)\coredll.lib $(SG_OUTPUT_SDKLIB)\bthguid.lib $(SG_INPUT_LIB)\btstubs.lib
        @set DLLENTRY=_DllMainCRTStartup
        $(MAKECMD) /NOLOGO $@.dll
hci:
        @set SOURCELIBS=%%SOURCELIBS%% $(SG_INPUT_LIB)\bthci.lib
l2cap:
        @set SOURCELIBS=%%SOURCELIBS%% $(SG_INPUT_LIB)\l2cap.lib
sdp:
        @set SOURCELIBS=%%SOURCELIBS%% $(SG_INPUT_LIB)\sdpbase.lib $(SG_INPUT_LIB)\sdpparse.lib
rfcomm:
        @set SOURCELIBS=%%SOURCELIBS%% $(SG_INPUT_LIB)\rfcomm.lib
portemu:
        @set SOURCELIBS=%%SOURCELIBS%%
tdi:
        @set SOURCELIBS=%%SOURCELIBS%% $(SG_INPUT_LIB)\bttdi.lib
sys:
        @set SOURCELIBS=%%SOURCELIBS%% $(SG_INPUT_LIB)\btsysd.lib
uart:
        @set SOURCELIBS=%%SOURCELIBS%% $(SG_INPUT_LIB)\bthuart.lib
amb:
        @set SOURCELIBS=%%SOURCELIBS%% $(SG_INPUT_LIB)\bthamb.lib
sc:
        @set SOURCELIBS=%%SOURCELIBS%% $(SG_INPUT_LIB)\bthsc.lib
csr:
        @set SOURCELIBS=%%SOURCELIBS%% $(SG_INPUT_LIB)\bcsp.lib
usb:
        @set SOURCELIBS=%%SOURCELIBS%% $(SG_OUTPUT_OAKLIB)\bthusb.lib
univ:
        @set SOURCELIBS=%%SOURCELIBS%% $(SG_OUTPUT_OAKLIB)\bthuniv.lib

btaudiogw::btdrt
        @set SOURCELIBS=$(SG_INPUT_LIB)\$@.lib
btaudiogw::$(BTAUDIOGW_COMPONENTS)
        @set TARGETNAME=$@
        @set RELEASETYPE=SDK
        @set TARGETLIBS=$(SG_OUTPUT_SDKLIB)\coredll.lib $(SG_OUTPUT_OAKLIB)\btdrt.lib 
        @set DLLENTRY=_DllMainCRTStartup
        $(MAKECMD) /NOLOGO $@.dll
bthsagw_ce bthsagw_mdd:
        @set SOURCELIBS=%%SOURCELIBS%% $(SG_INPUT_LIB)\$@.lib

tchmdd::
        @set TARGETTYPE=LIBRARY
        @set TARGETNAME=$@
        @set RELEASETYPE=OAK
        @set TARGETLIBS=
!IFDEF SYSGEN_TRANSCRIBER
        @set SOURCELIBS=$(SG_INPUT_LIB)\tchmain.lib $(SG_INPUT_LIB)\tch_trns.lib
        echo touch includes transcriber hooks
!ELSE
        @set SOURCELIBS=$(SG_INPUT_LIB)\tchmain.lib $(SG_INPUT_LIB)\tchbasic.lib
        echo touch is minimal
!ENDIF
        $(MAKECMD) /NOLOGO $(SG_OUTPUT_OAKLIB)\$@.lib

#
#
# These are all the modules which are not componentized at all. They are simply copied over
# as part of the sysgen process
#

nkcompr nknocomp nkmapfile nknomapfile::
        set NKLIBS=%%NKLIBS%% $(SG_INPUT_LIB)\$@.lib

nk::
        set NKLIBS=

nk::$(NK_COMPONENTS)
        set TARGETTYPE=LIBRARY
        set TARGETNAME=$@
        set RELEASETYPE=OAK
        set TARGETLIBS=
        set SOURCELIBS=%%NKLIBS%% $(SG_INPUT_LIB)\nkmain.lib
        $(MAKECMD) /NOLOGO $(SG_OUTPUT_OAKLIB)\$@.lib

nkprof::nk
        set TARGETTYPE=LIBRARY
        set TARGETNAME=$@
        set RELEASETYPE=OAK
        set TARGETLIBS=
        set SOURCELIBS=%%NKLIBS%% $(SG_INPUT_LIB)\nkprmain.lib
        $(MAKECMD) /NOLOGO $(SG_OUTPUT_OAKLIB)\$@.lib

httplite:: ws2
    @set SOURCELIBS=$(SG_INPUT_LIB)\httplite.lib
httplite::$(HTTPLITE_COMPONENTS)
    @set TARGETNAME=$@
    @set RELEASETYPE=SDK
    @set TARGETLIBS=$(SG_OUTPUT_SDKLIB)\coredll.lib $(SG_OUTPUT_SDKLIB)\ws2.lib $(SG_INPUT_LIB)\httplstb.lib
    @set DLLENTRY=_DllMainCRTStartup
    $(MAKE) /NOLOGO $@.dll
httpftp:
      @set SOURCELIBS=%%SOURCELIBS%% $(SG_INPUT_LIB)\$@.lib


wceload inetcore dubftps \
smc8xx_SCToVK ppc_lcd8xx \
LayoutManager PS2_AT_00000409 PS2_AT_00000411 PS2_AT_00000412 PS2_AT_00010411 NumPadRmp \
InputLang_0409 InputLang_0411 InputLang_0412 KeybdIst PS2_8042_KbdCommon Nop_KbdCommon Nop_PddList \
Vr412x_serial  VR4173_KbdCommon VR4173_KbdPddList Vr4173_wavedev Vr4173_touch Vr4173_ohci Vr4173_pcmcia vr4122_irsir Vr4122_irmacutl \
HD465irda HD465_KbdCommon HD465ccuart HD465ohcdpdd HD465wavedev \
SLCD2LIB sa11dma SA11X1_KbdCommon sa11uart sa11ohci \
fulllibc \
acmdwrap \
kd kd2 hd dbg ethdbg kitl kitleth ne2kdbg rtl8139dbg fetdbg dp83815dbg dec21140dbg am79c970dbg 3c90xdbg cs8900dbg vbridge vbridgestub smc9000 smsc100 net2890lib rne_mdd blcommon bootpart eboot dsif dsound schedlog celog shimeng kcover \
PCIreg \
fal ecclib sdnpcik stratak \
loadauth mincrypt traverse \
watapi wcdrom wdisk wudfs ksguid dvdif wserial \
ntcompat bclib lci ldi cclib libc cefrtl bthguid kerbcomm \
pcmconv:
        @echo Copying $@.*
        -@xcopy /I /D /Q $(SG_INPUT_LIB)\$@.* $(SG_OUTPUT_OAKLIB) > nul $(SG_XCOPYREDIRECT)
        -@xcopy /I /D /Q $(SG_INPUT_ROOT)\oak\target\$(_CPUINDPATH)\$@.* $(SG_OUTPUT_OAKTGT) > nul $(SG_XCOPYREDIRECT)
        -@xcopy /I /D /Q $(SG_INPUT_ROOT)\sdk\lib\$(_CPUINDPATH)\$@.* $(SG_OUTPUT_SDKLIB) > nul $(SG_XCOPYREDIRECT)

ceosutil authhlp cecap::
        @echo Copying $@.*
        -@xcopy /I /D /Q $(SG_INPUT_LIB)\$@.* $(SG_OUTPUT_OAKLIB) > nul $(SG_XCOPYREDIRECT)
        -@xcopy /I /D /Q $(SG_INPUT_LIB)\$@.* $(SG_OUTPUT_SDKLIB) > nul $(SG_XCOPYREDIRECT)


# different rules for signed components depending on whether we want to build them or copy the checked-in binaries
!IFDEF  __SYSGEN_BUILDCSPS
rsabase rsaenh::
	@set TARGETLIBS=$(SG_INPUT_LIB)\$@.lib $(SG_INPUT_LIB)\$@.res $(SG_INPUT_LIB)\rsa32.lib $(SG_OUTPUT_SDKLIB)\coredll.lib
        @set DLLENTRY=DllEntry

dssdh::
	@set TARGETLIBS=$(SG_INPUT_LIB)\$@.lib $(SG_INPUT_LIB)\$@.res $(SG_INPUT_LIB)\bignum.lib $(SG_OUTPUT_SDKLIB)\coredll.lib $(SG_INPUT_LIB)\rsa32.lib
        @set DLLENTRY=DllEntry

scwcsp::winscard scwapi
	@set TARGETLIBS=$(SG_INPUT_LIB)\$@.lib $(SG_INPUT_LIB)\$@.res $(SG_OUTPUT_SDKLIB)\winscard.lib $(SG_OUTPUT_SDKLIB)\scwapi.lib $(SG_OUTPUT_SDKLIB)\coredll.lib
        @set DLLENTRY=_DllMainCRTStartup

rsabase rsaenh dssdh scwcsp::
        @set RELEASETYPE=OAK
        @set TARGETTYPE=DYNLINK
        @set DEFFILE=$(SG_INPUT_LIB)\$@.def
        @set SOURCELIBS=
        @set TARGETNAME=$@
        $(MAKECMD) /NOLOGO $(SG_OUTPUT_OAKTGT)\$@.dll
!ELSE

rsabase rsaenh dssdh scwcsp:
        @echo Copying $@.*
        -@xcopy /I /D /Q $(SG_INPUT_ROOT)\oak\target\$(_CPUINDPATH)\$@.* $(SG_OUTPUT_OAKTGT) > nul $(SG_XCOPYREDIRECT)	
!ENDIF

#
# The driver library components
#
csp_mips csp_sh3 csp_sh4 csp_arm csp_arm720t csp_arm920t csp_sa11x0 csp_xscale i486oal aablt wrap2bpp wrap2dr swg ddgpe dxdrvguid wavemdd tch_trns tchbasic tch_cal cardserv pcc_com ser_card ser_card2 com_mdd com_mdd2 ser16550 ddk_bus ddk_map ddk_io ddk_dma ddk_time hcdlib ohcdmdd2 uhcdmdd usbclient rndismini pm_mdd_lib pm_battery_lib pm_default_pdd_lib pm_pda_pdd_lib pmstubs_lib battdrvr_lib $(au1x00_drivers):
        @echo Copying $@.*
        -@xcopy /I /D /Q $(SG_INPUT_LIB)\$@.* $(SG_OUTPUT_OAKLIB) > nul $(SG_XCOPYREDIRECT)

#
# This is a special rule for commctrl which has its DEF file filtered for componentization and
# can be linked with either the 9x or the XP style UI
#
!IF "$(COMMCTRL_LOGIC)" == ""
COMMCTRL_LOGIC=commctrl_hpc
!ENDIF
!IF "$(COMMCTRL_SKIN)" == ""
COMMCTRL_SKIN=commctrlview
!ENDIF

commctrlview::
	@set SOURCELIBS=$(SG_INPUT_LIB)\commctrlview.lib $(SG_INPUT_LIB)\$(COMMCTRL_LOGIC).lib
!IF "$(COMMCTRL_LANGID)" != "."
	res2res -c $(SG_INPUT_LIB)\$(COMMCTRL_LANGID)\commctrlbase.res -fo $(SG_OUTPUT_OAKTGT)\$(COMMCTRL_LANGID)\commctrl.res
!ELSE
	res2res -c $(SG_INPUT_LIB)\$(COMMCTRL_LANGID)\commctrlbase.res -fo $(SG_OUTPUT_OAKTGT)\0409\commctrl.res
!ENDIF

commctrlviewxp::
	@set SOURCELIBS=$(SG_INPUT_LIB)\commctrlviewxp.lib $(SG_INPUT_LIB)\commctrlviewxp.res $(SG_INPUT_LIB)\$(COMMCTRL_LOGIC).lib
!IF "$(COMMCTRL_LANGID)" != "."
	res2res -c $(SG_INPUT_LIB)\$(COMMCTRL_LANGID)\commctrlbase.res $(SG_INPUT_LIB)\commctrlviewxp.res -fo $(SG_OUTPUT_OAKTGT)\$(COMMCTRL_LANGID)\commctrl.res
!ELSE
	res2res -c $(SG_INPUT_LIB)\$(COMMCTRL_LANGID)\commctrlbase.res $(SG_INPUT_LIB)\commctrlviewxp.res -fo $(SG_OUTPUT_OAKTGT)\0409\commctrl.res
!ENDIF


#
# Obsolete modules, or components of modules.
#
math pinglib gwestubs dbgu dbgt nloaddbg cursors miscfunc mainusrq touch demodisp \
vbsen jsen mgdi_s netdetec mgjfonts jscript vbscript consolej arp loadstr:
        @echo WARNING: $@ is no longer part of the OAK. Please remove from your cesysgen.bat


#
# This is to allow backward compatibility additions of dummy targets so that we can change
# components while projects stay on old lkg's
#
!IF "$(_DISABLEBCMAKEFILE)" != "1"
!IF EXIST($(_PRIVATEROOT)\bat\bcsysgen.mak)
!INCLUDE $(_PRIVATEROOT)\bat\bcsysgen.mak
!ENDIF
!ENDIF


####################################################################################################
# These are modules which link as part of the sysgen phase, but are not componentized.
# This includes everything else in PRIVATE\WINCEOS except those that have explicit rules above
# When you add your module here, please follow the 4-step instructions laid down below.
####################################################################################################
#
# STEP1: List your dependencies (other things that must link before you in the sysgen phase) and
#        set your TARGETLIBS variable. List your link libs & RES files first and your import libs last
#        Don't list coredll.dll. It will be included by default. Don't set SOURCELIBS. It is not used
#        in this phase. Also note that all rules in this section must end in :: not :,  The only
#        exception is for rules that define artificial targets, such as export libraries from
#        components with circular dependencies (which should normally be avoided anyway).
#
# IMPORTANT: Don't forget to list your dependencies. Anything you list in TARGETLIBS that also builds
# in this makefile *must* be listed as a dependency. E.g. commctrl etc
#

## Some useful generic macros
OWNLIB=$(SG_INPUT_LIB)\$@.lib
OWNSTATICLIB=$(SG_INPUT_LIB)\$@_lib.lib
OWNRES=$(SG_INPUT_LIB)\$@.res
OWNLIB_RES=$(SG_INPUT_LIB)\$@.lib $(SG_INPUT_LIB)\$@.res
CCLIB=$(SG_OUTPUT_SDKLIB)\commctrl.lib
WINSOCKLIB=$(SG_OUTPUT_SDKLIB)\winsock.lib
WS2LIB=$(SG_OUTPUT_SDKLIB)\ws2.lib
OTHERS_ROOT=$(_WINCEROOT)\others

# Info file for wcetk.
wcetk:
        -@echo SERVERNAME=$(COMPUTERNAME) > $(SG_OUTPUT_ROOT)\oak\files\wcetk.txt
        @echo PORTNUMBER=5555 >> $(SG_OUTPUT_ROOT)\oak\files\wcetk.txt
        @echo AUTORUN=0 >> $(SG_OUTPUT_ROOT)\oak\files\wcetk.txt
        @echo DEFAULTSUITE= >> $(SG_OUTPUT_ROOT)\oak\files\wcetk.txt
        -@xcopy /I /D /Q $(OTHERS_ROOT)\wcetk\$(_TGTCPU)\clientside.exe $(SG_OUTPUT_OAKTGT)  > nul $(SG_XCOPYREDIRECT)
!IF "$(WINCEREL)" == "1"
        -@xcopy /I /D /Q $(SG_OUTPUT_ROOT)\oak\files\wcetk.txt $(_FLATRELEASEDIR)  > nul $(SG_XCOPYREDIRECT)
        -@xcopy /I /D /Q $(OTHERS_ROOT)\wcetk\$(_TGTCPU)\clientside.exe $(_FLATRELEASEDIR)  > nul $(SG_XCOPYREDIRECT)
!ENDIF

#
# Network/Comm stuff
#
NTCOMPATLIB=$(SG_INPUT_ROOT)\sdk\lib\$(_CPUINDPATH)\ntcompat.lib
CEDDKLIB=$(SG_OUTPUT_OAKLIB)\ceddk.lib
CXPORT_CCLIBS=$(SG_OUTPUT_SDKLIB)\cxport.lib $(SG_INPUT_LIB)\cclib.lib
NDISLIB=$(SG_OUTPUT_SDKLIB)\ndis.lib

## Determine whether to include PPP Server support
!IF "$(SYSGEN_PPP_SERVER)" == "1"
PPPSRVLIB=$(SG_INPUT_LIB)\ppp2srv.lib $(SG_OUTPUT_OAKLIB)\ntlmssp.lib
PPPSRVDEPENDS=ntlmssp
!ELSE
PPPSRVLIB=$(SG_INPUT_LIB)\ppp2srvstub.lib
PPPSRVDEPENDS=
!ENDIF

nspm::
        @set TARGETLIBS=$(OWNLIB)
wspm::
        @set TARGETLIBS=$(OWNLIB)
ws2instl:: ws2
        @set TARGETLIBS=$(OWNLIB) $(WS2LIB)
ndis:: ceddk
        @set TARGETLIBS=$(SG_INPUT_LIB)\ndislib.lib     $(NTCOMPATLIB) $(CEDDKLIB)
tcpip6:: cxport iphlpapi ndis
        @set TARGETLIBS=$(OWNLIB) $(SG_INPUT_LIB)\sys6.lib $(SG_INPUT_LIB)\tcp6.lib $(SG_INPUT_LIB)\udp6.lib \
        $(SG_INPUT_LIB)\ip6.lib $(SG_INPUT_LIB)\algrthm6.lib $(SG_OUTPUT_SDKLIB)\iphlpapi.lib $(NDISLIB) $(NTCOMPATLIB) $(CXPORT_CCLIBS)
tcpstk:: cxport ndis
        @set TARGETLIBS=$(OWNLIB) $(SG_INPUT_LIB)\tcp.lib $(SG_INPUT_LIB)\ip.lib $(NDISLIB) $(NTCOMPATLIB) $(CXPORT_CCLIBS)
ppp::   ndis cxport $(PPPSRVDEPENDS)
        @set TARGETLIBS=$(SG_INPUT_LIB)\ppp2app.lib $(SG_INPUT_LIB)\ppp2app.res $(SG_INPUT_LIB)\ppp2ncp.lib \
	$(SG_INPUT_LIB)\ppp2ccp.lib  $(SG_INPUT_LIB)\ppp2ipcp.lib $(SG_INPUT_LIB)\pppipv6cp.lib\
        $(SG_INPUT_LIB)\ppp2lcp.lib  $(SG_INPUT_LIB)\ppp2auth.lib $(SG_INPUT_LIB)\ppp2ras.lib \
	$(SG_INPUT_LIB)\ppp2ndis.lib $(PPPSRVLIB)  $(SG_OUTPUT_SDKLIB)\coredll.lib $(SG_INPUT_LIB)\rsa32.lib \
        $(CXPORT_CCLIBS) $(NTCOMPATLIB) $(NDISLIB)
pptp::  ndis cxport netmui
        @set TARGETLIBS=$(OWNLIB) $(SG_INPUT_LIB)\raspptp.lib $(CXPORT_CCLIBS) $(NTCOMPATLIB) $(WINSOCKLIB) $(NDISLIB)
l2tp::  ndis cxport iphlpapi ws2 ipsecsvc crypt32 netmui
        @set TARGETLIBS=$(OWNLIB) $(SG_INPUT_LIB)\l2tp.lib $(CXPORT_CCLIBS) $(NTCOMPATLIB) $(SG_OUTPUT_SDKLIB)\iphlpapi.lib $(WS2LIB) $(NDISLIB) $(SG_OUTPUT_SDKLIB)\crypt32.lib $(SG_OUTPUT_OAKLIB)\ipsecsvc.lib
pppoe:: ndis cxport
        @set TARGETLIBS=$(OWNLIB) $(CXPORT_CCLIBS) $(NTCOMPATLIB) $(NDISLIB)
eap::   cxport
        @set TARGETLIBS=$(OWNLIB) $(CXPORT_CCLIBS)
eapchap:: eap
        @set TARGETLIBS=$(OWNLIB) $(SG_OUTPUT_OAKLIB)\eap.lib $(SG_OUTPUT_SDKLIB)\coredll.lib $(SG_INPUT_LIB)\rsa32.lib $(CXPORT_CCLIBS)
eaptls::secur32 crypt32 eap
	@set TARGETLIBS=$(OWNLIB) $(SG_OUTPUT_OAKLIB)\eap.lib $(SG_OUTPUT_SDKLIB)\crypt32.lib $(SG_OUTPUT_SDKLIB)\secur32.lib $(CXPORT_CCLIBS)
eapol:: cxport eap
        @set TARGETLIBS=$(OWNLIB) $(SG_OUTPUT_OAKLIB)\eap.lib $(SG_OUTPUT_SDKLIB)\coredll.lib $(SG_INPUT_LIB)\rsa32.lib $(CXPORT_CCLIBS)
smsc100fd elnk3 sisnic ieepro dc21x4 xircce2 xircce3 rtl8139 dp83815 3c90x vmini tunmp pcx500:: ndis ceddk netmui
        @set TARGETLIBS=$(OWNLIB) $(CEDDKLIB) $(NDISLIB)
ne2000:: ndis ceddk ne2000isr netmui
        @set TARGETLIBS=$(OWNLIB) $(CEDDKLIB) $(NDISLIB)
islp2nds:: ndis ceddk
        @set TARGETLIBS=$(OWNLIB) $(CEDDKLIB) $(NDISLIB) $(SG_INPUT_LIB)\ndcwepssn.lib
net2890:: net2890lib ndis ceddk rndismini netmui
	@set TARGETLIBS=$(SG_OUTPUT_OAKLIB)\net2890lib.lib $(CEDDKLIB) $(NDISLIB) $(SG_OUTPUT_OAKLIB)\rndismini.lib
rndismp:: ndis ceddk ntcompat
        @set TARGETLIBS=$(OWNLIB) $(CEDDKLIB) $(NTCOMPATLIB) $(NDISLIB)
mbridge:: ndis cxport ceddk netmui
        @set TARGETLIBS=$(OWNLIB) $(SG_INPUT_LIB)\bridge.lib $(CEDDKLIB) $(NTCOMPATLIB) $(NDISLIB) $(CXPORT_CCLIBS)
ndispwr::
        @set TARGETLIBS=$(OWNLIB)
ndisuio:: ndis ceddk cxport
        @set TARGETLIBS=$(OWNLIB) $(SG_INPUT_LIB)\ndisuio.lib $(CEDDKLIB) $(NTCOMPATLIB) $(NDISLIB) $(CXPORT_CCLIBS)
wzcsapi::
        @set TARGETLIBS=$(OWNLIB)
zclog::
        @set TARGETLIBS=$(OWNLIB)
wzcsvc:: iphlpapi eapol cxport
        @set TARGETLIBS=$(OWNLIB) $(CXPORT_CCLIBS) $(SG_OUTPUT_SDKLIB)\iphlpapi.lib $(SG_OUTPUT_OAKLIB)\eapol.lib $(NTCOMPATLIB)

dot11emu:: ndis
        @set TARGETLIBS=$(OWNLIB) $(NDISLIB) $(SG_INPUT_LIB)\hw11.lib  $(SG_INPUT_LIB)\wlcrypto.lib $(SG_INPUT_LIB)\rsa32.lib

nwifi:: ndis
        @set TARGETLIBS=$(OWNLIB) $(NDISLIB) $(SG_INPUT_LIB)\ap.lib $(SG_INPUT_LIB)\sta.lib $(SG_INPUT_LIB)\wlcrypto.lib $(SG_INPUT_LIB)\rsa32.lib
wlclient::
        @set TARGETLIBS=$(OWNLIB) $(SG_INPUT_LIB)\wlshr.lib
wlsvc:: oneex
        @set TARGETLIBS=$(OWNLIB) $(SG_INPUT_LIB)\wlshr.lib $(SG_OUTPUT_OAKLIB)\oneex.lib
oneex:: wlclient crypt32 cxport
	@set TARGETLIBS=$(OWNLIB) $(SG_INPUT_LIB)\wlshr.lib $(SG_OUTPUT_OAKLIB)\wlclient.lib $(SG_OUTPUT_SDKLIB)\crypt32.lib $(CXPORT_CCLIBS) $(SG_INPUT_LIB)\rsa32.lib
autoras:: iphlpapi
        @set TARGETLIBS=$(OWNLIB) $(SG_OUTPUT_SDKLIB)\iphlpapi.lib $(WINSOCKLIB)
asyncmac:: ndis cxport netmui
        @set TARGETLIBS=$(OWNLIB) $(CXPORT_CCLIBS) $(NDISLIB)
redir:: cxport
        @set TARGETLIBS=$(OWNLIB) $(SG_INPUT_LIB)\browser.lib $(SG_INPUT_LIB)\rdrapi.lib $(SG_INPUT_LIB)\rdrnet.lib $(SG_INPUT_LIB)\libxy.lib $(SG_INPUT_LIB)\rsa32.lib $(SG_INPUT_LIB)\fsdnot.lib $(CXPORT_CCLIBS)
netbios dhcp:: cxport
        @set TARGETLIBS=$(OWNLIB) $(CXPORT_CCLIBS)
ipnat:: cxport
        @set TARGETLIBS=$(OWNLIB) $(SG_INPUT_LIB)\natlib.lib $(SG_INPUT_LIB)\dhcpallo.lib $(SG_INPUT_LIB)\natwdm.lib $(CXPORT_CCLIBS) $(WINSOCKLIB)
ipsec:: cxport ndis
        @set TARGETLIBS=$(OWNLIB) $(SG_INPUT_LIB)\mincrypt.lib $(NTCOMPATLIB) $(NDISLIB) $(SG_INPUT_LIB)\ipsecshr.lib $(SG_OUTPUT_SDKLIB)\coredll.lib $(SG_INPUT_LIB)\rsa32.lib
ipsecsvc:: ws2 iphlpapi crypt32
	@set TARGETLIBS=$(SG_INPUT_LIB)\ceipsec.lib $(SG_INPUT_LIB)\ipsecsvc.res $(SG_INPUT_LIB)\ipsecspd.lib $(SG_INPUT_LIB)\ipsecshr.lib $(SG_INPUT_LIB)\oakley.lib $(SG_INPUT_LIB)\ceosutil.lib $(SG_INPUT_LIB)\mincrypt.lib $(SG_OUTPUT_SDKLIB)\iphlpapi.lib $(SG_OUTPUT_SDKLIB)\ws2.lib $(SG_OUTPUT_SDKLIB)\crypt32.lib

fw6:: iphlpapi ws2
        @set TARGETLIBS=$(OWNLIB) $(WS2LIB) $(SG_OUTPUT_SDKLIB)\iphlpapi.lib

fwapi::
        @set TARGETLIBS=$(OWNLIB)

iphlpapi:: ws2
        @set TARGETLIBS=$(OWNLIB) $(WS2LIB)
irdastk:: irsir cxport
                @set TARGETLIBS=$(SG_INPUT_LIB)\irtdi.lib $(SG_INPUT_LIB)\irlap.lib $(SG_INPUT_LIB)\irlmp.lib $(SG_INPUT_LIB)\irutil.lib $(NTCOMPATLIB) $(NDISLIB) $(CXPORT_CCLIBS)
irsir:: ndis ceddk
        @set TARGETLIBS=$(SG_INPUT_LIB)\irsirlib.lib $(SG_INPUT_LIB)\irmacutl.lib $(CEDDKLIB) $(NDISLIB)
ircomm:: winsock
        @set TARGETLIBS=$(SG_INPUT_LIB)\ircomlib.lib $(WINSOCKLIB)
afd::   cxport
        @set TARGETLIBS=$(SG_INPUT_LIB)\afdlib.lib $(CXPORT_CCLIBS)
msasn1::
        @set TARGETLIBS=$(OWNLIB)
crypt32:: msasn1
                @set TARGETLIBS=$(OWNLIB_RES) $(SG_INPUT_LIB)\pkiutil.lib $(SG_INPUT_LIB)\certstor.lib $(SG_INPUT_LIB)\chain.lib $(SG_INPUT_LIB)\mincrypt.lib $(SG_OUTPUT_OAKLIB)\msasn1.lib
certui:: crypt32
    @set TARGETLIBS=$(OWNLIB_RES) $(SG_OUTPUT_SDKLIB)\commctrl.lib $(SG_OUTPUT_SDKLIB)\crypt32.lib
secur32::
        @set TARGETLIBS=$(SG_INPUT_LIB)\sspi.lib
schannel:: crypt32
        @set TARGETLIBS=$(SG_INPUT_LIB)\schnlc.lib  $(SG_INPUT_LIB)\spbase.lib $(SG_OUTPUT_SDKLIB)\coredll.lib $(SG_INPUT_LIB)\rsa32.lib $(SG_OUTPUT_SDKLIB)\crypt32.lib
ssllsp::
	@set TARGETLIBS=$(OWNLIB) $(SG_INPUT_LIB)\sslsock.lib
ntlmssp::
        @set TARGETLIBS=$(SG_INPUT_LIB)\ntlm.lib $(SG_OUTPUT_SDKLIB)\coredll.lib $(SG_INPUT_LIB)\rsa32.lib
cryptdll::
        @set TARGETLIBS=$(OWNLIB) $(SG_OUTPUT_SDKLIB)\coredll.lib $(SG_INPUT_LIB)\rsa32.lib
kerberos::cryptdll winsock msasn1
        @set TARGETLIBS=$(OWNLIB) $(SG_OUTPUT_OAKLIB)\msasn1.lib $(SG_OUTPUT_OAKLIB)\cryptdll.lib $(SG_OUTPUT_SDKLIB)\winsock.lib
kdccore::cryptdll winsock msasn1
        @set TARGETLIBS=$(OWNLIB) $(SG_INPUT_LIB)\kerbcomm.lib $(SG_OUTPUT_OAKLIB)\msasn1.lib $(SG_OUTPUT_OAKLIB)\cryptdll.lib $(SG_OUTPUT_SDKLIB)\winsock.lib $(NTCOMPATLIB) $(SG_OUTPUT_SDKLIB)\ceosutil.lib
spnego::msasn1 secur32
        @set TARGETLIBS=$(OWNLIB) $(SG_OUTPUT_OAKLIB)\msasn1.lib $(SG_OUTPUT_SDKLIB)\secur32.lib
loaddbg memtool zlib toolhelp rasdial winscard autodial lmemdebug::
        @set TARGETLIBS=$(OWNLIB)
cerdisp::
        @set TARGETLIBS=$(OWNLIB_RES) $(WINSOCKLIB)
scard:: winscard
        @set TARGETLIBS=$(OWNLIB) $(SG_OUTPUT_SDKLIB)\winscard.lib
scwapi:: winscard
        @set TARGETLIBS=$(OWNLIB) $(SG_OUTPUT_SDKLIB)\winscard.lib
scwcspgui:: winscard
        @set TARGETLIBS=$(OWNLIB_RES) $(SG_OUTPUT_SDKLIB)\winscard.lib
pscr bulltlp3:: ceddk
        @set TARGETLIBS=$(OWNLIB) $(SG_INPUT_LIB)\smclib.lib $(CEDDKLIB)
stcusb:: usbd
        @set TARGETLIBS=$(OWNLIB) $(SG_INPUT_LIB)\smclib.lib $(SG_OUTPUT_OAKLIB)\usbd.lib
shell:: toolhelp
        @set TARGETLIBS=$(OWNLIB) $(SG_OUTPUT_SDKLIB)\toolhelp.lib
usb8023:: usbd ndis rndismp netmui
        @set TARGETLIBS=$(OWNLIB) $(NDISLIB) $(NTCOMPATLIB) $(SG_OUTPUT_OAKLIB)\usbd.lib $(SG_OUTPUT_OAKLIB)\rndismp.lib $(SG_INPUT_LIB)\usbclient.lib

ipv6hlp:: iphlpapi cxport ws2
        @set TARGETLIBS=$(OWNLIB) $(CXPORT_CCLIBS) $(SG_OUTPUT_SDKLIB)\iphlpapi.lib $(WS2LIB) $(NTCOMPATLIB)
ipv6::
	@set TARGETLIBS=$(OWNLIB) $(CXPORT_CCLIBS) $(WS2LIB) $(NTCOMPATLIB)
ipv6tun::
	@set TARGETLIBS=$(OWNLIB)

#
#               commctrl
#
commctrl::$(COMMCTRL_SKIN)
        @set TARGETTYPE=DYNLINK
        @set DEFFILE=$(SG_OUTPUT_OAKLIB)\$@.def
        $(SG_TOKENFILTER) $(SG_INPUT_LIB)\$@.def $(SG_OUTPUT_OAKLIB)
        @set TARGETLIBS=$(OWNLIB) $(SG_INPUT_LIB)\commctrlbase.res
        @set TARGETLIBS=%%TARGETLIBS%% $(SG_OUTPUT_SDKLIB)\coredll.lib
        @set SOURCELIBS=$(OWNLIB) %%SOURCELIBS%%
        @set TARGETNAME=$@
        @set RELEASETYPE=SDK
        @set CPL=
        @set DLLENTRY=DllEntry
        $(MAKECMD) /NOLOGO $(SG_OUTPUT_OAKTGT)\$@.dll

#
#               Utilities
#
celogflush oscapture ceramdrv::
                @set TARGETLIBS=$(OWNSTATICLIB)

#
#		coversrv code coverage runtime
#
coversrv::
                @set TARGETLIBS=$(OWNSTATICLIB)

#
#               BSP Drivers
#

ceddk giisr ti1250isr isr16550 ne2000isr mmtimer ramdisk regenum trueffs usbd hidparse \
KbdNopUS KbdNopJpn1 KbdNopJpn2 KbdNopKor::
                @set TARGETLIBS=$(OWNSTATICLIB)

sdmmc pcibus parallel \
2890_ser com16550 com_card dualio uhci ensoniq HD465parallel HD465ohci sa_usb_ser gdcfg \
Kbd8042US Kbd8042Jpn1 Kbd8042Jpn2 Kbd8042Kor \
es1371 wavedev_gx gxuamaud battdrvr:: ceddk
                @set TARGETLIBS=$(OWNSTATICLIB) $(CEDDKLIB)

battdrvr:: battdrvr_lib

ohci2:: ceddk ohcdmdd2 hcdlib
                @set TARGETLIBS=$(SG_INPUT_LIB)\ohci_lib.lib $(CEDDKLIB) $(SG_INPUT_LIB)\ohcdmdd2.lib $(SG_INPUT_LIB)\hcdlib.lib

tvia5000:: ceddk ntcompat
                @set TARGETLIBS=$(OWNSTATICLIB) $(CEDDKLIB) $(NTCOMPATLIB)

i82365:: ceddk cardserv
                @set TARGETLIBS=$(OWNSTATICLIB) $(CEDDKLIB) $(SG_INPUT_LIB)\cardserv.lib

ti1250:: ceddk cardserv pcibus
                @set TARGETLIBS=$(OWNSTATICLIB) $(CEDDKLIB) $(SG_INPUT_LIB)\cardserv.lib $(SG_OUTPUT_OAKLIB)\pcibus.lib

pcc_ti1250:: ceddk pcc_com pcibus
                @set TARGETLIBS=$(OWNSTATICLIB) $(CEDDKLIB) $(SG_INPUT_LIB)\pcc_com.lib $(SG_OUTPUT_OAKLIB)\pcibus.lib

sdnpcid:: ceddk fal ecclib
                @set TARGETLIBS=$(OWNSTATICLIB) $(CEDDKLIB) $(SG_INPUT_LIB)\fal.lib $(SG_OUTPUT_OAKLIB)\ecclib.lib

stratad:: ceddk fal
                @set TARGETLIBS=$(OWNSTATICLIB) $(CEDDKLIB) $(SG_INPUT_LIB)\fal.lib
                -@xcopy  $(OWNSTATICLIB) $(SG_OUTPUT_OAKLIB)

ramfmd:: ceddk fal
                @set TARGETLIBS=$(OWNSTATICLIB) $(CEDDKLIB) $(SG_INPUT_LIB)\fal.lib


pcc_serv:: ceddk pcc_com
                @set TARGETLIBS=$(OWNSTATICLIB) $(CEDDKLIB) $(SG_INPUT_LIB)\pcc_com.lib

gdcfg:: ceddk pcibus
                @set TARGETLIBS=$(OWNSTATICLIB) $(CEDDKLIB) $(SG_OUTPUT_OAKLIB)\pcibus.lib

atadisk:: ceddk
                @set TARGETLIBS=$(OWNSTATICLIB) $(CEDDKLIB) $(_COMMONOAKROOT)\lib\$(_CPUINDPATH)\storeapi.lib

atapi:: ceddk pcibus
               @set TARGETLIBS=$(OWNSTATICLIB) $(CEDDKLIB) $(SG_OUTPUT_OAKLIB)\pcibus.lib $(_COMMONOAKROOT)\lib\$(_CPUINDPATH)\storeapi.lib

emul emulrotate emulstub ctblt rctblt ctbltstub drvgradfill drvgradfillstub rdrvgradfill::
		-@xcopy /I /D /Q $(SG_INPUT_LIB)\$@.* $(SG_OUTPUT_OAKLIB) > nul $(SG_XCOPYREDIRECT)

emulrotatestub::
		-@xcopy /I /D /Q $(SG_INPUT_LIB)\emulstub.* $(SG_INPUT_LIB)\emulrotatestub.* > nul $(SG_XCOPYREDIRECT)

rctbltstub::
		-@xcopy /I /D /Q $(SG_INPUT_LIB)\ctbltstub.* $(SG_INPUT_LIB)\rctbltstub.* > nul $(SG_XCOPYREDIRECT)

rdrvgradfillstub::
		-@xcopy /I /D /Q $(SG_INPUT_LIB)\drvgradfillstub.* $(SG_INPUT_LIB)\rdrvgradfillstub.* > nul $(SG_XCOPYREDIRECT)

rdrvgradfill_lib::
		@set GPELIBS=%%GPELIBS%% $(SG_INPUT_LIB)\rdrvgradfill.lib

rdrvgradfillstub_lib::
		@set GPELIBS=%%GPELIBS%% $(SG_INPUT_LIB)\rdrvgradfillstub.lib

drvgradfill_lib::
		@set GPELIBS=%%GPELIBS%% $(SG_INPUT_LIB)\drvgradfill.lib

drvgradfillstub_lib::
		@set GPELIBS=%%GPELIBS%% $(SG_INPUT_LIB)\drvgradfillstub.lib

emul_lib::
		@set GPELIBS=%%GPELIBS%% $(SG_INPUT_LIB)\emul.lib

emulrotate_lib::
		@set GPELIBS=%%GPELIBS%% $(SG_INPUT_LIB)\emulrotate.lib

emulstub_lib::
		@set GPELIBS=%%GPELIBS%% $(SG_INPUT_LIB)\emulstub.lib

emulrotatestub_lib::
		@set GPELIBS=%%GPELIBS%% $(SG_INPUT_LIB)\emulrotatestub.lib

ctblt_lib::
		@set GPELIBS=%%GPELIBS%% $(SG_INPUT_LIB)\ctblt.lib

rctblt_lib::
		@set GPELIBS=%%GPELIBS%% $(SG_INPUT_LIB)\rctblt.lib

ctbltstub_lib::
		@set GPELIBS=%%GPELIBS%% $(SG_INPUT_LIB)\ctbltstub.lib

rctbltstub_lib::
		@set GPELIBS=%%GPELIBS%% $(SG_INPUT_LIB)\rctbltstub.lib

gpe::
		@echo Deleting gpe.lib
		-@del $(SG_OUTPUT_OAKLIB)\gpe.lib

gperotate::
		@echo Deleting gperotate.lib
		-@del $(SG_OUTPUT_OAKLIB)\gperotate.lib

gpe gperotate::
		@echo GPE_MODULES=$(GPE_MODULES)
		@echo GPEROTATE_MODULES=$(GPEROTATE_MODULES)
		@set GPELIBS=

gpe:: emul emulstub ctblt ctbltstub drvgradfill drvgradfillstub $(GPE_MODULES)
		@set SOURCELIBS=$(OWNSTATICLIB) %GPELIBS%

gperotate:: emulrotate emulrotatestub rctblt rctbltstub rdrvgradfill rdrvgradfillstub $(GPEROTATE_MODULES)
		@set SOURCELIBS=$(OWNSTATICLIB) $(SG_INPUT_LIB)\gpe_lib.lib %GPELIBS%

gpe gperotate::
		@echo
		@echo GPELIBS=%%GPELIBS%%
		@echo SOURCELIBS=%%SOURCELIBS%%
		@set TARGETNAME=$@
		@set RELEASETYPE=OAK
		@set TARGETLIBS=
		@set TARGETTYPE=LIBRARY
		$(MAKE) /NOLOGO $(SG_OUTPUT_OAKLIB)\$@.lib

ddi_nop:: gpe
                @set TARGETLIBS=$(OWNSTATICLIB) $(SG_OUTPUT_OAKLIB)\gpe.lib

ddi_gx ddi_tvia5  ddi_s3v:: ceddk dxdrvguid gpe
                @set TARGETLIBS=$(OWNSTATICLIB) $(CEDDKLIB) $(SG_INPUT_LIB)\dxdrvguid.lib $(SG_OUTPUT_OAKLIB)\gpe.lib

ddi_ati:: ceddk dxdrvguid gpe ntcompat
                @set TARGETLIBS=$(OWNSTATICLIB) $(CEDDKLIB) $(SG_INPUT_LIB)\dxdrvguid.lib $(SG_OUTPUT_OAKLIB)\gpe.lib $(NTCOMPATLIB)

ddi_flat:: ceddk dxdrvguid gpe
                @set TARGETLIBS=$(OWNSTATICLIB) $(CEDDKLIB) $(SG_INPUT_LIB)\dxdrvguid.lib $(SG_OUTPUT_OAKLIB)\gpe.lib

ddi_mq200:: ceddk dxdrvguid gpe
                @set TARGETLIBS=$(OWNSTATICLIB) $(CEDDKLIB) $(SG_INPUT_LIB)\dxdrvguid.lib $(SG_OUTPUT_OAKLIB)\gpe.lib

ddi_rflat ddi_rgx:: ceddk gperotate
                @set TARGETLIBS=$(OWNSTATICLIB) $(CEDDKLIB) $(SG_OUTPUT_OAKLIB)\gperotate.lib

ddi_perm3:: ceddk swg dxdrvguid
                @set TARGETLIBS=$(OWNSTATICLIB) $(CEDDKLIB) $(SG_INPUT_LIB)\swg.lib $(SG_INPUT_LIB)\dxdrvguid.lib

perm3_cfg:: ceddk pcibus
                @set TARGETLIBS=$(OWNSTATICLIB) $(CEDDKLIB) $(SG_OUTPUT_OAKLIB)\pcibus.lib


multimon:: gpe
                @set TARGETLIBS=$(OWNSTATICLIB) $(SG_OUTPUT_OAKLIB)\gpe.lib $(SG_OUTPUT_SDKLIB)\coredll.lib

usbhid:: usbclient usbd hidparse
                @set TARGETLIBS=$(OWNSTATICLIB) $(SG_INPUT_LIB)\usbclient.lib $(SG_OUTPUT_OAKLIB)\usbd.lib $(SG_OUTPUT_OAKLIB)\hidparse.lib

kbdhid mouhid conshid:: hidparse
                @set TARGETLIBS=$(OWNSTATICLIB) $(SG_OUTPUT_OAKLIB)\hidparse.lib

usbmsc:: usbclient usbd
                @set TARGETLIBS=$(OWNSTATICLIB) $(SG_INPUT_LIB)\usbclient.lib $(SG_OUTPUT_OAKLIB)\usbd.lib

usbprn:: usbclient usbd
                @set TARGETLIBS=$(OWNSTATICLIB) $(SG_INPUT_LIB)\usbclient.lib $(SG_OUTPUT_OAKLIB)\usbd.lib

usbdisk6:: usbclient usbmsc ntcompat
                @set TARGETLIBS=$(OWNSTATICLIB) $(SG_INPUT_LIB)\usbclient.lib $(SG_OUTPUT_OAKLIB)\usbmsc.lib $(NTCOMPATLIB) $(_COMMONOAKROOT)\lib\$(_CPUINDPATH)\storeapi.lib

udfs::fsdmgr
        @set TARGETLIBS=$(OWNLIB) $(SG_OUTPUT_OAKLIB)\fsdmgr.lib

fatfsd::fsdmgr
        @set TARGETLIBS=$(OWNLIB) $(SG_OUTPUT_OAKLIB)\fsdmgr.lib

tfat::fsdmgr
        @set TARGETLIBS=$(OWNLIB) $(SG_OUTPUT_OAKLIB)\fsdmgr.lib

binfs::fsdmgr
        @set TARGETLIBS=$(OWNLIB) $(SG_OUTPUT_OAKLIB)\fsdmgr.lib

relfsd::fsdmgr
        @set TARGETLIBS=$(OWNLIB) $(SG_OUTPUT_OAKLIB)\fsdmgr.lib

mspart::
        @set TARGETLIBS=$(OWNLIB)

!IFNDEF FATUTIL_COMPONENTS
FATUTIL_COMPONENTS=fatutil_main fatutil_noui
!ENDIF

fatutil::
        @set SOURCELIBS=
        @set TARGETLIBS=$(SG_OUTPUT_SDKLIB)\coredll.lib $(SG_INPUT_LIB)\$@.res $(_COMMONOAKROOT)\lib\$(_CPUINDPATH)\storeapi.lib
fatutil::$(FATUTIL_COMPONENTS)
        @set TARGETNAME=$@
        @set RELEASETYPE=OAK
        @set DLLENTRY=DllMain
        @set DEFFILE=$(SG_INPUT_LIB)\$@.def
        $(MAKECMD) /NOLOGO $@.dll
fatutil_main:
        @set SOURCELIBS=%%SOURCELIBS%% $(SG_INPUT_LIB)\$@.lib
fatutil_noui:
        @set SOURCELIBS=%%SOURCELIBS%% $(SG_INPUT_LIB)\$@.lib
fatutil_ui:
        @set SOURCELIBS=%%SOURCELIBS%% $(SG_INPUT_LIB)\$@.lib



# driverlib dependencies for BSP drivers
es1371 tvia5000 wavedev_gx:: wavemdd

HD465ohci:: HD465ohcdpdd

ceddk:: ddk_bus ddk_io ddk_map ddk_dma ddk_time

ddi_ati ddi_gx ddi_tvia5 ddi_mq200 ddi_flat:: ddgpe

giisr ti1250isr isr16550 ne2000isr:: ddk_io fulllibc

2890_ser:: com_mdd2

com16550:: com_mdd2 ser16550

com_card:: com_mdd2 ser16550 ser_card2

dualio:: com_mdd2 ser16550

sa_usb_ser:: com_mdd2

ohci2:: ohcdmdd2 hcdlib

uhci:: uhcdmdd hcdlib

Kbd8042US:: PS2_8042_KbdCommon LayoutManager KeybdIst PS2_AT_00000409 NumPadRmp InputLang_0409

Kbd8042Jpn1:: PS2_8042_KbdCommon LayoutManager KeybdIst PS2_AT_00010411 NumPadRmp InputLang_0411

Kbd8042Jpn2:: PS2_8042_KbdCommon LayoutManager KeybdIst PS2_AT_00000411 NumPadRmp InputLang_0411

Kbd8042Kor:: PS2_8042_KbdCommon LayoutManager KeybdIst PS2_AT_00000412 NumPadRmp InputLang_0412

KbdNopUS:: Nop_KbdCommon Nop_PddList LayoutManager PS2_AT_00000409 NumPadRmp InputLang_0409

KbdNopJpn1:: Nop_KbdCommon Nop_PddList LayoutManager PS2_AT_00010411 NumPadRmp InputLang_0411

KbdNopJpn2:: Nop_KbdCommon Nop_PddList LayoutManager PS2_AT_00000411 NumPadRmp InputLang_0411

KbdNopKor:: Nop_KbdCommon Nop_PddList LayoutManager PS2_AT_00000412 NumPadRmp InputLang_0412

# aliases for build groups
pcmcia:: cardserv

!IF "$(_TGTCPU)" != "SH4"
pcmcia:: i82365 ti1250 ti1250isr
!ENDIF

pccard:: pcc_com pcc_serv pcc_ti1250

display:: ddi_ati ddi_tvia5 ddi_mq200 ddi_perm3 perm3_cfg ddi_nop

!IF "$(_TGTCPUFAMILY)" == "x86"
display:: ddi_flat ddi_rflat ddi_gx ddi_rgx
!ENDIF

8042keyboard::  Kbd8042US Kbd8042Jpn1 Kbd8042Jpn2 Kbd8042Kor

nopkeyboard::  KbdNopUS KbdNopJpn1 KbdNopJpn2 KbdNopKor

hidclients::  kbdhid conshid mouhid

serial:: com16550 isr16550 com_card 2890_ser

audiodrv:: ensoniq es1371 tvia5000
!IF "$(_TGTCPUFAMILY)" == "x86"
audiodrv:: wavedev_gx gxuamaud
!ENDIF

pci:: pcibus gdcfg

usbhost:: ohci2 uhci

!IF "$(_TGTCPUFAMILY)" == "SH"
csp:: HD465parallel HD465ohci
!ELSEIF "$(_TGTCPU)" == "ARMV4"
csp:: sa_usb_ser
!ELSE
csp::
        @echo No Chip Support Package for this CPU or CPU type
!ENDIF

!IF "$(_TGTCPU)" == "ARMV4"
ipsm::
     -@xcopy /D /I $(SG_INPUT_LIB)\psmfsdcore.lib $(SG_OUTPUT_OAKLIB)
	 -@xcopy /D /I $(SG_INPUT_ROOT)\oak\target\$(_CPUINDPATH)\psmflshdrv.dll $(SG_OUTPUT_OAKTGT)
     -@xcopy /D /I $(SG_INPUT_LIB)\psmfsd.def $(SG_OUTPUT_OAKLIB)
!ELSE
ipsm::
!ENDIF	


#
#       Bluetooth stack
#
btdrt::
        @set SOURCELIBS=$(OWNLIB)
btdrt::$(BTDRT_COMPONENTS)
        @set TARGETTYPE=DYNLINK
        @set TARGETNAME=$@
        @set TARGETLIBS=$(SG_OUTPUT_SDKLIB)\coredll.lib $(SG_INPUT_LIB)\ceosutil.lib $(SG_INPUT_LIB)\btdrtstubs.lib $(SG_OUTPUT_SDKLIB)\bthguid.lib
        @set DEFFILE=$(SG_OUTPUT_OAKLIB)\$@.def
        $(SG_TOKENFILTER) $(SG_INPUT_LIB)\$@.def $(SG_OUTPUT_OAKLIB)
        @set RELEASETYPE=OAK
        @set DLLENTRY=DllMain
        @set CPL=
        $(MAKECMD) /NOLOGO $(SG_OUTPUT_OAKTGT)\$@.dll
sdpuser:
        @set SOURCELIBS=%%SOURCELIBS%% $(SG_INPUT_LIB)\$@.lib $(SG_INPUT_LIB)\btcomstbs.lib $(SG_INPUT_LIB)\sdpparse.lib $(SG_INPUT_LIB)\btd.lib
bthns:
        @set SOURCELIBS=%%SOURCELIBS%% $(SG_INPUT_LIB)\bthns.lib


bthusb::
        @set TARGETLIBS=$(OWNLIB) $(SG_INPUT_LIB)\ceosutil.lib
bthuart::
        @set TARGETLIBS=$(OWNLIB) $(SG_INPUT_LIB)\ceosutil.lib
bthamb::
        @set TARGETLIBS=$(OWNLIB) $(SG_INPUT_LIB)\ceosutil.lib
bthcsr::
        @set TARGETLIBS=$(OWNLIB) $(SG_INPUT_LIB)\bcsp.lib $(SG_INPUT_LIB)\ceosutil.lib
bthsc::
        @set TARGETLIBS=$(OWNLIB) $(SG_INPUT_LIB)\ceosutil.lib
bthuniv::
        @set TARGETLIBS=$(OWNLIB) $(SG_INPUT_LIB)\ceosutil.lib
wendyser:: ceddk
        @set TARGETLIBS=$(OWNLIB) $(CEDDKLIB)
sio950:: ceddk
        @set TARGETLIBS=$(OWNLIB) $(CEDDKLIB)
wcestreambt:: ceddk
        @set TARGETLIBS=$(OWNLIB) $(CEDDKLIB)
btloader::
        @set TARGETLIBS=$(OWNLIB)
btgw::btdrt winsock
        @set TARGETLIBS=$(OWNLIB) $(SG_OUTPUT_OAKLIB)\btdrt.lib $(WINSOCKLIB)
btsvc::btdrt
        @set TARGETLIBS=$(OWNLIB) $(OWNRES) $(SG_INPUT_LIB)\btenum.lib $(SG_OUTPUT_OAKLIB)\btdrt.lib $(SG_INPUT_LIB)\ceosutil.lib
btmodem::btdrt
        @set TARGETLIBS=$(OWNLIB) $(SG_OUTPUT_OAKLIB)\btdrt.lib $(SG_INPUT_LIB)\ceosutil.lib
btdun::
        @set TARGETLIBS=$(OWNLIB) $(SG_INPUT_LIB)\ceosutil.lib
bthhid:: hidparse btdrt btd
        @set TARGETLIBS=$(OWNLIB) $(SG_INPUT_LIB)\bthhidp.lib $(SG_INPUT_LIB)\bthhidc.lib $(SG_INPUT_LIB)\btcomstbs.lib $(SG_OUTPUT_SDKLIB)\btd.lib $(SG_OUTPUT_OAKLIB)\btdrt.lib $(SG_OUTPUT_OAKLIB)\hidparse.lib $(SG_INPUT_LIB)\ceosutil.lib

osbenchpsl:: ceddk
        @set TARGETLIBS=$(OWNLIB) $(CEDDKLIB)
osbench_dll:: osbenchpsl ceddk
        @set TARGETLIBS=$(OWNLIB) $(CEDDKLIB) $(SG_INPUT_LIB)\osbenchpsl.lib
osbench:: osbenchpsl osbench_dll ceddk
        @set TARGETLIBS=$(OWNLIB) $(CEDDKLIB) $(SG_INPUT_LIB)\osbenchpsl.lib
iltiming_dll:: ceddk
        @set TARGETLIBS=$(OWNLIB) $(CEDDKLIB)
iltiming:: iltiming_dll
        @set TARGETLIBS=$(OWNLIB)


ime:: commctrl
        @set TARGETLIBS=$(OWNLIB_RES) $(SG_OUTPUT_SDKLIB)\commctrl.lib

connmc:: commctrl winsock iphlpapi
        @set TARGETLIBS=$(OWNLIB) $(OWNLIB_RES) $(CCLIB) $(WINSOCKLIB) $(SG_OUTPUT_SDKLIB)\iphlpapi.lib
rnaapp::
        @set TARGETLIBS=$(OWNLIB_RES) $(SG_INPUT_LIB)\tapihelp.lib
pegterm:: termctrl
        @set TARGETLIBS=$(OWNLIB_RES) $(SG_INPUT_LIB)\tapihelp.lib $(SG_OUTPUT_OAKLIB)\termctrl.lib
ping:: ws2 iphlpapi
        @set TARGETLIBS=$(OWNLIB) $(SG_OUTPUT_SDKLIB)\iphlpapi.lib $(WS2LIB)
netstat:: winsock iphlpapi
        @set TARGETLIBS=$(OWNLIB) $(SG_OUTPUT_SDKLIB)\iphlpapi.lib $(WINSOCKLIB)
rasentry:: winsock cxport
        @set TARGETLIBS=$(OWNLIB) $(CXPORT_CCLIBS) $(WINSOCKLIB)
ndisconfig::
	@set TARGETLIBS=$(OWNLIB)
ipconfig::  iphlpapi ws2
        @set TARGETLIBS= $(OWNLIB) $(SG_OUTPUT_SDKLIB)\iphlpapi.lib $(WS2LIB)
tracert::  iphlpapi ws2
        @set TARGETLIBS= $(OWNLIB) $(SG_OUTPUT_SDKLIB)\iphlpapi.lib $(WS2LIB)
wzctool::  wzcsapi
	@set TARGETLIBS= $(OWNLIB) $(SG_OUTPUT_OAKLIB)\wzcsapi.lib
netui:: iphlpapi btdrt ws2
        @set TARGETLIBS= $(OWNLIB_RES) $(SG_INPUT_LIB)\btenum.lib $(SG_OUTPUT_SDKLIB)\iphlpapi.lib $(SG_OUTPUT_OAKLIB)\btdrt.lib $(WS2LIB)
netmui::
        @set TARGETLIBS= $(OWNLIB_RES)
ethman:: netui iphlpapi ws2
        @set TARGETLIBS= $(OWNLIB) $(SG_OUTPUT_SDKLIB)\iphlpapi.lib $(WS2LIB)
route:: winsock iphlpapi
        @set TARGETLIBS=$(OWNLIB) $(SG_OUTPUT_SDKLIB)\iphlpapi.lib $(WINSOCKLIB)
pcl:: prnport
        @set TARGETLIBS=$(SG_INPUT_LIB)\pcllib.lib $(SG_OUTPUT_OAKLIB)\prnport.lib
prnport:: prnerr winsock
        @set TARGETLIBS=$(WINSOCKLIB) $(SG_INPUT_LIB)\prnportl.lib $(SG_OUTPUT_OAKLIB)\prnerr.lib
wavesamples: wavplay wavrec capsrc
wavplay wavrec capsrc::
		@set TARGETLIBS=$(OWNLIB)
cmdbar dbview generic polygons reversi rmonkey spincube inksamp inksamp2:: commctrl
        @set TARGETLIBS=$(OWNLIB) $(OWNLIB_RES) $(SG_OUTPUT_SDKLIB)\commctrl.lib
spintest:: commctrl spincube
        @set TARGETLIBS=$(OWNLIB) $(OWNLIB_RES) $(SG_OUTPUT_SDKLIB)\commctrl.lib $(SG_OUTPUT_OAKLIB)\spincube.lib
tapi hello kbdtest text etcha::
        @set TARGETLIBS=$(OWNLIB)
unimodem::
        @set TARGETLIBS=$(OWNLIB) $(SG_INPUT_LIB)\unimodem.res $(SG_INPUT_LIB)\unimodemnl.res
msim:: commctrl
        @set TARGETLIBS=$(OWNLIB_RES) $(SG_OUTPUT_SDKLIB)\commctrl.lib
LargeKB::
        @set TARGETLIBS=$(OWNLIB_RES)
enroll:: crypt32
        @set TARGETLIBS=$(OWNLIB) $(SG_OUTPUT_SDKLIB)\crypt32.lib
sipselect:: commctrl
        @set TARGETLIBS=$(OWNLIB) $(CCLIB) $(OWNLIB_RES)
cacjpn:: commctrl hwxjpn
        @set TARGETLIBS=$(OWNLIB_RES) $(CCLIB) $(SG_OUTPUT_OAKLIB)\hwxjpn.lib
multibox:: commctrl hwxjpn
        @set TARGETLIBS=$(OWNLIB_RES) $(CCLIB) $(SG_OUTPUT_OAKLIB)\hwxjpn.lib
mboxkor:: commctrl hwxkor
        @set TARGETLIBS=$(OWNLIB_RES) $(CCLIB) $(SG_OUTPUT_OAKLIB)\hwxkor.lib
mboxcht:: commctrl hwxcht
        @set TARGETLIBS=$(OWNLIB_RES) $(CCLIB) $(SG_OUTPUT_OAKLIB)\hwxcht.lib
chajeiim::
        @set TARGETLIBS=$(OWNLIB_RES)
phonim::
        @set TARGETLIBS=$(OWNLIB_RES)
testime:: commctrl
        @set TARGETLIBS=$(OWNLIB_RES) $(SG_OUTPUT_SDKLIB)\commctrl.lib
imeskdic:: commctrl
        @set TARGETLIBS=$(OWNLIB_RES) $(CCLIB)
mskana:: commctrl
        @set TARGETLIBS=$(OWNLIB_RES) $(CCLIB)
msroma:: commctrl
        @set TARGETLIBS=$(OWNLIB_RES) $(CCLIB)
msallchar:: commctrl
        @set TARGETLIBS=$(OWNLIB_RES) $(CCLIB) $(SG_INPUT_LIB)\plv.lib $(SG_INPUT_LIB)\ptv.lib $(SG_INPUT_LIB)\ptt.lib $(SG_INPUT_LIB)\ptlv.lib $(SG_INPUT_LIB)\ddbtn.lib $(SG_INPUT_LIB)\stub_ce.lib
msradlist:: commctrl
        @set TARGETLIBS=$(OWNLIB_RES) $(CCLIB) $(SG_INPUT_LIB)\plv.lib $(SG_INPUT_LIB)\ptv.lib $(SG_INPUT_LIB)\ptt.lib $(SG_INPUT_LIB)\ptlv.lib $(SG_INPUT_LIB)\ddbtn.lib $(SG_INPUT_LIB)\stub_ce.lib
msstrklist:: commctrl
        @set TARGETLIBS=$(OWNLIB_RES) $(CCLIB) $(SG_INPUT_LIB)\plv.lib $(SG_INPUT_LIB)\ptv.lib $(SG_INPUT_LIB)\ptt.lib $(SG_INPUT_LIB)\ptlv.lib $(SG_INPUT_LIB)\ddbtn.lib $(SG_INPUT_LIB)\stub_ce.lib
lpcd::
        @set TARGETLIBS=$(OWNLIB) $(SG_INPUT_LIB)\lpcmain.lib $(SG_INPUT_LIB)\ceosutil.lib $(SG_INPUT_LIB)\rsa32.lib
lpcrt::
        @set TARGETLIBS=$(SG_INPUT_LIB)\lpcclnt.lib
snmp::  winsock snmpapi snmpinfo
        @set TARGETLIBS=$(OWNLIB) $(WINSOCKLIB) $(SG_OUTPUT_OAKLIB)\snmpapi.lib
snmp_mibii:: snmp winsock snmpapi iphlpapi
        @set TARGETLIBS=$(OWNLIB) $(WINSOCKLIB) $(SG_OUTPUT_OAKLIB)\snmpapi.lib $(SG_OUTPUT_SDKLIB)\iphlpapi.lib 
snmp_hostmib:: snmp snmpapi winsock toolhelp
        @set TARGETLIBS=$(OWNLIB) $(SG_OUTPUT_OAKLIB)\snmpapi.lib $(WINSOCKLIB) $(SG_OUTPUT_SDKLIB)\toolhelp.lib
snmp_snmptestmib:: snmp winsock snmpapi
        @set TARGETLIBS=$(OWNLIB) $(WINSOCKLIB) $(SG_OUTPUT_OAKLIB)\snmpapi.lib
snmpapi:: winsock
        @set TARGETLIBS=$(OWNLIB) $(WINSOCKLIB)
snmpinfo::
        @set TARGETLIBS=$(OWNLIB)
wldap32::  winsock
        @set TARGETLIBS=$(OWNLIB) $(WINSOCKLIB)

softkb::
        @set TARGETLIBS=$(OWNLIB)
bridge::
        @set TARGETLIBS= $(SG_INPUT_LIB)\bridgexe.lib

gb18030::
        @set TARGETLIBS=$(OWNLIB)

#
# IMEJP 3.0
#
imjp30t:: commctrl
        @set TARGETLIBS=\
             $(OWNLIB) $(CCLIB)
imjp30k:: imjp30t commctrl
        @set TARGETLIBS=\
             $(OWNLIB_RES) $(CCLIB) \
             $(SG_INPUT_LIB)\imjp30_slm2.lib $(SG_INPUT_LIB)\imjp30_vqcomp.lib $(SG_INPUT_LIB)\imjp30_defs.lib \
             $(SG_INPUT_LIB)\imjp30_udman.lib $(SG_INPUT_LIB)\imjp30_iusrdict.lib $(SG_INPUT_LIB)\imjp30_isysdict.lib \
             $(SG_INPUT_LIB)\imjp30_misc.lib $(SG_INPUT_LIB)\imjp30_opendct.lib $(SG_INPUT_LIB)\imjp30_fedictmisc.lib \
             $(SG_INPUT_LIB)\imjp30_propmgr.lib $(SG_INPUT_LIB)\imjp30k_apimgr.lib $(SG_INPUT_LIB)\imjp30k_ipoint.lib \
             $(SG_INPUT_LIB)\imjp30k_inpmgr.lib $(SG_INPUT_LIB)\imjp30k_regmgr.lib $(SG_INPUT_LIB)\imjp30k_ijconv.lib \
             $(SG_INPUT_LIB)\imjp30k_iphrase.lib $(SG_INPUT_LIB)\imjp30k_ijkbd.lib $(SG_INPUT_LIB)\imjp30k_iconvert.lib \
             $(SG_INPUT_LIB)\imjp30k_cnvmgr.lib $(SG_INPUT_LIB)\imjp30_dictype.lib $(SG_INPUT_LIB)\imjp30_imemdict.lib \
             $(SG_INPUT_LIB)\imjp30k_ifelang.lib $(SG_INPUT_LIB)\imjp30k_ifecom.lib $(SG_INPUT_LIB)\imjp30k_banri.lib \
             $(SG_INPUT_LIB)\imjp30_sharemem.lib $(SG_INPUT_LIB)\imjp30_filemap.lib $(SG_OUTPUT_OAKLIB)\imjp30t.lib
imjp30:: imjp30t imjp30k commctrl
        @set TARGETLIBS=\
             $(OWNLIB_RES) $(CCLIB) \
             $(SG_INPUT_LIB)\imjp30_misc.lib $(SG_INPUT_LIB)\imjp30_opendct.lib $(SG_INPUT_LIB)\imjp30_propmgr.lib \
             $(SG_INPUT_LIB)\imjp30_sharemem.lib $(SG_INPUT_LIB)\imjp30_ime_common.lib $(SG_INPUT_LIB)\imjp30_candwnd.lib \
              $(SG_INPUT_LIB)\imjp30_globalflag.lib $(SG_INPUT_LIB)\imjp30_ui_pop_stub.lib $(SG_INPUT_LIB)\imjp30_ui_delword_stub.lib \
             $(SG_INPUT_LIB)\$(IME30_SKINNABLEUI_COMPONENT).lib $(SG_INPUT_LIB)\$(IME30_SKINNABLEUI_COMPONENT).res \
             $(SG_OUTPUT_OAKLIB)\imjp30t.lib $(SG_OUTPUT_OAKLIB)\imjp30k.lib
imjp30m:: imjp30t commctrl
        @set TARGETLIBS=\
             $(OWNLIB_RES) $(CCLIB) \
             $(SG_OUTPUT_OAKLIB)\imjp30t.lib
imjp30ux:: imjp30t commctrl
        @set TARGETLIBS=\
             $(OWNLIB_RES) $(CCLIB) \
             $(SG_INPUT_LIB)\imjp30_propmgr.lib $(SG_INPUT_LIB)\imjp30_sharemem.lib \
             $(SG_OUTPUT_OAKLIB)\imjp30t.lib
imjp30u:: imjp30t commctrl
        @set TARGETLIBS=\
             $(OWNLIB_RES) $(CCLIB) \
             $(SG_INPUT_LIB)\imjp30_misc.lib $(SG_INPUT_LIB)\imjp30_propmgr.lib $(SG_INPUT_LIB)\imjp30_sharemem.lib \
             $(SG_INPUT_LIB)\imjp30_dictype.lib $(SG_INPUT_LIB)\imjp30_opendct.lib \
             $(SG_OUTPUT_OAKLIB)\imjp30t.lib
imjp30u_q:: imjp30t commctrl
        @set TARGETLIBS=\
             $(OWNLIB_RES) $(CCLIB) \
             $(SG_INPUT_LIB)\imjp30_misc.lib $(SG_INPUT_LIB)\imjp30_propmgr.lib $(SG_INPUT_LIB)\imjp30_sharemem.lib \
             $(SG_INPUT_LIB)\imjp30_dictype.lib \
             $(SG_OUTPUT_OAKLIB)\imjp30t.lib
imjp30dx:: imjp30t commctrl
        @set TARGETLIBS=\
             $(OWNLIB_RES) $(CCLIB) \
             $(SG_INPUT_LIB)\imjp30_misc.lib $(SG_INPUT_LIB)\imjp30_propmgr.lib $(SG_INPUT_LIB)\imjp30_sharemem.lib \
             $(SG_INPUT_LIB)\imjp30dx_data.lib $(SG_INPUT_LIB)\imjp30dx_ui.lib $(SG_INPUT_LIB)\imjp30dx_util.lib $(SG_INPUT_LIB)\imjp30dx_ctext.lib \
             $(SG_OUTPUT_OAKLIB)\imjp30t.lib
imjp30dx_q:: commctrl
        @set TARGETLIBS=\
             $(OWNLIB_RES) $(CCLIB)
imjp30c:: imjp30t commctrl
        @set TARGETLIBS=\
             $(OWNLIB_RES) $(CCLIB) \
             $(SG_INPUT_LIB)\imjp30_misc.lib $(SG_INPUT_LIB)\imjp30_propmgr.lib $(SG_INPUT_LIB)\imjp30_sharemem.lib \
             $(SG_OUTPUT_OAKLIB)\imjp30t.lib

imjp30_dics_compact::
imjp30_dics_std::

#
# pIME
#
imejpp::
        @set TARGETLIBS=$(OWNLIB_RES) $(CCLIB) $(SG_INPUT_LIB)\imemisc.lib

imejppui:: commctrl
        @set TARGETLIBS=$(OWNLIB_RES) $(CCLIB)

imejpp_dic_s::

imejpp_dic_n::

#
# HWX and Spell
#
hwxcht hwxjpn hwxkor hwxusa::
        @set TARGETLIBS=$(OWNLIB) $(OWNLIB_RES)

splusa::
        @set TARGETLIBS=$(OWNLIB)

#
# !!GENERIC EASILY SHAREABLE RULES!!
#
termctrl console cmd commdlg prnerr \
cegsm gsm610 msfilter net rezmeter::
        @set TARGETLIBS=$(OWNLIB_RES)


tktest regdump prtscrn fsreset commctr::
        @set TARGETLIBS=$(OWNLIB)

#
# 1394 / WDM
#

setupapi::
        @set TARGETLIBS=$(OWNLIB)

wdmlib:: cxport ceddk
        @set TARGETLIBS=$(OWNLIB) \
        $(SG_INPUT_LIB)\wdmhal.lib \
        $(CEDDKLIB) \
        $(CXPORT_CCLIBS)

cewdmmgr:: wdmlib
        @set TARGETLIBS=$(OWNLIB) $(SG_OUTPUT_OAKLIB)\wdmlib.lib \
        $(CEDDKLIB)

1394bus:: wdmlib
        @set TARGETLIBS=$(OWNLIB) $(SG_OUTPUT_OAKLIB)\wdmlib.lib

1394ohcd:: wdmlib 1394bus
        @set TARGETLIBS=$(OWNLIB) $(SG_OUTPUT_OAKLIB)\wdmlib.lib $(SG_OUTPUT_OAKLIB)\1394bus.lib \
        $(CEDDKLIB)

oemohci:: wdmlib 1394bus
        @set TARGETLIBS=$(OWNLIB) $(SG_OUTPUT_OAKLIB)\wdmlib.lib $(SG_OUTPUT_OAKLIB)\1394bus.lib \
        $(SG_INPUT_LIB)\mstv1394.lib \
        $(CEDDKLIB)

sbp2:: wdmlib
        @set TARGETLIBS=$(OWNLIB) $(SG_OUTPUT_OAKLIB)\wdmlib.lib

scsiblk:: wdmlib setupapi
        @set TARGETLIBS=$(OWNLIB) $(SG_OUTPUT_OAKLIB)\wdmlib.lib $(SG_OUTPUT_OAKLIB)\setupapi.lib

61883:: wdmlib
        @set TARGETLIBS=$(OWNLIB) $(SG_OUTPUT_OAKLIB)\wdmlib.lib

avc:: wdmlib
        @set TARGETLIBS=$(OWNLIB) $(SG_OUTPUT_OAKLIB)\wdmlib.lib

avc_stream:: wdmlib
        @set TARGETLIBS=$(OWNLIB) $(SG_OUTPUT_OAKLIB)\wdmlib.lib

avc_unit:: wdmlib
        @set TARGETLIBS=$(OWNLIB) $(SG_OUTPUT_OAKLIB)\wdmlib.lib

avc_vcr:: wdmlib
        @set TARGETLIBS=$(OWNLIB) $(SG_OUTPUT_OAKLIB)\wdmlib.lib

avc_vvcr:: wdmlib avc_unit
        @set TARGETLIBS=$(OWNLIB) $(SG_OUTPUT_OAKLIB)\wdmlib.lib $(SG_OUTPUT_OAKLIB)\avc_unit.lib

1394dcam:: wdmlib
        @set TARGETLIBS=$(OWNLIB) $(SG_OUTPUT_OAKLIB)\wdmlib.lib

virtdcam:: wdmlib
        @set TARGETLIBS=$(OWNLIB) $(SG_OUTPUT_OAKLIB)\wdmlib.lib

1394diag:: wdmlib
        @set TARGETLIBS=$(OWNLIB) $(SG_OUTPUT_OAKLIB)\wdmlib.lib \
        $(CEDDKLIB)

1394vdev:: wdmlib
        @set TARGETLIBS=$(OWNLIB) $(SG_OUTPUT_OAKLIB)\wdmlib.lib \
        $(CEDDKLIB)

topomap:: setupapi
        @set TARGETLIBS=$(OWNLIB) $(SG_OUTPUT_OAKLIB)\setupapi.lib


###############################################################################
#
# STEP-2: Initialization. All modules should be listed in this rule
#
###############################################################################

ne2000 islp2nds net2890 smsc100fd elnk3 sisnic ieepro dc21x4 xircce2 xircce3 pcx500 irdastk irsir ircomm afd msasn1 certui schannel ssllsp ntlmssp cryptdll kerberos spnego kdccore \
rtl8139 dp83815 3c90x vmini tunmp mbridge ndispwr ndisuio wzcsapi wzcsvc dot11emu nwifi wlclient wlsvc oneex autoras tcpip6 tcpstk ppp pptp l2tp pppoe asyncmac eap eapchap eaptls eapol redir netbios dhcp ipnat autodial scard pscr bulltlp3 stcusb \
ime msim largekb enroll cacjpn multibox mboxkor mboxcht chajeiim phonim testime tapi unimodem termctrl pegterm connmc ping ipconfig tracert ndisconfig bridge route rasentry rasdial rnaapp zclog netstat \
cmdbar dbview generic polygons reversi rmonkey spincube spintest wzctool \
hello kbdtest text etcha inksamp inksamp2 imeskdic mskana msallchar msradlist msroma msstrklist \
console cmd net shell netui netmui ethman cegsm gsm610 msfilter pcl prnerr prnport \
imjp30t imjp30k imjp30 imjp30m imjp30ux imjp30u imjp30u_q imjp30dx imjp30dx_q imjp30c \
nspm \
imejpp imejppui iltiming iltiming_dll osbench osbench_dll osbenchpsl \
snmp snmpapi snmpinfo snmp_hostmib snmp_mibii snmp_snmptestmib wldap32 \
setupapi wdmlib cewdmmgr 1394bus 1394ohcd oemohci sbp2 scsiblk 61883 avc avc_unit avc_stream avc_vcr avc_vvcr 1394dcam virtdcam 1394diag 1394vdev topomap \
pvbload pvbhost pvbform pdm vbrmon lpcd lpcrt softkb scwcspgui ws2instl wspm bthusb bthuart bthamb bthsc bthcsr bthuniv wendyser sio950 wcestreambt btloader btgw rndismp usb8023 multimon btsvc btmodem btdun bthhid \
i82365 ti1250 pcc_ti1250 pcc_serv atapi atadisk sdmmc gpe gperotate ddi_ati ddi_gx ddi_tvia5 ddi_mq200 ddi_s3v ddi_perm3 perm3_cfg ddi_flat ddi_rflat ddi_rgx ddi_nop ceddk gdcfg \
giisr ti1250isr isr16550 ne2000isr pcibus parallel ramdisk regenum mspart udfs fatfsd tfat fatutil relfsd binfs battdrvr \
Kbd8042US Kbd8042Jpn1 Kbd8042Jpn2 Kbd8042Kor \
KbdNopUS KbdNopJpn1 KbdNopJpn2 KbdNopKor \
2890_ser com16550 com_card trueffs usbhid kbdhid mouhid conshid hidparse usbprn usbmsc usbdisk6 ohci2 uhci usbd ensoniq es1371 tvia5000 wavedev_gx gxuamaud \
HD465parallel HD465ohci sa_usb_ser celogflush oscapture coversrv ceramdrv stratad ramfmd \
wavrec wavplay capsrc ipv6hlp ipv6 ipv6tun zlib ipsec ipsecsvc \
hwxcht hwxjpn hwxkor hwxusa splusa tktest rezmeter regdump prtscrn fsreset gb18030 lmemdebug cerdisp::
        @set RELEASETYPE=OAK
        @set CPL=

fw6 fwapi \
commdlg ndis toolhelp crypt32 secur32 winscard mmtimer iphlpapi scwapi::
        @set RELEASETYPE=SDK
        @set CPL=

#################################################################################################
# STEP-3: Hack for .CPLs only! If (and only if) your module needs to be renamed from .DLL to .CPL
###################################################################################
ime certui::
        @set CPL=1

###################################################################################
#
# STEP-4: Add your module to exactly ONE of the following rules, choosing your
#         DLL or EXE entry point. NOTE: If you choose DllMainCRTStartup, your
#         own DllMain will *not* be called. DO NOT create new rules
#
# DllEntry/DllMain -- calls entry supplied by module. Does NOT call C++ static ctors/dtors
# DllMainCRTStartup - calls C++ static ctors & dtors. Does NOT call module's DllMain
# WinMain -- calls module's standard EXE entry point. Does NOT call C++ static ctors/dtors
# WinMainCRTStartup -- Calls C++ static ctors, then calls module's WinMain
# mainWCRTStartup -- for console apps whose entry is wmain(int argc, WCHAR **argv). Also calls C++ ctors/dtors
# mainACRTStartup -- for console apps whose entry is main(int argc, char **argv). Also calls C++ ctors/dtors
#
###################################################################################

afd cegsm gsm610 commdlg console dc21x4 dhcp elnk3 sisnic ieepro pcx500 \
ime iphlpapi ipnat autodial ircomm irdastk irsir lpcd lpcrt msfilter msim largekb ndis ne2000 islp2nds net2890 smsc100fd rtl8139 dp83815 3c90x vmini tunmp mbridge ndispwr ndisuio wzcsapi wzcsvc dot11emu nwifi wlclient wlsvc oneex autoras netbios \
netui netmui ethman ntlmssp ppp pptp l2tp pppoe asyncmac eap eapchap eapol redir crypt32 certui schannel snmpapi snmpinfo snmp_hostmib snmp \
iltiming_dll nspm osbench_dll pscr bulltlp3 stcusb scard winscard stratad ramfmd \
tapi tcpip6 tcpstk termctrl testime unimodem ws2instl wspm xircce2 xircce3 softkb rndismp usb8023 \
i82365 ti1250 pcc_ti1250 pcc_serv giisr ti1250isr isr16550 ne2000isr 2890_ser com16550 com_card usbhid kbdhid mouhid conshid hidparse usbprn usbmsc usbdisk6 sdnpcid \
es1371 tvia5000 wavedev_gx lmemdebug ipv6hlp ipsecsvc bthcsr::
        @set DLLENTRY=DllEntry

imjp30t imjp30 imjp30c \
pcl prnerr \
setupapi wdmlib cewdmmgr 1394bus 1394ohcd oemohci sbp2 scsiblk 61883 avc avc_unit avc_stream avc_vcr avc_vvcr 1394dcam virtdcam 1394diag 1394vdev \
prnport snmp_mibii snmp_snmptestmib wldap32 msasn1 cryptdll ssllsp kerberos eaptls imeskdic mskana msallchar msradlist msroma msstrklist scwapi bthuniv wendyser sio950 wcestreambt \
atapi atadisk sdmmc pcibus perm3_cfg ceddk gdcfg battdrvr \
fwapi \
mmtimer parallel ramdisk regenum ohci2 uhci usbd ensoniq gxuamaud mspart udfs fatfsd tfat relfsd fatutil binfs \
Kbd8042US Kbd8042Jpn1 Kbd8042Jpn2 Kbd8042Kor \
KbdNopUS KbdNopJpn1 KbdNopJpn2 KbdNopKor ipsec \
HD465parallel HD465ohci sa_usb_ser hwxcht hwxjpn hwxkor hwxusa splusa gb18030::
    @set DLLENTRY=DllMain

imjp30k imjp30u imjp30u_q \
imejpp imejppui pdm pvbform pvbhost secur32 kdccore spnego spincube toolhelp zlib \
vbrmon cacjpn multibox mboxkor mboxcht chajeiim phonim bthusb bthuart bthamb bthsc multimon btsvc btmodem btdun bthhid scwcspgui \
fw6 \
ddi_mq200 ddi_ati ddi_gx ddi_tvia5 ddi_perm3 ddi_flat ddi_rflat ddi_rgx ddi_nop::
        @set DLLENTRY=_DllMainCRTStartup

# This DLL entry is for TrueFFS ONLY!
trueffs::
        @set DLLENTRY=TFFSdiskEntry

cmdbar dbview etcha inksamp inksamp2 generic hello kbdtest memtool \
pegterm polygons pvbload connmc reversi rmonkey \
topomap \
wavrec wavplay capsrc \
rnaapp ndisconfig spintest text imjp30m imjp30ux imjp30dx imjp30dx_q iltiming osbench enroll sipselect celogflush oscapture coversrv rezmeter regdump prtscrn cerdisp::
        @set EXEENTRY=WinMain

netstat shell ceramdrv fsreset::
        @set EXEENTRY=main

cmd net ping ipconfig tracert wzctool bridge zclog route rasentry rasdial btloader btgw tktest loaddbg ipv6 ipv6tun::
        @set EXEENTRY=mainWCRTStartup

##############################################################################
# STEP-5: Add your module to exactly ONE of the following rules.
#                 DO NOT create new rules.
##############################################################################


#
# This is the standard rule for DLLs
#
afd cegsm gsm610 commdlg console dc21x4 dhcp elnk3 sisnic ieepro ime \
imejpp imejppui iphlpapi ipnat autodial ircomm irdastk irsir lpcd lpcrt msfilter \
imjp30t imjp30k imjp30 imjp30u imjp30u_q imjp30c \
fw6 fwapi \
msim largekb ndis ne2000 islp2nds net2890 smsc100fd pscr bulltlp3 stcusb scard scwapi scwcspgui winscard  \
rtl8139 dp83815 3c90x vmini tunmp mbridge ndispwr ndisuio wzcsapi wzcsvc dot11emu nwifi wlclient wlsvc oneex autoras netbios netui netmui ethman ntlmssp cryptdll kerberos spnego kdccore pcl pdm ppp pptp l2tp pppoe asyncmac eap eapchap eaptls eapol prnerr prnport pvbform \
pvbhost redir msasn1 crypt32 certui schannel ssllsp secur32 snmp snmpapi snmpinfo snmp_hostmib snmp_mibii snmp_snmptestmib wldap32 spincube \
tapi tcpip6 tcpstk termctrl testime cacjpn multibox mboxkor mboxcht chajeiim phonim toolhelp zlib unimodem ws2instl nspm wspm vbrmon xircce2 xircce3 imeskdic mskana msallchar msradlist msroma msstrklist \
setupapi wdmlib cewdmmgr 1394bus 1394ohcd oemohci sbp2 scsiblk 61883 avc avc_unit avc_stream avc_vcr avc_vvcr 1394dcam virtdcam 1394diag 1394vdev \
iltiming_dll osbench_dll softkb bthusb bthuniv bthuart bthamb bthsc bthcsr wendyser sio950 wcestreambt rndismp usb8023 multimon btsvc btmodem btdun bthhid pcx500 \
i82365 ti1250 ti1250 pcc_ti1250 pcc_serv atapi atadisk sdmmc pcibus ddi_ati ddi_gx ddi_tvia5 ddi_mq200 ddi_s3v ddi_perm3 perm3_cfg ddi_flat ddi_rflat ddi_rgx ddi_nop ceddk gdcfg battdrvr \
mmtimer parallel ramdisk regenum 2890_ser com16550 com_card trueffs usbhid kbdhid mouhid conshid hidparse usbmsc usbdisk6 mspart udfs fatfsd tfat binfs relfsd fatutil \
ohci2 uhci usbd usbprn ensoniq es1371 tvia5000 wavedev_gx gxuamaud HD465parallel HD465ohci sa_usb_ser sdnpcid stratad ramfmd \
TraRecoDeu TraRecoEnu TraRecoFra CalligDeu CalligEnu CalligFra  \
Kbd8042US Kbd8042Jpn1 Kbd8042Jpn2 Kbd8042Kor \
KbdNopUS KbdNopJpn1 KbdNopJpn2 KbdNopKor ipsec ipsecsvc \
hwxcht hwxjpn hwxkor hwxusa splusa gb18030 lmemdebug ipv6hlp::
        @set TARGETTYPE=DYNLINK
        @set DEFFILE=$(SG_INPUT_LIB)\$@.def
        @set TARGETLIBS=%%TARGETLIBS%% $(SG_OUTPUT_SDKLIB)\coredll.lib
        @set SOURCELIBS=
        @set TARGETNAME=$@
        $(MAKECMD) /NOLOGO $(SG_OUTPUT_OAKTGT)\$@.dll

#
# Use this rule for targets which should not have coredll automatically
# added to their target library list. For example, installable ISR DLLs that
# are linked during sysgen cannot have dependencies on coredll because they
# are loaded inside the kernel; such libraries are not allowed to have import
# dependencies.
#
giisr ti1250isr isr16550 ne2000isr::
        @set TARGETTYPE=DYNLINK
        @set DEFFILE=$(SG_INPUT_LIB)\$@.def
        @set TARGETLIBS=%%TARGETLIBS%%
        @set SOURCELIBS=
        @set TARGETNAME=$@
        $(MAKECMD) /NOLOGO $(SG_OUTPUT_OAKTGT)\$@.dll


#
# This is the standard rule for EXEs
#
cmd cmdbar dbview etcha inksamp inksamp2 generic hello ipconfig tracert ndisconfig wzctool bridge route kbdtest loaddbg \
memtool net netstat pegterm ping polygons pvbload rasdial \
imjp30m imjp30ux imjp30dx imjp30dx_q \
rasentry connmc reversi rmonkey rnaapp zclog shell spintest text \
topomap \
wavrec wavplay capsrc ipv6 ipv6tun \
iltiming osbench enroll sipselect btloader btgw celogflush oscapture coversrv ceramdrv tktest rezmeter \
regdump prtscrn fsreset cerdisp::
        @set TARGETTYPE=PROGRAM
        @set TARGETLIBS=$(SG_OUTPUT_SDKLIB)\coredll.lib %%TARGETLIBS%%
        @set SOURCELIBS=
        @set TARGETNAME=$@
        $(MAKECMD) /NOLOGO $(SG_OUTPUT_OAKTGT)\$@.exe


######################################################################################
# STEP-6: If (and only if) your module has a localizable RES file, add it to the first
#         line below. This creates a text file that is used during MAKEIMG to insert
#         the correct localized resources.
######################################################################################

cegsm gsm610 cmd commctrl commdlg console fatfs filesys msfilter msim \
netui btsvc netmui pegterm prnerr connmc rnaapp crypt32 softkb tapi termctrl \
unimodem waveapi net spintest spincube i82365 ti1250 fatutil::
        @echo $@ >> $(SG_OUTPUT_OAKTGT)\common.loc

!IF "$(GWES_LANGID)" == "."
gwes::
        @echo $@ >> $(SG_OUTPUT_OAKTGT)\common.loc
!ENDIF

!IF "$(COREDLL_LANGID)" == "."
coredll::
        @echo $@ >> $(SG_OUTPUT_OAKTGT)\common.loc
!ENDIF

#################### END of 6-STEP standardized default SYSGEN LINK PHASE ######################


