From: Casper Hornstrup Date: Sat, 5 Mar 2005 20:50:25 +0000 (+0000) Subject: Merge 13511:13830 from trunk X-Git-Tag: backups/xmlbuildsystem@15601~209 X-Git-Url: https://git.reactos.org/?p=reactos.git;a=commitdiff_plain;h=efe22d2e075d643e3b4a0cb3b1e96229062016de Merge 13511:13830 from trunk svn path=/branches/xmlbuildsystem/; revision=13833 --- efe22d2e075d643e3b4a0cb3b1e96229062016de diff --cc reactos/Makefile index f6289ebeecc,a349d6476b9..f738f7cf9d1 --- a/reactos/Makefile +++ b/reactos/Makefile @@@ -1,77 -1,1084 +1,78 @@@ -# $Id$ -# -# Global makefile -# - -PATH_TO_TOP = . - -include $(PATH_TO_TOP)/rules.mak -include $(PATH_TO_TOP)/config - -# -# Define to build ReactOS external targets -# -ifeq ($(ROS_BUILD_EXT),) -ROS_BUILD_EXT = no -else -ROS_BUILD_EXT = yes -endif - -ifneq ($(MINIMALDEPENDENCIES),no) -IMPLIB = -else -IMPLIB = implib +host_gcc = gcc +host_gpp = g++ +host_ld = ld +host_ar = ar +host_objcopy = objcopy +ifeq ($(HOST),mingw32-linux) + EXEPREFIX = ./ + EXEPOSTFIX = + SEP = / + nmkdir = mkdir -p + gcc = mingw32-gcc + gpp = mingw32-g++ + ld = mingw32-ld + ar = mingw32-ar + objcopy = mingw32-objcopy + dlltool = mingw32-dlltool + windres = mingw32-windres + rm = rm -f + cp = cp + NUL = /dev/null +else # mingw32-windows + EXEPREFIX = + EXEPOSTFIX = .exe + SEP = \$(EMPTY_VAR) + nmkdir = mkdir + gcc = gcc + gpp = g++ + ld = ld + ar = ar + objcopy = objcopy + dlltool = dlltool + windres = windres + rm = del /f /q + cp = copy /y + NUL = NUL endif -# Boot loaders -BOOT_LOADERS = freeldr - -# Required to run the system -COMPONENTS = ntoskrnl - -# Hardware Abstraction Layers -# halx86 -HALS = halx86/up halx86/mp - -# Bus drivers -# acpi isapnp pci -BUS = acpi isapnp pci - -# Filesystem libraries -# vfatlib -LIB_FSLIB = vfatlib - -# libunicode, must be empty! -LIBUNICODE = - -# Static libraries -LIB_STATIC = string rosrtl epsapi uuid libwine zlib rtl tgetopt pseh adns dxguid strmiids crt rossym wdmguid - -# Keyboard layout libraries -DLLS_KBD = kbdda kbddv kbdes kbdfr kbdgr kbdse kbduk kbdus - -# Control Panels -DLLS_CPL = cpl - -# Shell extensions -DLLS_SHELLEXT = shellext - -# User mode libraries -# libpcap packet epsapi -DLLS = acledit aclui advapi32 advpack cabinet cards comctl32 crtdll comdlg32 d3d8thk dbghelp expat fmifs freetype \ - gdi32 gdiplus glu32 hid imagehlp imm32 iphlpapi kernel32 lzexpand mesa32 midimap mmdrv mpr msacm msafd \ - msgina msi msimg32 msvcrt20 msvideo mswsock netapi32 ntdll ole32 oleaut32 oledlg olepro32 opengl32 \ - packet psapi riched20 richedit rpcrt4 samlib secur32 setupapi shell32 shlwapi smdll snmpapi syssetup \ - twain user32 userenv version wininet winmm winspool ws2help ws2_32 wsock32 wshirda dnsapi \ - urlmon shdocvw dinput dinput8 dxdiagn devenum dsound lsasrv $(DLLS_KBD) $(DLLS_CPL) $(DLLS_SHELLEXT) - -SUBSYS = smss win32k csrss ntvdm - -# -# Select the server(s) you want to build -# -#SERVERS = posix linux os2 -SERVERS = win32 - -# Driver support libraries -#bzip2 zlib oskittcp -DRIVERS_LIB = bzip2 oskittcp ip csq +.PHONY: all +.PHONY: clean -# Kernel mode device drivers -# Obsolete: ide -# beep blue floppy null parallel ramdrv serenum serial -DEVICE_DRIVERS = beep blue debugout null serial bootvid +all: Makefile.auto -# Kernel mode input drivers -INPUT_DRIVERS = keyboard mouclass psaux sermouse - -# Kernel mode file system drivers -# cdfs ext2 fs_rec ms np vfat -FS_DRIVERS = cdfs fs_rec ms np vfat mup ntfs - -# Kernel mode networking drivers -# afd ndis npf tcpip tdi wshtcpip -NET_DRIVERS = afd ndis npf tcpip tdi wshtcpip - -# Kernel mode networking device drivers -# ne2000 pcnet -NET_DEVICE_DRIVERS = ne2000 pcnet - -# Kernel mode storage drivers -# atapi cdrom class2 disk scsiport -STORAGE_DRIVERS = atapi cdrom class2 disk floppy scsiport diskdump - -# System applications -# autochk cmd format services setup usetup welcome winlogon msiexec -SYS_APPS = autochk calc cmd explorer expand format ibrowser msiexec regsvr32 \ - reporterror services setup taskmgr userinit usetup welcome vmwinst rundll32 \ - winlogon regedit winefile notepad reactos lsass - -# System services -SYS_SVC = rpcss eventlog umpnpmgr - -APPS = testsets utils - - -# External modules and (sub)systems for ReactOS -# rosapps posix os2 (requires c++) java (non-existant) -EXTERNALS = rosapps - -ifeq ($(ROS_BUILD_EXT),yes) -EXT_MODULES = $(EXTERNALS) -else -EXT_MODULES = +ifneq ($(ROS_INTERMEDIATE),) +$(ROS_INTERMEDIATE)tools: $(ROS_INTERMEDIATE) + ${nmkdir} $(ROS_INTERMEDIATE)tools endif -KERNEL_DRIVERS = $(DRIVERS_LIB) $(DEVICE_DRIVERS) $(INPUT_DRIVERS) $(FS_DRIVERS) \ - $(NET_DRIVERS) $(NET_DEVICE_DRIVERS) $(STORAGE_DRIVERS) VIDEO_DRIVERS USB_DRIVERS - -# Regression tests -REGTESTS = regtests - -all: bootstrap $(BOOT_LOADERS) $(COMPONENTS) $(REGTESTS) $(HALS) $(BUS) $(LIB_FSLIB) \ - $(DLLS) $(SUBSYS) $(KERNEL_DRIVERS) $(SYS_APPS) $(SYS_SVC) $(APPS) $(EXT_MODULES) - -bootstrap: dk implib iface_native - -depends: $(LIB_STATIC:%=%_depends) $(LIB_FSLIB:%=%_depends) msvcrt_depends $(DLLS:%=%_depends) \ - $(SUBSYS:%=%_depends) $(SYS_SVC:%=%_depends) \ - $(EXT_MODULES:%=%_depends) $(POSIX_LIBS:%=%_depends) - -implib: hallib $(LIB_STATIC) $(LIB_FSLIB) $(COMPONENTS:%=%_implib) $(HALS:%=%_implib) \ - $(BUS:%=%_implib) $(LIB_STATIC:%=%_implib) $(LIB_FSLIB:%=%_implib) \ - msvcrt_implib $(DLLS:%=%_implib) $(KERNEL_DRIVERS:%=%_implib) \ - $(SUBSYS:%=%_implib) $(SYS_APPS:%=%_implib) $(SYS_SVC:%=%_implib) \ - $(EXT_MODULES:%=%_implib) $(REGTESTS:%=%_implib) - -test: $(BOOT_LOADERS:%=%_test) $(COMPONENTS:%=%_test) $(HALS:%=%_test) $(BUS:%=%_test) \ - $(LIB_STATIC:%=%_test) $(LIB_FSLIB:%=%_test) msvcrt_test $(DLLS:%=%_test) \ - $(KERNEL_DRIVERS:%=%_test) $(SUBSYS:%=%_test) \ - $(SYS_SVC:%=%_test) $(EXT_MODULES:%=%_test) - -clean: tools dk_clean iface_native_clean hallib_clean \ - $(BOOT_LOADERS:%=%_clean) $(HALS:%=%_clean) $(COMPONENTS:%=%_clean) \ - $(BUS:%=%_clean) $(LIB_STATIC:%=%_clean) $(LIB_FSLIB:%=%_clean) \ - msvcrt_clean $(DLLS:%=%_clean) $(KERNEL_DRIVERS:%=%_clean) \ - $(SUBSYS:%=%_clean) $(SYS_APPS:%=%_clean) $(SYS_SVC:%=%_clean) \ - $(NET_APPS:%=%_clean) $(APPS:%=%_clean) $(EXT_MODULES:%=%_clean) \ - $(REGTESTS:%=%_clean) clean_after tools_clean - -clean_after: - $(HALFVERBOSEECHO) [RM] /include/roscfg.h - $(RM) $(PATH_TO_TOP)/include/roscfg.h - -fastinstall: tools install_dirs install_before $(COMPONENTS:%=%_install) $(HALS:%=%_install) \ - $(BUS:%=%_install) $(LIB_STATIC:%=%_install) $(LIB_FSLIB:%=%_install) \ - msvcrt_install $(DLLS:%=%_install) $(KERNEL_DRIVERS:%=%_install) \ - $(SUBSYS:%=%_install) $(SYS_APPS:%=%_install) $(SYS_SVC:%=%_install) \ - $(APPS:%=%_install) $(EXT_MODULES:%=%_install) $(REGTESTS:%=%_install) -install: fastinstall registry - -FREELDR_DIR = boot/freeldr - -bootcd_directory_layout: - $(HALFVERBOSEECHO) [RMKDIR] $(BOOTCD_DIR) - $(RMKDIR) $(BOOTCD_DIR) - $(HALFVERBOSEECHO) [RMKDIR] $(BOOTCD_DIR)/bootdisk - $(RMKDIR) $(BOOTCD_DIR)/bootdisk - $(HALFVERBOSEECHO) [RMKDIR] $(BOOTCD_DIR)/loader - $(RMKDIR) $(BOOTCD_DIR)/loader - $(HALFVERBOSEECHO) [RMKDIR] $(BOOTCD_DIR)/reactos - $(RMKDIR) $(BOOTCD_DIR)/reactos - $(HALFVERBOSEECHO) [RMKDIR] $(BOOTCD_DIR)/reactos/system32 - $(RMKDIR) $(BOOTCD_DIR)/reactos/system32 - -bootcd_bootstrap_files: $(BOOT_LOADERS:%=%_bootcd) $(COMPONENTS:%=%_bootcd) \ - $(HALS:%=%_bootcd) $(BUS:%=%_bootcd) $(LIB_STATIC:%=%_bootcd) \ - $(LIB_FSLIB:%=%_bootcd) msvcrt_bootcd $(DLLS:%=%_bootcd) \ - $(KERNEL_DRIVERS:%=%_bootcd) $(SUBSYS:%=%_bootcd) $(SYS_APPS:%=%_bootcd) - -bootcd_install_before: - $(HALFVERBOSEECHO) [RLINE] bootdata/autorun.inf to $(BOOTCD_DIR)/autorun.inf - $(RLINE) bootdata/autorun.inf $(BOOTCD_DIR)/autorun.inf - $(HALFVERBOSEECHO) [RLINE] bootdata/readme.txt to $(BOOTCD_DIR)/readme.txt - $(RLINE) bootdata/readme.txt $(BOOTCD_DIR)/readme.txt - $(HALFVERBOSEECHO) [RLINE] bootdata/hivecls.inf to $(BOOTCD_DIR)/reactos/hivecls.inf - $(RLINE) bootdata/hivecls.inf $(BOOTCD_DIR)/reactos/hivecls.inf - $(HALFVERBOSEECHO) [RLINE] bootdata/hivedef.inf to $(BOOTCD_DIR)/reactos/hivedef.inf - $(RLINE) bootdata/hivedef.inf $(BOOTCD_DIR)/reactos/hivedef.inf - $(HALFVERBOSEECHO) [RLINE] bootdata/hivesft.inf to $(BOOTCD_DIR)/reactos/hivesft.inf - $(RLINE) bootdata/hivesft.inf $(BOOTCD_DIR)/reactos/hivesft.inf - $(HALFVERBOSEECHO) [RLINE] bootdata/hivesys.inf to $(BOOTCD_DIR)/reactos/hivesys.inf - $(RLINE) bootdata/hivesys.inf $(BOOTCD_DIR)/reactos/hivesys.inf - $(HALFVERBOSEECHO) [RLINE] bootdata/txtsetup.sif to $(BOOTCD_DIR)/reactos/txtsetup.sif - $(RLINE) bootdata/txtsetup.sif $(BOOTCD_DIR)/reactos/txtsetup.sif - $(HALFVERBOSEECHO) [COPY] bootdata/icon.ico to $(BOOTCD_DIR)/icon.ico - $(CP) bootdata/icon.ico $(BOOTCD_DIR)/icon.ico - $(HALFVERBOSEECHO) [COPY] subsys/system/welcome/welcome.exe to $(BOOTCD_DIR)/reactos/welcome.exe - $(CP) subsys/system/welcome/welcome.exe $(BOOTCD_DIR)/reactos/welcome.exe - $(HALFVERBOSEECHO) [COPY] subsys/system/reactos/reactos.exe to $(BOOTCD_DIR)/reactos/reactos.exe - $(CP) subsys/system/reactos/reactos.exe $(BOOTCD_DIR)/reactos/reactos.exe - $(HALFVERBOSEECHO) [COPY] media/nls/c_1252.nls to $(BOOTCD_DIR)/reactos/c_1252.nls - $(CP) media/nls/c_1252.nls $(BOOTCD_DIR)/reactos/c_1252.nls - $(HALFVERBOSEECHO) [COPY] media/nls/c_437.nls to $(BOOTCD_DIR)/reactos/c_437.nls - $(CP) media/nls/c_437.nls $(BOOTCD_DIR)/reactos/c_437.nls - $(HALFVERBOSEECHO) [COPY] media/nls/l_intl.nls to $(BOOTCD_DIR)/reactos/l_intl.nls - $(CP) media/nls/l_intl.nls $(BOOTCD_DIR)/reactos/l_intl.nls - $(HALFVERBOSEECHO) [COPY] media/drivers/etc/services to $(BOOTCD_DIR)/reactos/services - $(CP) media/drivers/etc/services $(BOOTCD_DIR)/reactos/services - -bootcd_basic: bootcd_directory_layout bootcd_bootstrap_files bootcd_install_before - -bootcd_makecd: - $(CABMAN) /C bootdata/packages/reactos.dff /L $(BOOTCD_DIR)/reactos /I - $(CABMAN) /C bootdata/packages/reactos.dff /RC $(BOOTCD_DIR)/reactos/reactos.inf /L $(BOOTCD_DIR)/reactos /N - - $(RM) $(BOOTCD_DIR)/reactos/reactos.inf - $(HALFVERBOSEECHO) [CDMAKE] ReactOS.iso - $(CDMAKE) -v -m -b $(BOOTCD_DIR)/../isoboot.bin $(BOOTCD_DIR) REACTOS ReactOS.iso - -ubootcd_unattend: - $(HALFVERBOSEECHO) [COPY] bootdata/unattend.inf to $(BOOTCD_DIR)/reactos/unattend.inf - $(CP) bootdata/unattend.inf $(BOOTCD_DIR)/reactos/unattend.inf - -livecd_directory_layout: - $(HALFVERBOSEECHO) [RMKDIR] $(LIVECD_DIR) - $(RMKDIR) $(LIVECD_DIR) - $(HALFVERBOSEECHO) [RMKDIR] $(LIVECD_DIR)/loader - $(RMKDIR) $(LIVECD_DIR)/loader - $(HALFVERBOSEECHO) [RMKDIR] $(LIVECD_DIR)/reactos - $(RMKDIR) $(LIVECD_DIR)/reactos - $(HALFVERBOSEECHO) [RMKDIR] $(LIVECD_DIR)/Profiles/All\ Users/Desktop - $(RMKDIR) $(LIVECD_DIR)/Profiles/All\ Users/Desktop - $(HALFVERBOSEECHO) [RMKDIR] $(LIVECD_DIR)/Profiles/Default\ User/Desktop - $(RMKDIR) $(LIVECD_DIR)/Profiles/Default\ User/Desktop - $(HALFVERBOSEECHO) [RMKDIR] $(LIVECD_DIR)/Profiles/Default\ User/My\ Documents - $(RMKDIR) $(LIVECD_DIR)/Profiles/Default\ User/My\ Documents - $(HALFVERBOSEECHO) [COPY] ${FREELDR_DIR}/bootsect/isoboot.bin to ${LIVECD_DIR}/../isoboot.bin - $(CP) ${FREELDR_DIR}/bootsect/isoboot.bin ${LIVECD_DIR}/../isoboot.bin - $(HALFVERBOSEECHO) [COPY] ${FREELDR_DIR}/freeldr/freeldr.sys to ${LIVECD_DIR}/loader/setupldr.sys - $(CP) ${FREELDR_DIR}/freeldr/freeldr.sys ${LIVECD_DIR}/loader/setupldr.sys - $(HALFVERBOSEECHO) [RLINE] bootdata/livecd.ini to $(LIVECD_DIR)/freeldr.ini - $(RLINE) bootdata/livecd.ini $(LIVECD_DIR)/freeldr.ini - -livecd_bootstrap_files: - $(MAKE) LIVECD_INSTALL=yes fastinstall - -livecd_install_before: - $(MKHIVE) bootdata $(LIVECD_DIR)/reactos/system32/config bootdata/livecd.inf bootdata/hiveinst.inf - -livecd_basic: livecd_directory_layout livecd_bootstrap_files livecd_install_before - -livecd_makecd: - $(HALFVERBOSEECHO) [CDMAKE] roslive.iso - $(CDMAKE) -m -j -b $(LIVECD_DIR)/../isoboot.bin $(LIVECD_DIR) REACTOS roslive.iso - -bootcd: bootcd_basic bootcd_makecd - -ubootcd: bootcd_basic ubootcd_unattend bootcd_makecd - -livecd: livecd_basic livecd_makecd - -registry: tools - $(MKHIVE) bootdata $(INSTALL_DIR)/system32/config bootdata/hiveinst.inf - -.PHONY: all bootstrap depends implib test clean clean_before install bootcd_directory_layout \ -bootcd_bootstrap_files bootcd_install_before bootcd_basic bootcd_makecd ubootcd_unattend bootcd - - -# -# Boot Loaders -# -$(BOOT_LOADERS): %: - $(MAKE) -C boot/$* - -$(BOOT_LOADERS:%=%_test): %_test: - $(MAKE) -C boot/$* test - -$(BOOT_LOADERS:%=%_clean): %_clean: - $(MAKE) -C boot/$* clean - -$(BOOT_LOADERS:%=%_bootcd): %_bootcd: - $(MAKE) -C boot/$* bootcd - -.PHONY: $(BOOT_LOADERS) $(BOOT_LOADERS:%=%_test) $(BOOT_LOADERS:%=%_clean) \ - $(BOOT_LOADERS:%=%_bootcd) - -$(COMPONENTS): dk - -# -# System Applications -# -$(SYS_APPS): %: $(IMPLIB) - $(MAKE) -C subsys/system/$* - -$(SYS_APPS:%=%_implib): %_implib: dk - $(MAKE) --silent -C subsys/system/$* implib - -$(SYS_APPS:%=%_test): %_test: - $(MAKE) -C subsys/system/$* test - -$(SYS_APPS:%=%_clean): %_clean: - $(MAKE) -C subsys/system/$* clean - -$(SYS_APPS:%=%_install): %_install: - $(MAKE) -C subsys/system/$* install - -$(SYS_APPS:%=%_bootcd): %_bootcd: - $(MAKE) -C subsys/system/$* bootcd - -.PHONY: $(SYS_APPS) $(SYS_APPS:%=%_implib) $(SYS_APPS:%=%_test) \ - $(SYS_APPS:%=%_clean) $(SYS_APPS:%=%_install) $(SYS_APPS:%=%_bootcd) - -# -# System Services -# -$(SYS_SVC): %: $(IMPLIB) - $(MAKE) -C services/$* - -$(SYS_SVC:%=%_depends): %_depends: - $(MAKE) -C services/$* depends - -$(SYS_SVC:%=%_implib): %_implib: dk - $(MAKE) --silent -C services/$* implib - -$(SYS_SVC:%=%_test): %_test: - $(MAKE) -C services/$* test - -$(SYS_SVC:%=%_clean): %_clean: - $(MAKE) -C services/$* clean - -$(SYS_SVC:%=%_install): %_install: - $(MAKE) -C services/$* install - -.PHONY: $(SYS_SVC) $(SYS_SVC:%=%_depends) $(SYS_SVC:%=%_implib) \ - $(SYS_SVC:%=%_test) $(SYS_SVC:%=%_clean) $(SYS_SVC:%=%_install) - - -# -# Applications -# -# -# Extra (optional system) Applications -# -$(APPS): %: $(IMPLIB) - $(MAKE) -C apps/$* - -# Not needed -# $(APPS:%=%_implib): %_implib: dk -# $(MAKE) --silent -C apps/$* implib - -$(APPS:%=%_test): %_test: - $(MAKE) -C apps/$* test - -$(APPS:%=%_clean): %_clean: - $(MAKE) -C apps/$* clean - -$(APPS:%=%_install): %_install: - $(MAKE) -C apps/$* install - -.PHONY: $(APPS) $(APPS:%=%_test) $(APPS:%=%_clean) $(APPS:%=%_install) - - -# -# External ports and subsystem personalities -# -$(EXTERNALS): %: - $(MAKE) -C $(ROOT_PATH)/$* - -$(EXTERNALS:%=%_depends): %_depends: - $(MAKE) -C $(ROOT_PATH)/$* depends - -$(EXTERNALS:%=%_implib): %_implib: dk - $(MAKE) --silent -C $(ROOT_PATH)/$* implib - -$(EXTERNALS:%=%_clean): %_clean: - $(MAKE) -C $(ROOT_PATH)/$* clean - -$(EXTERNALS:%=%_install): %_install: - $(MAKE) -C $(ROOT_PATH)/$* install - -.PHONY: $(EXTERNALS) $(EXTERNALS:%=%_depends) $(EXTERNALS:%=%_implib) $(EXTERNALS:%=%_clean) $(EXTERNALS:%=%_install) - - -# -# Tools -# -tools: - $(MAKE) --silent -C tools - -tools_implib: - - -tools_test: - - -tools_clean: - $(MAKE) -C tools clean - -tools_install: - -.PHONY: tools tools_implib tools_test tools_clean tools_install - - -# -# Developer Kits -# -dk: tools - @$(RMKDIR) $(DK_PATH) - @$(RMKDIR) $(DDK_PATH) - @$(RMKDIR) $(DDK_PATH_LIB) - @$(RMKDIR) $(DDK_PATH_INC) - @$(RMKDIR) $(SDK_PATH) - @$(RMKDIR) $(SDK_PATH_LIB) - @$(RMKDIR) $(SDK_PATH_INC) - @$(RMKDIR) $(XDK_PATH) - @$(RMKDIR) $(XDK_PATH_LIB) -# @$(RMKDIR) $(XDK_PATH_INC) - -dk_implib: - -# WARNING! Be very sure that there are no important files -# in these directories before cleaning them!!! -dk_clean: - $(HALFVERBOSEECHO) [RM] $(DDK_PATH_LIB)/*.a - $(RM) $(DDK_PATH_LIB)/*.a -# $(HALFVERBOSEECHO) [RM] $(DDK_PATH_INC)/*.h -# $(RM) $(DDK_PATH_INC)/*.h - $(HALFVERBOSEECHO) [RMDIR] $(DDK_PATH_LIB) - $(RMDIR) $(DDK_PATH_LIB) -# $(HALFVERBOSEECHO) [RMDIR] $(DDK_PATH_INC) -# $(RMDIR) $(DDK_PATH_INC) - $(HALFVERBOSEECHO) [RM] $(SDK_PATH_LIB)/*.a - $(RM) $(SDK_PATH_LIB)/*.a -# $(HALFVERBOSEECHO) [RM] $(SDK_PATH_INC)/*.h -# $(RM) $(SDK_PATH_INC)/*.h - $(HALFVERBOSEECHO) [RMDIR] $(SDK_PATH_LIB) - $(RMDIR) $(SDK_PATH_LIB) -# $(HALFVERBOSEECHO) [RMDIR] $(SDK_PATH_INC) -# $(RMDIR) $(SDK_PATH_INC) - $(HALFVERBOSEECHO) [RM] $(XDK_PATH_LIB)/*.a - $(RM) $(XDK_PATH_LIB)/*.a -# $(HALFVERBOSEECHO) [RM] $(XDK_PATH_INC)/*.h -# $(RM) $(XDK_PATH_INC)/*.h - $(HALFVERBOSEECHO) [RMDIR] $(XDK_PATH_LIB) - $(RMDIR) $(XDK_PATH_LIB) -# $(HALFVERBOSEECHO) [RMDIR] $(XDK_PATH_INC) -# $(RMDIR) $(XDK_PATH_INC) - -dk_install: - -.PHONY: dk dk_implib dk_clean dk_install - - -# -# Interfaces -# -iface_native: - $(MAKE) --silent -C tools/nci - -iface_native_implib: - -iface_native_test: - -iface_native_clean: - $(MAKE) --silent -C tools/nci clean - -iface_native_install: - -iface_native_bootcd: - -.PHONY: iface_native iface_native_implib iface_native_test iface_native_clean \ - iface_native_install iface_native_bootcd - - -# -# Bus driver rules -# -$(BUS): %: $(IMPLIB) - $(MAKE) -C drivers/bus/$* - -$(BUS:%=%_implib): %_implib: dk - $(MAKE) --silent -C drivers/bus/$* implib - -$(BUS:%=%_test): %_test: - $(MAKE) -C drivers/bus/$* test - -$(BUS:%=%_clean): %_clean: - $(MAKE) -C drivers/bus/$* clean - -$(BUS:%=%_install): %_install: - $(MAKE) -C drivers/bus/$* install - -$(BUS:%=%_bootcd): %_bootcd: - $(MAKE) -C drivers/bus/$* bootcd - -.PHONY: $(BUS) $(BUS:%=%_implib) $(BUS:%=%_clean) \ - $(BUS:%=%_install) $(BUS:%=%_bootcd) - - -# -# Driver support libraries rules -# -$(DRIVERS_LIB): %: $(IMPLIB) - $(MAKE) -C drivers/lib/$* - -$(DRIVERS_LIB:%=%_implib): %_implib: dk - $(MAKE) --silent -C drivers/lib/$* implib - -$(DRIVERS_LIB:%=%_test): %_test: - $(MAKE) -C drivers/lib/$* test - -$(DRIVERS_LIB:%=%_clean): %_clean: - $(MAKE) -C drivers/lib/$* clean - -$(DRIVERS_LIB:%=%_install): %_install: - $(MAKE) -C drivers/lib/$* install - -$(DRIVERS_LIB:%=%_bootcd): %_bootcd: - $(MAKE) -C drivers/lib/$* bootcd - -.PHONY: $(DRIVERS_LIB) $(DRIVERS_LIB:%=%_implib) $(DRIVERS_LIB:%=%_test) \ - $(DRIVERS_LIB:%=%_clean) $(DRIVERS_LIB:%=%_install) $(DRIVERS_LIB:%=%_bootcd) - - -# -# Device driver rules -# -$(DEVICE_DRIVERS): %: $(IMPLIB) - $(MAKE) -C drivers/dd/$* - -$(DEVICE_DRIVERS:%=%_implib): %_implib: dk - $(MAKE) --silent -C drivers/dd/$* implib - -$(DEVICE_DRIVERS:%=%_test): %_test: - $(MAKE) -C drivers/dd/$* test - -$(DEVICE_DRIVERS:%=%_clean): %_clean: - $(MAKE) -C drivers/dd/$* clean - -$(DEVICE_DRIVERS:%=%_install): %_install: - $(MAKE) -C drivers/dd/$* install - -$(DEVICE_DRIVERS:%=%_bootcd): %_bootcd: - $(MAKE) -C drivers/dd/$* bootcd - -.PHONY: $(DEVICE_DRIVERS) $(DEVICE_DRIVERS:%=%_implib) $(DEVICE_DRIVERS:%=%_test) \ - $(DEVICE_DRIVERS:%=%_clean) $(DEVICE_DRIVERS:%=%_install) $(DEVICE_DRIVERS:%=%_bootcd) - - -# -# Video device driver rules -# -VIDEO_DRIVERS: $(IMPLIB) - $(MAKE) -C drivers/video - -VIDEO_DRIVERS_implib: dk - $(MAKE) --silent -C drivers/video implib - -VIDEO_DRIVERS_test: - $(MAKE) -C drivers/video test - -VIDEO_DRIVERS_clean: - $(MAKE) -C drivers/video clean - -VIDEO_DRIVERS_install: - $(MAKE) -C drivers/video install - -VIDEO_DRIVERS_bootcd: - $(MAKE) -C drivers/video bootcd - -.PHONY: VIDEO_DRIVERS VIDEO_DRIVERS_implib VIDEO_DRIVERS_test\ - VIDEO_DRIVERS_clean VIDEO_DRIVERS_install VIDEO_DRIVERS_bootcd - -# -# USB device driver rules -# -USB_DRIVERS: $(IMPLIB) - $(MAKE) -C drivers/usb - -USB_DRIVERS_implib: dk - $(MAKE) --silent -C drivers/usb implib - -USB_DRIVERS_test: - $(MAKE) -C drivers/usb test - -USB_DRIVERS_clean: - $(MAKE) -C drivers/usb clean - -USB_DRIVERS_install: - $(MAKE) -C drivers/usb install - -USB_DRIVERS_bootcd: - $(MAKE) -C drivers/usb bootcd - -.PHONY: USB_DRIVERS USB_DRIVERS_implib USB_DRIVERS_test\ - USB_DRIVERS_clean USB_DRIVERS_install USB_DRIVERS_bootcd - - -# -# Input driver rules -# -$(INPUT_DRIVERS): %: $(IMPLIB) - $(MAKE) -C drivers/input/$* - -$(INPUT_DRIVERS:%=%_implib): %_implib: dk - $(MAKE) --silent -C drivers/input/$* implib - -$(INPUT_DRIVERS:%=%_test): %_test: - $(MAKE) -C drivers/input/$* test - -$(INPUT_DRIVERS:%=%_clean): %_clean: - $(MAKE) -C drivers/input/$* clean - -$(INPUT_DRIVERS:%=%_install): %_install: - $(MAKE) -C drivers/input/$* install - -$(INPUT_DRIVERS:%=%_bootcd): %_bootcd: - $(MAKE) -C drivers/input/$* bootcd - -.PHONY: $(INPUT_DRIVERS) $(INPUT_DRIVERS:%=%_implib) $(INPUT_DRIVERS:%=%_test) \ - $(INPUT_DRIVERS:%=%_clean) $(INPUT_DRIVERS:%=%_install) $(INPUT_DRIVERS:%=%_bootcd) - -# -# Filesystem driver rules -# -$(FS_DRIVERS): %: $(IMPLIB) - $(MAKE) -C drivers/fs/$* - -$(FS_DRIVERS:%=%_implib): %_implib: dk - $(MAKE) --silent -C drivers/fs/$* implib - -$(FS_DRIVERS:%=%_test): %_test: - $(MAKE) -C drivers/fs/$* test - -$(FS_DRIVERS:%=%_clean): %_clean: - $(MAKE) -C drivers/fs/$* clean - -$(FS_DRIVERS:%=%_install): %_install: - $(MAKE) -C drivers/fs/$* install - -$(FS_DRIVERS:%=%_bootcd): %_bootcd: - $(MAKE) -C drivers/fs/$* bootcd - -.PHONY: $(FS_DRIVERS) $(FS_DRIVERS:%=%_implib) $(FS_DRIVERS:%=%_test) \ - $(FS_DRIVERS:%=%_clean) $(FS_DRIVERS:%=%_install) $(FS_DRIVERS:%=%_bootcd) - - -# -# Network driver rules -# -$(NET_DRIVERS): %: $(IMPLIB) - $(MAKE) -C drivers/net/$* - -$(NET_DRIVERS:%=%_implib): %_implib: dk - $(MAKE) --silent -C drivers/net/$* implib - -$(NET_DRIVERS:%=%_test): %_test: - $(MAKE) -C drivers/net/$* test - -$(NET_DRIVERS:%=%_clean): %_clean: - $(MAKE) -C drivers/net/$* clean - -$(NET_DRIVERS:%=%_install): %_install: - $(MAKE) -C drivers/net/$* install - -$(NET_DRIVERS:%=%_bootcd): %_bootcd: - $(MAKE) -C drivers/net/$* bootcd - -.PHONY: $(NET_DRIVERS) $(NET_DRIVERS:%=%_implib) $(NET_DRIVERS:%=%_test) \ - $(NET_DRIVERS:%=%_clean) $(NET_DRIVERS:%=%_install) $(NET_DRIVERS:%=%_bootcd) - - -# -# Network device driver rules -# -$(NET_DEVICE_DRIVERS): %: $(IMPLIB) - $(MAKE) -C drivers/net/dd/$* - -$(NET_DEVICE_DRIVERS:%=%_implib): %_implib: dk - $(MAKE) --silent -C drivers/net/dd/$* implib - -$(NET_DEVICE_DRIVERS:%=%_test): %_test: - $(MAKE) -C drivers/net/dd/$* test - -$(NET_DEVICE_DRIVERS:%=%_clean): %_clean: - $(MAKE) -C drivers/net/dd/$* clean - -$(NET_DEVICE_DRIVERS:%=%_install): %_install: - $(MAKE) -C drivers/net/dd/$* install - -$(NET_DEVICE_DRIVERS:%=%_bootcd): %_bootcd: - $(MAKE) -C drivers/net/dd/$* bootcd - -.PHONY: $(NET_DEVICE_DRIVERS) $(NET_DEVICE_DRIVERS:%=%_clean) \ - $(NET_DEVICE_DRIVERS:%=%_implib) $(NET_DEVICE_DRIVERS:%=%_test) \ - $(NET_DEVICE_DRIVERS:%=%_install) $(NET_DEVICE_DRIVERS:%=%_bootcd) - - -# -# storage driver rules -# -$(STORAGE_DRIVERS): %: $(IMPLIB) - $(MAKE) -C drivers/storage/$* - -$(STORAGE_DRIVERS:%=%_implib): %_implib: dk - $(MAKE) --silent -C drivers/storage/$* implib - -$(STORAGE_DRIVERS:%=%_test): %_test: - $(MAKE) -C drivers/storage/$* test - -$(STORAGE_DRIVERS:%=%_clean): %_clean: - $(MAKE) -C drivers/storage/$* clean - -$(STORAGE_DRIVERS:%=%_install): %_install: - $(MAKE) -C drivers/storage/$* install - -$(STORAGE_DRIVERS:%=%_bootcd): %_bootcd: - $(MAKE) -C drivers/storage/$* bootcd - -.PHONY: $(STORAGE_DRIVERS) $(STORAGE_DRIVERS:%=%_clean) \ - $(STORAGE_DRIVERS:%=%_implib) $(STORAGE_DRIVERS:%=%_test) \ - $(STORAGE_DRIVERS:%=%_install) $(STORAGE_DRIVERS:%=%_bootcd) - - -# -# Required system components -# -ntoskrnl: bootstrap - $(MAKE) -C ntoskrnl - -ntoskrnl_implib: dk - $(MAKE) --silent -C ntoskrnl implib - -ntoskrnl_test: - $(MAKE) -C ntoskrnl test - -ntoskrnl_clean: - $(MAKE) -C ntoskrnl clean - -ntoskrnl_install: - $(MAKE) -C ntoskrnl install - -ntoskrnl_bootcd: - $(MAKE) -C ntoskrnl bootcd - -.PHONY: ntoskrnl ntoskrnl_implib ntoskrnl_test \ - ntoskrnl_clean ntoskrnl_install ntoskrnl_bootcd - - -# -# Hardware Abstraction Layer import library -# -hallib: $(PATH_TO_TOP)/include/roscfg.h ntoskrnl_implib - $(MAKE) --silent -C hal/hal - -hallib_implib: dk ntoskrnl_implib - $(MAKE) --silent -C hal/hal implib - -hallib_test: - $(MAKE) -C hal/hal test - -hallib_clean: - $(MAKE) -C hal/hal clean - -hallib_install: - $(MAKE) -C hal/hal install - -hallib_bootcd: - $(MAKE) -C hal/hal bootcd - -.PHONY: hallib hallib_implib hallib_test hallib_clean \ - hallib_install hallib_bootcd - - -# -# Hardware Abstraction Layers -# -ifeq ($(CONFIG_SMP),1) -halx86: halx86/mp -else -halx86: halx86/up +ifneq ($(ROS_INTERMEDIATE),) +$(ROS_INTERMEDIATE): + ${nmkdir} $(ROS_INTERMEDIATE) endif -$(HALS): %: $(IMPLIB) - $(MAKE) -C hal/$* - -$(HALS:%=%_implib): %_implib: dk - $(MAKE) --silent -C hal/$* implib - -$(HALS:%=%_test): %_test: - $(MAKE) -C hal/$* test - -$(HALS:%=%_clean): %_clean: - $(MAKE) -C hal/$* clean - -$(HALS:%=%_install): %_install: - $(MAKE) -C hal/$* install - -$(HALS:%=%_bootcd): %_bootcd: - $(MAKE) -C hal/$* bootcd - -.PHONY: $(HALS) $(HALS:%=%_implib) $(HALS:%=%_test) \ - $(HALS:%=%_clean) $(HALS:%=%_install) $(HALS:%=%_bootcd) - - -# -# File system libraries -# -$(LIB_FSLIB): %: dk - $(MAKE) -C lib/fslib/$* - -$(LIB_FSLIB:%=%_depends): %_depends: - $(MAKE) -C lib/fslib/$* depends - -$(LIB_FSLIB:%=%_implib): %_implib: dk - $(MAKE) --silent -C lib/fslib/$* implib - -$(LIB_FSLIB:%=%_test): %_test: - $(MAKE) -C lib/fslib/$* test - -$(LIB_FSLIB:%=%_clean): %_clean: - $(MAKE) -C lib/fslib/$* clean - -$(LIB_FSLIB:%=%_install): %_install: - $(MAKE) -C lib/fslib/$* install - -$(LIB_FSLIB:%=%_bootcd): %_bootcd: - $(MAKE) -C lib/fslib/$* bootcd - -.PHONY: $(LIB_FSLIB) $(LIB_FSLIB:%=%_depends) $(LIB_FSLIB:%=%_implib) \ - $(LIB_FSLIB:%=%_test) $(LIB_FSLIB:%=%_clean) \ - $(LIB_FSLIB:%=%_install) $(LIB_FSLIB:%=%_bootcd) - - -# -# Static libraries -# -$(LIB_STATIC): %: dk - $(MAKE) --silent -C lib/$* - -$(LIB_STATIC:%=%_depends): %_depends: - $(MAKE) -C lib/string depends - -$(LIB_STATIC:%=%_implib): %_implib: dk - $(MAKE) --silent -C lib/$* implib - -$(LIB_STATIC:%=%_test): %_test: - $(MAKE) -C lib/$* test - -$(LIB_STATIC:%=%_clean): %_clean: - $(MAKE) -C lib/$* clean - -$(LIB_STATIC:%=%_install): %_install: - $(MAKE) -C lib/$* install - -$(LIB_STATIC:%=%_bootcd): %_bootcd: - $(MAKE) -C lib/$* bootcd - -.PHONY: $(LIB_STATIC) $(LIB_STATIC:%=%_depends) $(LIB_STATIC:%=%_implib) \ - $(LIB_STATIC:%=%_test) $(LIB_STATIC:%=%_clean) \ - $(LIB_STATIC:%=%_install) $(LIB_STATIC:%=%_bootcd) - - -# -# MSVCRT is seperate since CRTDLL depend on this -# -msvcrt: $(IMPLIB) - $(MAKE) -C lib/msvcrt - -msvcrt_depends: - $(MAKE) -C lib/msvcrt depends - -msvcrt_implib: dk - $(MAKE) --silent -C lib/msvcrt implib - -msvcrt_test: - $(MAKE) -C lib/msvcrt test - -msvcrt_clean: - $(MAKE) -C lib/msvcrt clean - -msvcrt_install: - $(MAKE) -C lib/msvcrt install - -msvcrt_bootcd: - $(MAKE) -C lib/msvcrt bootcd - -.PHONY: msvcrt msvcrt_depends msvcrt_implib msvcrt_test \ - msvcrt_clean msvcrt_install msvcrt_bootcd - - -# -# DLLs -# -$(DLLS): %: $(IMPLIB) msvcrt - $(MAKE) -C lib/$* - -$(DLLS:%=%_depends): %_depends: - $(MAKE) -C lib/$* depends - -$(DLLS:%=%_implib): %_implib: dk - $(MAKE) --silent -C lib/$* implib - -$(DLLS:%=%_test): %_test: - $(MAKE) -C lib/$* test - -$(DLLS:%=%_clean): %_clean: - $(MAKE) -C lib/$* clean - -$(DLLS:%=%_install): %_install: - $(MAKE) -C lib/$* install - -$(DLLS:%=%_bootcd): %_bootcd: - $(MAKE) -C lib/$* bootcd - -.PHONY: $(DLLS) $(DLLS:%=%_depends) $(DLLS:%=%_implib) $(DLLS:%=%_test) \ - $(DLLS:%=%_clean) $(DLLS:%=%_install) $(DLLS:%=%_bootcd) - - -# -# Subsystem support modules -# -$(SUBSYS): %: $(IMPLIB) - $(MAKE) -C subsys/$* - -$(SUBSYS:%=%_depends): %_depends: - $(MAKE) -C subsys/$* depends - -$(SUBSYS:%=%_implib): %_implib: dk - $(MAKE) --silent -C subsys/$* implib - -$(SUBSYS:%=%_test): %_test: - $(MAKE) -C subsys/$* test - -$(SUBSYS:%=%_clean): %_clean: - $(MAKE) -C subsys/$* clean - -$(SUBSYS:%=%_install): %_install: - $(MAKE) -C subsys/$* install - -$(SUBSYS:%=%_bootcd): %_bootcd: - $(MAKE) -C subsys/$* bootcd - -.PHONY: $(SUBSYS) $(SUBSYS:%=%_depends) $(SUBSYS:%=%_implib) $(SUBSYS:%=%_test) \ - $(SUBSYS:%=%_clean) $(SUBSYS:%=%_install) $(SUBSYS:%=%_bootcd) - -# -# Regression testsuite -# - -$(REGTESTS): %: $(IMPLIB) - $(MAKE) --silent -C regtests - -$(REGTESTS:%=%_implib): %_implib: dk - $(MAKE) --silent -C regtests implib - -$(REGTESTS:%=%_clean): %_clean: - $(MAKE) -C regtests clean - -$(REGTESTS:%=%_install): %_install: - $(MAKE) -C regtests install - -.PHONY: $(REGTESTS) $(REGTESTS:%=%_depends) $(SUBSYS:%=%_clean) $(REGTESTS:%=%_install) - - -# -# Create an installation -# - -install_clean: - $(HALFVERBOSEECHO) [RM] $(INSTALL_DIR)/system32/drivers/*.* - $(RM) $(INSTALL_DIR)/system32/drivers/*.* - $(HALFVERBOSEECHO) [RM] $(INSTALL_DIR)/system32/config/*.* - $(RM) $(INSTALL_DIR)/system32/config/*.* - $(HALFVERBOSEECHO) [RM] $(INSTALL_DIR)/system32/*.* - $(RM) $(INSTALL_DIR)/system32/*.* - $(HALFVERBOSEECHO) [RM] $(INSTALL_DIR)/media/fonts/*.* - $(RM) $(INSTALL_DIR)/media/fonts/*.* - $(HALFVERBOSEECHO) [RM] $(INSTALL_DIR)/media/*.* - $(RM) $(INSTALL_DIR)/media/*.* - $(HALFVERBOSEECHO) [RM] $(INSTALL_DIR)/inf/*.* - $(RM) $(INSTALL_DIR)/inf/*.* - $(HALFVERBOSEECHO) [RM] $(INSTALL_DIR)/bin/*.* - $(RM) $(INSTALL_DIR)/bin/*.* - $(HALFVERBOSEECHO) [RMDIR] $(INSTALL_DIR)/system32/drivers - $(RMDIR) $(INSTALL_DIR)/system32/drivers - $(HALFVERBOSEECHO) [RMDIR] $(INSTALL_DIR)/system32/config - $(RMDIR) $(INSTALL_DIR)/system32/config - $(HALFVERBOSEECHO) [RMDIR] $(INSTALL_DIR)/system32 - $(RMDIR) $(INSTALL_DIR)/system32 - $(HALFVERBOSEECHO) [RMDIR] $(INSTALL_DIR)/media/fonts - $(RMDIR) $(INSTALL_DIR)/media/fonts - $(HALFVERBOSEECHO) [RMDIR] $(INSTALL_DIR)/media - $(RMDIR) $(INSTALL_DIR)/media - $(HALFVERBOSEECHO) [RMDIR] $(INSTALL_DIR)/inf - $(RMDIR) $(INSTALL_DIR)/inf - $(HALFVERBOSEECHO) [RMDIR] $(INSTALL_DIR)/bin - $(RMDIR) $(INSTALL_DIR)/bin - $(HALFVERBOSEECHO) [RMDIR] $(INSTALL_DIR) - $(RMDIR) $(INSTALL_DIR) - -install_dirs: - $(HALFVERBOSEECHO) [RMKDIR] $(INSTALL_DIR) - $(RMKDIR) $(INSTALL_DIR) - $(HALFVERBOSEECHO) [RMKDIR] $(INSTALL_DIR)/bin - $(RMKDIR) $(INSTALL_DIR)/bin - $(HALFVERBOSEECHO) [RMKDIR] $(INSTALL_DIR)/inf - $(RMKDIR) $(INSTALL_DIR)/inf - $(HALFVERBOSEECHO) [RMKDIR] $(INSTALL_DIR)/media - $(RMKDIR) $(INSTALL_DIR)/media - $(HALFVERBOSEECHO) [RMKDIR] $(INSTALL_DIR)/media/fonts - $(RMKDIR) $(INSTALL_DIR)/media/fonts - $(HALFVERBOSEECHO) [RMKDIR] $(INSTALL_DIR)/system32 - $(RMKDIR) $(INSTALL_DIR)/system32 - $(HALFVERBOSEECHO) [RMKDIR] $(INSTALL_DIR)/system32/config - $(RMKDIR) $(INSTALL_DIR)/system32/config - $(HALFVERBOSEECHO) [RMKDIR] $(INSTALL_DIR)/system32/drivers - $(RMKDIR) $(INSTALL_DIR)/system32/drivers - $(HALFVERBOSEECHO) [RMKDIR] $(INSTALL_DIR)/system32/drivers/etc - $(RMKDIR) $(INSTALL_DIR)/system32/drivers/etc - -install_before: - $(HALFVERBOSEECHO) [INSTALL] media/inf to $(INSTALL_DIR)/inf - $(CP) media/inf $(INSTALL_DIR)/inf - $(HALFVERBOSEECHO) [INSTALL] media/fonts to $(INSTALL_DIR)/media/fonts - $(CP) media/fonts $(INSTALL_DIR)/media/fonts - $(HALFVERBOSEECHO) [INSTALL] media/nls to $(INSTALL_DIR)/system32 - $(CP) media/nls $(INSTALL_DIR)/system32 - $(HALFVERBOSEECHO) [INSTALL] media/nls/c_1252.nls to $(INSTALL_DIR)/system32/ansi.nls - $(CP) media/nls/c_1252.nls $(INSTALL_DIR)/system32/ansi.nls - $(HALFVERBOSEECHO) [INSTALL] media/nls/c_437.nls to $(INSTALL_DIR)/system32/oem.nls - $(CP) media/nls/c_437.nls $(INSTALL_DIR)/system32/oem.nls - $(HALFVERBOSEECHO) [INSTALL] media/nls/l_intl.nls to $(INSTALL_DIR)/system32/casemap.nls - $(CP) media/nls/l_intl.nls $(INSTALL_DIR)/system32/casemap.nls - $(HALFVERBOSEECHO) [INSTALL] media/drivers/etc/services to $(INSTALL_DIR)/system32/drivers/etc/services - $(CP) media/drivers/etc/services $(INSTALL_DIR)/system32/drivers/etc/services - -.PHONY: install_clean install_dirs install_before - - -etags: - find . -name "*.[ch]" -print | etags --language=c - - - -docu: - echo generating ReactOS NTOSKRNL documentation ... - $(MAKE) -C ntoskrnl docu - - echo generating ReactOS drivers documentation ... - $(MAKE) -C drivers docu - - echo generating ReactOS NTDLL documentation ... - $(MAKE) -C lib/ntdll docu - - echo generating ReactOS Freetype documentation ... - $(MAKE) -C lib/freetype docu - - echo generating ReactOS libs documentation ... - $(MAKE) -C lib docu +include tools/Makefile +-include Makefile.auto - echo generating ReactOS WIN32K documentation ... - $(MAKE) -C subsys/win32k docu +PREAUTO := \ + include$(SEP)reactos$(SEP)buildno.h \ + include$(SEP)reactos$(SEP)bugcodes.h \ + ntoskrnl$(SEP)bugcodes.rc \ + include$(SEP)reactos$(SEP)errcodes.h \ + lib$(SEP)kernel32$(SEP)errcodes.rc - Makefile.auto: $(RMKDIR_TARGET) $(BUILDNO_TARGET) $(NCI_SERVICE_FILES) $(WMC_TARGET) $(CDMAKE_TARGET) $(RBUILD_TARGET) $(PREAUTO) - echo generating ReactOS apps+tools documentation ... - $(MAKE) -C apps docu ++Makefile.auto: $(RMKDIR_TARGET) $(BUILDNO_TARGET) $(NCI_SERVICE_FILES) $(WMC_TARGET) $(WRC_TARGET) \ ++ $(CDMAKE_TARGET) $(RBUILD_TARGET) $(PREAUTO) + tools$(SEP)rbuild$(SEP)rbuild$(EXEPOSTFIX) mingw +# $(MAKE) $(MAKECMDGOALS) - echo generating ReactOS explorer documentation ... - $(MAKE) -C subsys/system/explorer full-docu - echo generating remaining ReactOS documentation ... - doxygen Doxyfile +include$(SEP)reactos$(SEP)bugcodes.h ntoskrnl$(SEP)bugcodes.rc: $(WMC_TARGET) ntoskrnl$(SEP)ntoskrnl.mc + $(WMC_TARGET) -H include$(SEP)reactos$(SEP)bugcodes.h -o ntoskrnl$(SEP)bugcodes.rc ntoskrnl$(SEP)ntoskrnl.mc -.PHONY: docu +include$(SEP)reactos$(SEP)errcodes.h lib$(SEP)kernel32$(SEP)errcodes.rc: $(WMC_TARGET) lib$(SEP)kernel32$(SEP)kernel32.mc + $(WMC_TARGET) -H include$(SEP)reactos$(SEP)errcodes.h -o lib$(SEP)kernel32$(SEP)errcodes.rc lib$(SEP)kernel32$(SEP)kernel32.mc -include $(TOOLS_PATH)/config.mk +.PHONY: makefile_auto_clean +makefile_auto_clean: + -@$(rm) Makefile.auto $(PREAUTO) 2>$(NUL) +clean: makefile_auto_clean diff --cc reactos/drivers/fs/np/create.c index 4c18f268e5f,cda16fe846a..106c511cdc0 --- a/reactos/drivers/fs/np/create.c +++ b/reactos/drivers/fs/np/create.c @@@ -48,17 -48,17 +48,18 @@@ static PNPFS_FC NpfsFindListeningServerInstance(PNPFS_PIPE Pipe) { PLIST_ENTRY CurrentEntry; -- PNPFS_FCB ServerFcb; ++ PNPFS_WAITER_ENTRY Waiter; -- CurrentEntry = Pipe->ServerFcbListHead.Flink; -- while (CurrentEntry != &Pipe->ServerFcbListHead) ++ CurrentEntry = Pipe->WaiterListHead.Flink; ++ while (CurrentEntry != &Pipe->WaiterListHead) { -- ServerFcb = CONTAINING_RECORD(CurrentEntry, NPFS_FCB, FcbListEntry); -- if (ServerFcb->PipeState == FILE_PIPE_LISTENING_STATE) ++ Waiter = CONTAINING_RECORD(CurrentEntry, NPFS_WAITER_ENTRY, Entry); ++ if (Waiter->Fcb->PipeState == FILE_PIPE_LISTENING_STATE) { -- DPRINT("Server found! Fcb %p\n", ServerFcb); -- return ServerFcb; ++ DPRINT("Server found! Fcb %p\n", Waiter->Fcb); ++ return Waiter->Fcb; } ++ CurrentEntry = CurrentEntry->Flink; } @@@ -66,6 -66,6 +67,35 @@@ } ++static VOID ++NpfsSignalAndRemoveListeningServerInstance(PNPFS_PIPE Pipe, ++ PNPFS_FCB Fcb) ++{ ++ PLIST_ENTRY CurrentEntry; ++ PNPFS_WAITER_ENTRY Waiter; ++ ++ CurrentEntry = Pipe->WaiterListHead.Flink; ++ while (CurrentEntry != &Pipe->WaiterListHead) ++ { ++ Waiter = CONTAINING_RECORD(CurrentEntry, NPFS_WAITER_ENTRY, Entry); ++ if (Waiter->Fcb == Fcb) ++ { ++ DPRINT("Server found! Fcb %p\n", Waiter->Fcb); ++ ++ KeSetEvent(Waiter->Irp->UserEvent, 0, FALSE); ++ Waiter->Irp->UserIosb->Status = FILE_PIPE_CONNECTED_STATE; ++ Waiter->Irp->UserIosb->Information = 0; ++ IoCompleteRequest(Waiter->Irp, IO_NO_INCREMENT); ++ ++ RemoveEntryList(&Waiter->Entry); ++ ExFreePool(Waiter); ++ return; ++ } ++ CurrentEntry = CurrentEntry->Flink; ++ } ++} ++ ++ NTSTATUS STDCALL NpfsCreate(PDEVICE_OBJECT DeviceObject, PIRP Irp) @@@ -206,9 -206,9 +236,8 @@@ ClientFcb->PipeState = FILE_PIPE_CONNECTED_STATE; ServerFcb->PipeState = FILE_PIPE_CONNECTED_STATE; -- /* Wake server thread */ -- DPRINT("Setting the ConnectEvent for %x\n", ServerFcb); -- KeSetEvent(&ServerFcb->ConnectEvent, 0, FALSE); ++ /* Signal the server thread and remove it from the waiter list */ ++ NpfsSignalAndRemoveListeningServerInstance(Pipe, ServerFcb); } KeUnlockMutex(&Pipe->FcbListLock); @@@ -318,6 -318,6 +347,7 @@@ NpfsCreateNamedPipe(PDEVICE_OBJECT Devi InitializeListHead(&Pipe->ServerFcbListHead); InitializeListHead(&Pipe->ClientFcbListHead); ++ InitializeListHead(&Pipe->WaiterListHead); KeInitializeMutex(&Pipe->FcbListLock, 0); Pipe->PipeType = Buffer->NamedPipeType; diff --cc reactos/drivers/fs/np/fsctrl.c index 0e8e2633b54,f245fdfe75c..815198974ad --- a/reactos/drivers/fs/np/fsctrl.c +++ b/reactos/drivers/fs/np/fsctrl.c @@@ -18,8 -18,8 +18,66 @@@ /* FUNCTIONS *****************************************************************/ ++static VOID ++NpfsListeningCancelRoutine(IN PDEVICE_OBJECT DeviceObject, ++ IN PIRP Irp) ++{ ++ PNPFS_WAITER_ENTRY Waiter; ++ ++ DPRINT1("NpfsListeningCancelRoutine() called\n"); ++ /* FIXME: Not tested. */ ++ ++ Waiter = Irp->Tail.Overlay.DriverContext[0]; ++ ++ RemoveEntryList(&Waiter->Entry); ++ ExFreePool(Waiter); ++ ++ IoReleaseCancelSpinLock(Irp->CancelIrql); ++ ++ Irp->IoStatus.Status = STATUS_CANCELLED; ++ Irp->IoStatus.Information = 0; ++ IoCompleteRequest(Irp, IO_NO_INCREMENT); ++} ++ ++ ++static NTSTATUS ++NpfsAddListeningServerInstance(PIRP Irp, ++ PNPFS_FCB Fcb) ++{ ++ PNPFS_WAITER_ENTRY Entry; ++ KIRQL OldIrql; ++ ++ Entry = ExAllocatePool(NonPagedPool, sizeof(NPFS_WAITER_ENTRY)); ++ if (Entry == NULL) ++ return STATUS_INSUFFICIENT_RESOURCES; ++ ++ Entry->Irp = Irp; ++ Entry->Fcb = Fcb; ++ InsertTailList(&Fcb->Pipe->WaiterListHead, &Entry->Entry); ++ ++ IoAcquireCancelSpinLock(&OldIrql); ++ if (!Irp->Cancel) ++ { ++ Irp->Tail.Overlay.DriverContext[0] = Entry; ++ IoMarkIrpPending(Irp); ++ IoSetCancelRoutine(Irp, NpfsListeningCancelRoutine); ++ IoReleaseCancelSpinLock(OldIrql); ++ return STATUS_PENDING; ++ } ++ /* IRP has already been cancelled */ ++ IoReleaseCancelSpinLock(OldIrql); ++ ++ DPRINT1("FIXME: Remove waiter entry!\n"); ++ RemoveEntryList(&Entry->Entry); ++ ExFreePool(Entry); ++ ++ return STATUS_CANCELLED; ++} ++ ++ static NTSTATUS --NpfsConnectPipe(PNPFS_FCB Fcb) ++NpfsConnectPipe(PIRP Irp, ++ PNPFS_FCB Fcb) { PNPFS_PIPE Pipe; PLIST_ENTRY current_entry; @@@ -88,29 -88,29 +146,18 @@@ current_entry = current_entry->Flink; } -- KeUnlockMutex(&Pipe->FcbListLock); -- /* no listening client fcb found */ DPRINT("No listening client fcb found -- waiting for client\n"); Fcb->PipeState = FILE_PIPE_LISTENING_STATE; -- Status = KeWaitForSingleObject(&Fcb->ConnectEvent, -- UserRequest, -- KernelMode, -- FALSE, -- NULL); -- if (!NT_SUCCESS(Status)) -- { -- DPRINT("KeWaitForSingleObject() failed (Status %lx)\n", Status); -- return Status; -- } ++ Status = NpfsAddListeningServerInstance(Irp, Fcb); -- Fcb->PipeState = FILE_PIPE_CONNECTED_STATE; ++ KeUnlockMutex(&Pipe->FcbListLock); -- DPRINT("Client Fcb: %p\n", Fcb->OtherSide); ++ DPRINT("NpfsConnectPipe() done (Status %lx)\n", Status); -- return STATUS_PIPE_CONNECTED; ++ return Status; } @@@ -327,7 -327,7 +374,6 @@@ NpfsPeekPipe(PIRP Irp } -- NTSTATUS STDCALL NpfsFileSystemControl(PDEVICE_OBJECT DeviceObject, PIRP Irp) @@@ -366,7 -366,7 +412,7 @@@ case FSCTL_PIPE_LISTEN: DPRINT("Connecting pipe %wZ\n", &Pipe->PipeName); -- Status = NpfsConnectPipe(Fcb); ++ Status = NpfsConnectPipe(Irp, Fcb); break; case FSCTL_PIPE_PEEK: @@@ -439,12 -439,12 +485,15 @@@ Status = STATUS_UNSUCCESSFUL; } -- Irp->IoStatus.Status = Status; -- Irp->IoStatus.Information = 0; -- -- IoCompleteRequest(Irp, IO_NO_INCREMENT); ++ if (Status != STATUS_PENDING) ++ { ++ Irp->IoStatus.Status = Status; ++ Irp->IoStatus.Information = 0; ++ ++ IoCompleteRequest(Irp, IO_NO_INCREMENT); ++ } -- return(Status); ++ return Status; } diff --cc reactos/drivers/fs/np/npfs.h index f7e70f463ca,effd44d332d..1038411e2fb --- a/reactos/drivers/fs/np/npfs.h +++ b/reactos/drivers/fs/np/npfs.h @@@ -25,6 -19,6 +19,7 @@@ typedef struct _NPFS_PIP KMUTEX FcbListLock; LIST_ENTRY ServerFcbListHead; LIST_ENTRY ClientFcbListHead; ++ LIST_ENTRY WaiterListHead; ULONG PipeType; ULONG ReadMode; ULONG WriteMode; @@@ -58,6 -52,6 +53,14 @@@ typedef struct _NPFS_FC KSPIN_LOCK DataListLock; /* Data queue lock */ } NPFS_FCB, *PNPFS_FCB; ++typedef struct _NPFS_WAITER_ENTRY ++{ ++ LIST_ENTRY Entry; ++ PIRP Irp; ++ PNPFS_PIPE Pipe; ++ PNPFS_FCB Fcb; ++} NPFS_WAITER_ENTRY, *PNPFS_WAITER_ENTRY; ++ extern NPAGED_LOOKASIDE_LIST NpfsPipeDataLookasideList; diff --cc reactos/drivers/fs/np/rw.c index aab1872ff03,c52403b8e69..5338323c555 --- a/reactos/drivers/fs/np/rw.c +++ b/reactos/drivers/fs/np/rw.c @@@ -126,11 -99,14 +99,13 @@@ NpfsRead(PDEVICE_OBJECT DeviceObject while (1) { /* FIXME: check if in blocking mode */ - if (ReadFcb->ReadDataAvailable == 0) + if (Fcb->ReadDataAvailable == 0) { -- KeResetEvent(&Fcb->Event); - KeSetEvent(&ReadFcb->Event, IO_NO_INCREMENT, FALSE); - KeReleaseSpinLock(&ReadFcb->DataListLock, OldIrql); + if (Fcb->PipeState == FILE_PIPE_CONNECTED_STATE) + { + KeSetEvent(&WriterFcb->Event, IO_NO_INCREMENT, FALSE); + } + KeReleaseSpinLock(&Fcb->DataListLock, OldIrql); if (Information > 0) { Status = STATUS_SUCCESS; @@@ -202,7 -166,7 +165,8 @@@ if (Length == 0) { - KeSetEvent(&ReadFcb->Event, IO_NO_INCREMENT, FALSE); + KeSetEvent(&WriterFcb->Event, IO_NO_INCREMENT, FALSE); ++ KeResetEvent(&Fcb->Event); break; } } @@@ -223,13 -187,16 +187,28 @@@ #endif Information = CopyLength; - ReadFcb->ReadDataAvailable = 0; - ReadFcb->WriteQuotaAvailable = ReadFcb->MaxDataLength; - Fcb->ReadDataAvailable = 0; - Fcb->WriteQuotaAvailable = Fcb->MaxDataLength; ++ ++ if (Fcb->ReadDataAvailable > Length) ++ { ++ memmove(Fcb->Data, Fcb->Data + Length, ++ Fcb->ReadDataAvailable - Length); ++ Fcb->ReadDataAvailable -= Length; ++ Status = STATUS_MORE_ENTRIES; ++ } ++ else ++ { ++ Fcb->ReadDataAvailable = 0; ++ Fcb->WriteQuotaAvailable = Fcb->MaxDataLength; ++ } } if (Information > 0) { - KeSetEvent(&ReadFcb->Event, IO_NO_INCREMENT, FALSE); + if (Fcb->PipeState == FILE_PIPE_CONNECTED_STATE) + { + KeSetEvent(&WriterFcb->Event, IO_NO_INCREMENT, FALSE); + } ++ KeResetEvent(&Fcb->Event); break; } } @@@ -329,11 -289,11 +301,10 @@@ NpfsWrite(PDEVICE_OBJECT DeviceObject while(1) { - if (Fcb->WriteQuotaAvailable == 0) + if (ReaderFcb->WriteQuotaAvailable == 0) { -- KeResetEvent(&Fcb->Event); - KeSetEvent(&Fcb->OtherSide->Event, IO_NO_INCREMENT, FALSE); - KeReleaseSpinLock(&Fcb->DataListLock, OldIrql); + KeSetEvent(&ReaderFcb->Event, IO_NO_INCREMENT, FALSE); + KeReleaseSpinLock(&ReaderFcb->DataListLock, OldIrql); if (Fcb->PipeState != FILE_PIPE_CONNECTED_STATE) { Status = STATUS_PIPE_BROKEN; @@@ -396,7 -354,7 +365,8 @@@ if (Length == 0) { - KeSetEvent(&Fcb->OtherSide->Event, IO_NO_INCREMENT, FALSE); + KeSetEvent(&ReaderFcb->Event, IO_NO_INCREMENT, FALSE); ++ KeResetEvent(&Fcb->Event); break; } } @@@ -415,7 -373,7 +385,8 @@@ if (Information > 0) { - KeSetEvent(&Fcb->OtherSide->Event, IO_NO_INCREMENT, FALSE); + KeSetEvent(&ReaderFcb->Event, IO_NO_INCREMENT, FALSE); ++ KeResetEvent(&Fcb->Event); break; } } diff --cc reactos/lib/crt/crt.xml index 672e3e823fb,00000000000..bf81f99b045 mode 100644,000000..100644 --- a/reactos/lib/crt/crt.xml +++ b/reactos/lib/crt/crt.xml @@@ -1,386 -1,0 +1,385 @@@ + + . ++ include + ++ extern + + 0x600 + 0x501 + + + ++ + + + cgets.c + cprintf.c + cputs.c - cscanf.c + getch.c + getche.c + kbhit.c + putch.c + ungetch.c + + + ctype.c + isascii.c + iscntrl.c + isgraph.c + isprint.c + ispunct.c + isupper.c + isctype.c + + + chdir.c + chdrive.c + getcwd.c + getdcwd.c + getdfree.c + getdrive.c + mkdir.c + rmdir.c + wchdir.c + wgetcwd.c + wgetdcwd.c + wmkdir.c + wrmdir.c + + + abnorter.c + exhand2.c + matherr.c + unwind.c + + + chgsign.c + clearfp.c + cntrlfp.c + copysign.c + fpclass.c + fpecode.c + fpreset.c + isnan.c + logb.c + nafter.c + scalb.c + statfp.c + + + access.c + chmod.c + chsize.c + close.c + commit.c + create.c + dup.c + dup2.c + eof.c + filelen.c + fileleni.c + find.c + fmode.c + isatty.c + locking.c + lseek.c + lseeki64.c + mktemp.c + open.c + pipe.c + read.c + setmode.c + sopen.c - stubs.c ++ stubs.c + tell.c + telli64.c + umask.c + unlink.c + utime.c + waccess.c + wchmod.c + wcreate.c + wfind.c + wmktemp.c + wopen.c + write.c + wunlink.c + wutime.c + + + locale.c + + + acos.c + adjust.c + asin.c + atan2.c + cabs.c + cosh.c + exp.c + fmod.c + frexp.c + huge_val.c + hypot.c + j0_y0.c + j1_y1.c + jn_yn.c + ldexp.c + log10.c + modf.c + pow.c + sinh.c + stubs.c + tanh.c + + + hanzen.c + ischira.c + iskana.c + iskmoji.c + iskpun.c + islead.c + islwr.c + ismbal.c + ismbaln.c + ismbc.c + ismbgra.c + ismbkaln.c + ismblead.c + ismbpri.c + ismbpun.c + ismbtrl.c + isuppr.c + jistojms.c + jmstojis.c + mbbtype.c + mbccpy.c + mbclen.c + mbscat.c + mbschr.c + mbscmp.c + mbscoll.c + mbscpy.c + mbscspn.c + mbsdec.c + mbsdup.c + mbsicmp.c + mbsicoll.c + mbsinc.c + mbslen.c + mbslwr.c + mbsncat.c + mbsnccnt.c + mbsncmp.c + mbsncoll.c + mbsncpy.c + mbsnextc.c + mbsnicmp.c + mbsnicoll.c + mbsninc.c + mbsnset.c + mbspbrk.c + mbsrchr.c + mbsrev.c + mbsset.c + mbsspn.c + mbsspnp.c + mbsstr.c + mbstok.c + mbstrlen.c + mbsupr.c + + + amsg.c + assert.c + crtmain.c + environ.c + getargs.c + initterm.c + lock.c + purecall.c + stubs.c + tls.c + + + _cwait.c + _system.c + dll.c + process.c + procid.c + thread.c + threadid.c + threadx.c + + + lfind.c + lsearch.c + + + + setjmp.s + + + + signal.c + xcptinfo.c + + + allocfil.c + clearerr.c + fclose.c + fdopen.c + feof.c + ferror.c + fflush.c + fgetc.c + fgetchar.c + fgetpos.c + fgets.c + fgetws.c + filbuf.c + fileno.c + flsbuf.c + fopen.c + fprintf.c + fputc.c + fputchar.c + fputs.c + fread.c + freopen.c - fscanf.c + fseek.c + fsetpos.c + fsopen.c + ftell.c + fwalk.c + fwrite.c + getc.c + getchar.c + gets.c + getw.c + perror.c + popen.c + printf.c + putc.c + putchar.c + puts.c + putw.c + remove.c + rename.c + rewind.c + rmtmp.c - scanf.c + setbuf.c + setvbuf.c + sprintf.c - sscanf.c ++ swprintf.c + stdhnd.c + tempnam.c + tmpfile.c + tmpnam.c + ungetc.c + vfprintf.c - vfscanf.c + vfwprint.c + vprintf.c - vscanf.c + vsprintf.c - vsscanf.c ++ vswprintf.c + wfdopen.c + wrename.c + wtempnam.c + wtmpnam.c + + + _exit.c + abort.c + atexit.c + atof.c + div.c + ecvt.c + ecvtbuf.c + errno.c + fcvt.c + fcvtbuf.c + fullpath.c + gcvt.c + getenv.c + ldiv.c + makepath.c + malloc.c + mbtowc.c + obsol.c + putenv.c + rand.c + rot.c + senv.c + strtod.c + strtoul.c + swab.c + wcstod.c + wcstombs.c + wctomb.c + wfulpath.c + wputenv.c + wsenv.c + wsplitp.c + wmakpath.c + + + lasttok.c + strcoll.c + strdup.c + strerror.c + strncoll.c + strpbrk.c + strrev.c + strset.c + strstr.c + strtok.c + strupr.c + strxfrm.c + + + fstat.c + fstati64.c + futime.c + stat.c + wstat.c + systime.c + + + clock.c + ctime.c + difftime.c + ftime.c + strdate.c + strftime.c + strtime.c + time.c + tz_vars.c + wctime.c + wstrdate.c + wstrtime.c + + + wcscoll.c + wcscspn.c + wcsdup.c + wcsicmp.c + wcslwr.c + wcsnicmp.c + wcspbrk.c + wcsrev.c + wcsset.c + wcsspn.c + wcsstr.c + wcstok.c + wcsupr.c + wcsxfrm.c + wlasttok.c + + + cpp.c + cppexcept.c + heap.c ++ scanf.c + thread.c + + diff --cc reactos/lib/crt/ctype/isalnum.c index 57130bc90c3,a9a484ea1b6..07d448c9a43 --- a/reactos/lib/crt/ctype/isalnum.c +++ b/reactos/lib/crt/ctype/isalnum.c @@@ -7,9 -7,18 +7,9 @@@ * UPDATE HISTORY: * 28/12/98: Created */ - #include + #include -#undef isalnum -/* - * @implemented - */ -int isalnum(int c) -{ - return _isctype(c, _ALPHA | _DIGIT); -} - #undef iswalnum /* * @implemented diff --cc reactos/lib/crt/ctype/isascii.c index 2ff881d0757,9c98a603339..16791ac030b --- a/reactos/lib/crt/ctype/isascii.c +++ b/reactos/lib/crt/ctype/isascii.c @@@ -8,8 -8,16 +8,8 @@@ * 28/12/98: Created */ - #include + #include -/* - * @implemented - */ -int __isascii(int c) -{ - return (!((c)&(~0x7f))); -} - /* * @implemented */ diff --cc reactos/lib/crt/ctype/iscntrl.c index 59d75f76eac,8d128a29c55..705bd432e6f --- a/reactos/lib/crt/ctype/iscntrl.c +++ b/reactos/lib/crt/ctype/iscntrl.c @@@ -6,8 -6,16 +6,8 @@@ * PROGRAMMER: Copyright (C) 1995 DJ Delorie */ - #include + #include -#undef iscntrl -/* - * @implemented - */ -int iscntrl(int c) -{ - return _isctype(c, _CONTROL); -} #undef iswcntrl /* diff --cc reactos/lib/crt/ctype/isgraph.c index a62ef348888,8db6f627ca8..685df41d82b --- a/reactos/lib/crt/ctype/isgraph.c +++ b/reactos/lib/crt/ctype/isgraph.c @@@ -6,8 -6,17 +6,8 @@@ * PROGRAMMER: Copyright (C) 1995 DJ Delorie */ - #include + #include -#undef isgraph -/* - * @implemented - */ -int isgraph(int c) -{ - return _isctype(c,_PUNCT | _ALPHA | _DIGIT); -} - #undef iswgraph /* * @implemented diff --cc reactos/lib/crt/ctype/isprint.c index 8eca3b574ac,c98cecbcd52..204c063a312 --- a/reactos/lib/crt/ctype/isprint.c +++ b/reactos/lib/crt/ctype/isprint.c @@@ -6,8 -6,17 +6,8 @@@ * PROGRAMMER: Copyright (C) 1995 DJ Delorie */ - #include + #include -#undef isprint -/* - * @implemented - */ -int isprint(int c) -{ - return _isctype(c,_BLANK | _PUNCT | _ALPHA | _DIGIT); -} - /* * @implemented */ diff --cc reactos/lib/crt/ctype/ispunct.c index ae55fb0bc88,b0197aa7cf5..dc1dacc42f4 --- a/reactos/lib/crt/ctype/ispunct.c +++ b/reactos/lib/crt/ctype/ispunct.c @@@ -6,8 -6,17 +6,8 @@@ * PROGRAMMER: Copyright (C) 1995 DJ Delorie */ - #include + #include -#undef ispunct -/* - * @implemented - */ -int ispunct(int c) -{ - return _isctype(c, _PUNCT); -} - #undef iswpunct /* * @implemented diff --cc reactos/lib/crt/ctype/isupper.c index 187956c2414,fe19dc4cec9..56d49188583 --- a/reactos/lib/crt/ctype/isupper.c +++ b/reactos/lib/crt/ctype/isupper.c @@@ -6,8 -6,17 +6,8 @@@ * PROGRAMMER: Copyright (C) 1995 DJ Delorie */ - #include + #include -#undef isupper -/* - * @implemented - */ -int isupper(int c) -{ - return _isctype(c, _UPPER); -} - /* * @implemented */ diff --cc reactos/lib/crt/stdio/sprintf.c index 944b3aa4dc8,1e35c0fb0f4..f076e65e615 --- a/reactos/lib/crt/stdio/sprintf.c +++ b/reactos/lib/crt/stdio/sprintf.c @@@ -26,26 -27,12 +27,9 @@@ Cambridge, MA 02139, USA. * #undef sprintf #undef wsprintf - /* - * @implemented - */ - int - crt_sprintf(char *str, const char *fmt, ...) - { - va_list arg; - int done; - va_start (arg, fmt); - done = vsprintf (str, fmt, arg); - va_end (arg); - return done; - } - --/* -- * @implemented -- */ int - crt_swprintf(wchar_t *str, const wchar_t *fmt, ...) -_stprintf(_TCHAR *str, const _TCHAR *fmt, ...) ++crt_sprintf(_TCHAR *str, const _TCHAR *fmt, ...) { va_list arg; int done; @@@ -60,28 -47,11 +44,8 @@@ /* Write formatted output into S, according to the format string FORMAT, writing no more than MAXLEN characters. */ /* VARARGS3 */ - /* - * @implemented - */ - int - crt__snprintf (char *s, size_t maxlen,const char *format, ...) - { - va_list arg; - int done; - - va_start (arg, format); - done = _vsnprintf (s, maxlen, format, arg); - va_end (arg); - - return done; - } - --/* -- * @implemented -- */ int - crt__snwprintf (wchar_t *s, size_t maxlen,const wchar_t *format, ...) -_sntprintf (_TCHAR *s, size_t maxlen,const _TCHAR *format, ...) ++crt__snprintf (_TCHAR *s, size_t maxlen,const _TCHAR *format, ...) { va_list arg; int done; diff --cc reactos/lib/crt/stdio/swprintf.c index 8170ce1603f,81205d770ac..33f731b5d57 --- a/reactos/lib/crt/stdio/swprintf.c +++ b/reactos/lib/crt/stdio/swprintf.c @@@ -1,65 -1,4 +1,62 @@@ - /* Copyright (C) 1991 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 of the - License, or (at your option) any later version. - - The GNU C Library 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If - not, write to the Free Software Foundation, Inc., 675 Mass Ave, - Cambridge, MA 02139, USA. */ - - - #include - #include - #include - #include - #include - - - /* Read formatted input from STREAM according to the format string FORMAT. */ - /* VARARGS2 */ - /* - * @implemented - */ - int fscanf(FILE *stream,const char *format, ...) - { - va_list arg; - int done; - - va_start(arg, format); - done = __vfscanf(stream, format, arg); - va_end(arg); - - return done; - } - - /* - * @implemented - */ - int - fwscanf(FILE *stream, const wchar_t *fmt, ...) - { - va_list arg; - int done; - char *cf; - int i,len = wcslen(fmt); - - cf = malloc(len+1); - for(i=0;i ++#include ++#include ++#include ++#include ++#include ++ ++#undef sprintf ++#undef wsprintf ++ ++int ++crt_swprintf(_TCHAR *str, const _TCHAR *fmt, ...) ++{ ++ va_list arg; ++ int done; ++ ++ va_start (arg, fmt); ++ done = _vstprintf (str, fmt, arg); ++ va_end (arg); ++ return done; ++} ++ ++ ++/* Write formatted output into S, according to the format ++ string FORMAT, writing no more than MAXLEN characters. */ ++/* VARARGS3 */ ++int ++crt__snwprintf (_TCHAR *s, size_t maxlen,const _TCHAR *format, ...) ++{ ++ va_list arg; ++ int done; ++ ++ va_start (arg, format); ++ done = _vsntprintf(s, maxlen, format, arg); ++ va_end (arg); ++ ++ return done; ++} ++ + -#include "sprintf.c" diff --cc reactos/lib/crt/stdio/vsprintf.c index 628761e96aa,0fadd4881d5..d38bc6eae70 --- a/reactos/lib/crt/stdio/vsprintf.c +++ b/reactos/lib/crt/stdio/vsprintf.c @@@ -1,31 -1,17 +1,14 @@@ /* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */ - #include - #include + #include + #include #include - #include + #include + #include -/* - * @implemented - */ int - crt_vsprintf(char *str, const char *fmt, va_list ap) -_vstprintf(_TCHAR *str, const _TCHAR *fmt, va_list ap) ++crt_vsprintf(_TCHAR *str, const _TCHAR *fmt, va_list ap) { - FILE f; - int len; - - f._flag = _IOWRT|_IOSTRG|_IOBINARY; - f._ptr = str; - f._cnt = INT_MAX; - f._file = -1; - len = vfprintf(&f,fmt, ap); - *f._ptr = 0; - return len; - } - - /* - * @implemented - */ - int - vswprintf(wchar_t *str, const wchar_t *fmt, va_list ap) - { - FILE f; + FILE f = {0}; int len; f._flag = _IOWRT|_IOSTRG|_IOBINARY; @@@ -38,26 -24,15 +21,12 @@@ } -/* - * @implemented - */ int - crt__vsnprintf(char *str, size_t maxlen, const char *fmt, va_list ap) - { - FILE f; - int len; - f._flag = _IOWRT|_IOSTRG|_IOBINARY; - f._ptr = str; - f._cnt = maxlen; - f._file = -1; - len = vfprintf(&f,fmt, ap); - // what if the buffer is full ?? - *f._ptr = 0; - return len; - } - - int - crt__vsnwprintf(wchar_t *str, size_t maxlen, const wchar_t *fmt, va_list ap) -_vsntprintf(_TCHAR *str, size_t maxlen, const _TCHAR *fmt, va_list ap) ++crt__vsnprintf(_TCHAR *str, size_t maxlen, const _TCHAR *fmt, va_list ap) { - FILE f; + FILE f = {0}; int len; + f._flag = _IOWRT|_IOSTRG|_IOBINARY; f._ptr = (char*)str; f._cnt = maxlen; diff --cc reactos/lib/crt/stdio/vswprintf.c index 00000000000,646e937fee7..9b3cbd89af4 mode 000000,100644..100644 --- a/reactos/lib/crt/stdio/vswprintf.c +++ b/reactos/lib/crt/stdio/vswprintf.c @@@ -1,0 -1,4 +1,40 @@@ ++/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */ + #define UNICODE + #define _UNICODE ++#include ++#include ++#include ++#include ++#include + -#include "vsprintf.c" ++int ++crt__vswprintf(_TCHAR *str, const _TCHAR *fmt, va_list ap) ++{ ++ FILE f = {0}; ++ int len; ++ ++ f._flag = _IOWRT|_IOSTRG|_IOBINARY; ++ f._ptr = (char*)str; ++ f._cnt = INT_MAX; ++ f._file = -1; ++ len = _vftprintf(&f,fmt, ap); ++ *(_TCHAR*)f._ptr = 0; ++ return len; ++} ++ ++ ++int ++crt__vsnwprintf(_TCHAR *str, size_t maxlen, const _TCHAR *fmt, va_list ap) ++{ ++ FILE f = {0}; ++ int len; ++ ++ f._flag = _IOWRT|_IOSTRG|_IOBINARY; ++ f._ptr = (char*)str; ++ f._cnt = maxlen; ++ f._file = -1; ++ len = _vftprintf(&f,fmt, ap); ++ // what if the buffer is full ?? ++ *(_TCHAR *)f._ptr = 0; ++ return len; ++} diff --cc reactos/lib/crt/wine/scanf.c index 00000000000,f7d923251ee..185e16d4d9c mode 000000,100644..100644 --- a/reactos/lib/crt/wine/scanf.c +++ b/reactos/lib/crt/wine/scanf.c @@@ -1,0 -1,223 +1,223 @@@ + /* + * general implementation of scanf used by scanf, sscanf, fscanf, + * _cscanf, wscanf, swscanf and fwscanf + * + * Copyright 1996,1998 Marcus Meissner + * Copyright 1996 Jukka Iivonen + * Copyright 1997,2000 Uwe Bonnes + * Copyright 2000 Jon Griffiths + * Copyright 2002 Daniel Gudbjartsson + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + + + /* + #include + + #include "windef.h" + #include "winbase.h" + #include "winreg.h" + #include "winternl.h" + #include "msvcrt.h" + */ + + //#include + #include + //#include + //#include + #include + #include + #include + #include + #include + #include + + //#include + + #define NDEBUG + #include + + + /* + This is so ugly. I tried including anything/everything, but no matter + what i did i got complaints about RtlGetProcessHeap etc. being undefined. + -Gunnar (i hate headers) + */ + #define RtlFreeHeap HeapFree + #define RtlAllocateHeap HeapAlloc + #define RtlGetProcessHeap GetProcessHeap + //#include "wine/debug.h" + + #define WARN DPRINT1 + + //WINE_DEFAULT_DEBUG_CHANNEL(msvcrt); + + extern FILE _iob[]; + + /* helper function for *scanf. Returns the value of character c in the + * given base, or -1 if the given character is not a digit of the base. + */ + static int char2digit(char c, int base) { + if ((c>='0') && (c<='9') && (c<='0'+base-1)) return (c-'0'); + if (base<=10) return -1; + if ((c>='A') && (c<='Z') && (c<='A'+base-11)) return (c-'A'+10); + if ((c>='a') && (c<='z') && (c<='a'+base-11)) return (c-'a'+10); + return -1; + } + + /* helper function for *wscanf. Returns the value of character c in the + * given base, or -1 if the given character is not a digit of the base. + */ + static int wchar2digit(wchar_t c, int base) { + if ((c>=L'0') && (c<=L'9') && (c<=L'0'+base-1)) return (c-L'0'); + if (base<=10) return -1; + if ((c>=L'A') && (c<=L'Z') && (c<=L'A'+base-11)) return (c-L'A'+10); + if ((c>=L'a') && (c<=L'z') && (c<=L'a'+base-11)) return (c-L'a'+10); + return -1; + } + + /* vfscanf */ + #undef WIDE_SCANF + #undef CONSOLE + #undef STRING + #include "scanf.h" + + /* vfwscanf */ + #define WIDE_SCANF 1 + #undef CONSOLE + #undef STRING + #include "scanf.h" + + /* vsscanf */ + #undef WIDE_SCANF + #undef CONSOLE + #define STRING 1 + #include "scanf.h" + + /* vswscanf */ + #define WIDE_SCANF 1 + #undef CONSOLE + #define STRING 1 + #include "scanf.h" + + /* vcscanf */ + #undef WIDE_SCANF + #define CONSOLE 1 + #undef STRING + #include "scanf.h" + + + /********************************************************************* + * fscanf (MSVCRT.@) + */ + int fscanf(FILE *file, const char *format, ...) + { + va_list valist; + int res; + + va_start(valist, format); + res = vfscanf(file, format, valist); + va_end(valist); + return res; + } + + /********************************************************************* + * scanf (MSVCRT.@) + */ + int scanf(const char *format, ...) + { + va_list valist; + int res; + + va_start(valist, format); + res = vfscanf(stdin, format, valist); + va_end(valist); + return res; + } + + /********************************************************************* + * fwscanf (MSVCRT.@) + */ + int fwscanf(FILE *file, const wchar_t *format, ...) + { + va_list valist; + int res; + + va_start(valist, format); + res = vfwscanf(file, format, valist); + va_end(valist); + return res; + } + + + /********************************************************************* + * wscanf (MSVCRT.@) + */ + int wscanf(const wchar_t *format, ...) + { + va_list valist; + int res; + + va_start(valist, format); + res = vfwscanf(stdin, format, valist); + va_end(valist); + return res; + } + + + /********************************************************************* + * sscanf (MSVCRT.@) + */ -int sscanf(const char *str, const char *format, ...) ++int crt_sscanf(const char *str, const char *format, ...) + { + va_list valist; + int res; + + va_start(valist, format); + res = vsscanf(str, format, valist); + va_end(valist); + return res; + } + + + /********************************************************************* + * swscanf (MSVCRT.@) + */ + int swscanf(const wchar_t *str, const wchar_t *format, ...) + { + va_list valist; + int res; + + va_start(valist, format); + res = vswscanf(str, format, valist); + va_end(valist); + return res; + } + + + /********************************************************************* + * _cscanf (MSVCRT.@) + */ + int _cscanf(/*const*/ char *format, ...) + { + va_list valist; + int res; + + va_start(valist, format); + res = vcscanf(format, valist); + va_end(valist); + return res; + } diff --cc reactos/lib/crtdll/crtdll.xml index a3609d18e65,00000000000..8484282359d mode 100644,000000..100644 --- a/reactos/lib/crtdll/crtdll.xml +++ b/reactos/lib/crtdll/crtdll.xml @@@ -1,19 -1,0 +1,20 @@@ + + -nostartfiles + -lgcc + + . ++ include + + + 0x600 + 0x501 + + + ++ crt + string + kernel32 + ntdll - crt + dllmain.c + crtdll.rc + diff --cc reactos/lib/crtdll/stdio/vsprintf.c index 13cda16d11a,13cda16d11a..cb6210aae4a --- a/reactos/lib/crtdll/stdio/vsprintf.c +++ b/reactos/lib/crtdll/stdio/vsprintf.c @@@ -8,7 -8,7 +8,7 @@@ * @implemented */ int --vsprintf(char *str, const char *fmt, va_list ap) ++crt_vsprintf(char *str, const char *fmt, va_list ap) { FILE f; int len; @@@ -63,7 -63,7 +63,7 @@@ _vsnprintf(char *str, size_t maxlen, co * @implemented */ int --_vsnwprintf(wchar_t *str, size_t maxlen, const wchar_t *fmt, va_list ap) ++crt__vsnwprintf(wchar_t *str, size_t maxlen, const wchar_t *fmt, va_list ap) { FILE f; int len; diff --cc reactos/lib/directory.xml index c082b1200f3,00000000000..967de9682da mode 100644,000000..100644 --- a/reactos/lib/directory.xml +++ b/reactos/lib/directory.xml @@@ -1,273 -1,0 +1,270 @@@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --cc reactos/lib/expat/Makefile index abe638b3c30,0de7acdc0e0..e781654972b --- a/reactos/lib/expat/Makefile +++ b/reactos/lib/expat/Makefile @@@ -1,4 -1,4 +1,4 @@@ - # $Id$ -# $Id: Makefile 13593 2005-02-16 14:01:34Z weiden $ ++# $Id: Makefile 12851 2005-01-06 13:34:15Z mf $ PATH_TO_TOP = ../.. diff --cc reactos/lib/expat/conftools/ac_c_bigendian_cross.m4 index 59912635b64,8ed3edb24fb..5cb0e80e143 --- a/reactos/lib/expat/conftools/ac_c_bigendian_cross.m4 +++ b/reactos/lib/expat/conftools/ac_c_bigendian_cross.m4 @@@ -7,7 -7,7 +7,7 @@@ dnl The implementation will create a bi dnl the binary it will be grep'ed for some symbols that will look dnl different for different endianess of the binary. dnl - dnl @version $Id$ -dnl @version $Id: ac_c_bigendian_cross.m4,v 1.2 2001/10/01 20:03:13 fdrake Exp $ ++dnl @version $Id: ac_c_bigendian_cross.m4 12851 2005-01-06 13:34:15Z mf $ dnl @author Guido Draheim dnl AC_DEFUN([AC_C_BIGENDIAN_CROSS], diff --cc reactos/lib/expat/conftools/mkinstalldirs index 6b3b5fc5d4d,c5291db0365..996d32d8521 --- a/reactos/lib/expat/conftools/mkinstalldirs +++ b/reactos/lib/expat/conftools/mkinstalldirs @@@ -4,7 -4,7 +4,7 @@@ # Created: 1993-05-16 # Public domain - # $Id$ -# $Id: mkinstalldirs,v 1.1 2000/09/18 16:26:21 coopercc Exp $ ++# $Id: mkinstalldirs 12851 2005-01-06 13:34:15Z mf $ errstatus=0 diff --cc reactos/lib/expat/expat.xml index 1ce519fe60e,00000000000..1fc36fa1145 mode 100644,000000..100644 --- a/reactos/lib/expat/expat.xml +++ b/reactos/lib/expat/expat.xml @@@ -1,12 -1,0 +1,13 @@@ + + + . ++ lib + + + kernel32 + + xmlparse.c + xmlrole.c + xmltok.c + + diff --cc reactos/lib/msvcrt/msvcrt.def index c640040688b,1156b11368b..19c8009aaeb --- a/reactos/lib/msvcrt/msvcrt.def +++ b/reactos/lib/msvcrt/msvcrt.def @@@ -160,9 -160,9 +160,9 @@@ __setlc_active DAT __setusermatherr __threadhandle __threadid -__toascii +__toascii=NTDLL.__toascii - ;__unDName - ;__unDNameEx + __unDName=stub + __unDNameEx=stub __unguarded_readlc_active DATA __wargv __wgetmainargs @@@ -192,21 -192,21 +192,21 @@@ _adj_fdivr_m32 = _adj_fdivr_m32@ _adj_fdivr_m32i = _adj_fdivr_m32i@4 _adj_fdivr_m64 = _adj_fdivr_m64@8 _adj_fpatan - ;_adj_fprem - ;_adj_fprem1 - ;_adj_fptan + _adj_fprem=stub + _adj_fprem1=stub + _adj_fptan=stub _adjust_fdiv DATA _aexit_rtn - ;_aligned_free - ;_aligned_malloc - ;_aligned_offset_malloc - ;_aligned_offset_realloc - ;_aligned_realloc + _aligned_free=stub + _aligned_malloc=stub + _aligned_offset_malloc=stub + _aligned_offset_realloc=stub + _aligned_realloc=stub _amsg_exit _assert - ;_atodbl + _atodbl=stub -_atoi64 +_atoi64=NTDLL._atoi64 - ;_atoldbl + _atoldbl=stub _beep _beginthread _beginthreadex @@@ -322,15 -323,15 +323,15 @@@ _heapad _heapchk _heapmin _heapset - ;_heapused + _heapused=stub _heapwalk _hypot -_i64toa -_i64tow +_i64toa=NTDLL._i64toa +_i64tow=NTDLL._i64tow _initterm - ;_inp - ;_inpd - ;_inpw + _inp=stub + _inpd=stub + _inpw=stub _iob _isatty _isctype @@@ -441,10 -443,10 +443,10 @@@ _mbsto _mbstrlen _mbsupr _memccpy -_memicmp +_memicmp=NTDLL._memicmp _mkdir _mktemp - ;_mktime64 + _mktime64=stub _msize _nextafter _onexit @@@ -493,10 -495,10 +495,10 @@@ _setmbc _setmode _setsystime _sleep -_snprintf +_snprintf=crt__snprintf - ;_snscanf - ;_snwscanf + _snscanf=stub + _snwscanf=stub -_snwprintf +_snwprintf=crt__snwprintf _sopen _spawnl _spawnle @@@ -506,9 -508,9 +508,9 @@@ _spawn _spawnve _spawnvp _spawnvpe -_splitpath +_splitpath=NTDLL._splitpath _stat - ;_stat64 + _stat64=stub _stati64 _statusfp _strcmpi @@@ -534,28 -536,27 +536,27 @@@ _sys_nerr DAT _tell _telli64 _tempnam - ;_time64 + _time64=stub _timezone DATA -_tolower -_toupper +_tolower=NTDLL._tolower +_toupper=NTDLL._toupper _tzname DATA _tzset -_ui64toa -_ui64tow -_ultoa -_ultow +_ui64toa=NTDLL._i64toa +_ui64tow=NTDLL._i64tow +_ultoa=NTDLL._ultoa +_ultow=NTDLL._ultow _umask _ungetch - ;_ungetwch _unlink _unloaddll _unlock _utime - ;_utime64 - ;_vscprintf - ;_vscwprintf + _utime64=stub + _vscprintf=stub + _vscwprintf=stub -_vsnprintf -_vsnwprintf +_vsnprintf=crt__vsnprintf +_vsnwprintf=crt__vsnwprintf _waccess _wasctime _wchdir @@@ -633,12 -634,12 +634,12 @@@ _wstat64=stu _wstati64 _wstrdate _wstrtime - ;_wsystem + _wsystem=stub _wtempnam _wtmpnam - ;_wtof + _wtof=stub -_wtoi -_wtoi64 +_wtoi=NTDLL._wtoi +_wtoi64=NTDLL._wtoi64 _wtol _wunlink _wutime diff --cc reactos/lib/msvcrt/msvcrt.xml index 4e23941c56d,00000000000..feafc28fbfe mode 100644,000000..100644 --- a/reactos/lib/msvcrt/msvcrt.xml +++ b/reactos/lib/msvcrt/msvcrt.xml @@@ -1,22 -1,0 +1,23 @@@ + + -nostartfiles + --enable-stdcall-fixup + -lgcc + + . ++ include + + + 0x600 + 0x501 + + + + ++ crt + wine + string + kernel32 + ntdll - crt + dllmain.c + msvcrt.rc + diff --cc reactos/lib/oleaut32/oleaut32.xml index 32720af1a25,00000000000..a3cfd44cf41 mode 100644,000000..100644 --- a/reactos/lib/oleaut32/oleaut32.xml +++ b/reactos/lib/oleaut32/oleaut32.xml @@@ -1,45 -1,0 +1,44 @@@ + + winebuild + + . + include/wine + + + + + 0x600 + 0x501 + 0x501 + + + + wine - wine_unicode + uuid + ntdll + kernel32 + advapi32 + gdi32 + user32 + rpcrt4 + ole32 + comctl32 + connpt.c + dispatch.c + hash.c + oaidl_p.c + oleaut.c + olefont.c + olepicture.c + regsvr.c + safearray.c + stubs.c + tmarshal.c + typelib.c + typelib2.c + usrmarshal.c + varformat.c + variant.c + vartype.c + oleaut32.spec + diff --cc reactos/lib/rpcrt4/rpc_message.c index 119af8cfab3,119af8cfab3..d10e56c9ab4 --- a/reactos/lib/rpcrt4/rpc_message.c +++ b/reactos/lib/rpcrt4/rpc_message.c @@@ -265,10 -265,10 +265,15 @@@ RPC_STATUS RPCRT4_Send(RpcConnection *C } /* transmit packet header */ -- if (!WriteFile(Connection->conn, Header, hdr_size, &count, NULL)) { ++ ResetEvent(Connection->ovl.hEvent); ++ if (!WriteFile(Connection->conn, Header, hdr_size, &count, &Connection->ovl)) { WARN("WriteFile failed with error %ld\n", GetLastError()); return GetLastError(); } ++ if (!GetOverlappedResult(Connection->conn, &Connection->ovl, &count, TRUE)) { ++ WARN("GetOverlappedResult failed with error %ld\n", GetLastError()); ++ return GetLastError(); ++ } /* fragment consisted of header only and is the last one */ if (hdr_size == Header->common.frag_len && @@@ -277,10 -277,10 +282,15 @@@ } /* send the fragment data */ -- if (!WriteFile(Connection->conn, buffer_pos, Header->common.frag_len - hdr_size, &count, NULL)) { ++ ResetEvent(Connection->ovl.hEvent); ++ if (!WriteFile(Connection->conn, buffer_pos, Header->common.frag_len - hdr_size, &count, &Connection->ovl)) { WARN("WriteFile failed with error %ld\n", GetLastError()); return GetLastError(); } ++ if (!GetOverlappedResult(Connection->conn, &Connection->ovl, &count, TRUE)) { ++ WARN("GetOverlappedResult failed with error %ld\n", GetLastError()); ++ return GetLastError(); ++ } Header->common.flags &= ~RPC_FLG_FIRST; } @@@ -309,9 -309,9 +319,15 @@@ RPC_STATUS RPCRT4_Receive(RpcConnectio TRACE("(%p, %p, %p)\n", Connection, Header, pMsg); /* read packet common header */ -- if (!ReadFile(Connection->conn, &common_hdr, sizeof(common_hdr), &dwRead, NULL)) { ++ ResetEvent(Connection->ovl.hEvent); ++ if (!ReadFile(Connection->conn, &common_hdr, sizeof(common_hdr), &dwRead, &Connection->ovl)) { ++ WARN("ReadFile failed with error %ld\n", GetLastError()); ++ status = RPC_S_PROTOCOL_ERROR; ++ goto fail; ++ } ++ if (!GetOverlappedResult(Connection->conn, &Connection->ovl, &dwRead, TRUE)) { if (GetLastError() != ERROR_MORE_DATA) { -- WARN("ReadFile failed with error %ld\n", GetLastError()); ++ WARN("GetOverlappedResult failed with error %ld\n", GetLastError()); status = RPC_S_PROTOCOL_ERROR; goto fail; } @@@ -339,10 -339,10 +355,16 @@@ memcpy(*Header, &common_hdr, sizeof(common_hdr)); /* read the rest of packet header */ ++ ResetEvent(Connection->ovl.hEvent); if (!ReadFile(Connection->conn, &(*Header)->common + 1, -- hdr_length - sizeof(common_hdr), &dwRead, NULL)) { ++ hdr_length - sizeof(common_hdr), &dwRead, &Connection->ovl)) { ++ WARN("ReadFile failed with error %ld\n", GetLastError()); ++ status = RPC_S_PROTOCOL_ERROR; ++ goto fail; ++ } ++ if (!GetOverlappedResult(Connection->conn, &Connection->ovl, &dwRead, TRUE)) { if (GetLastError() != ERROR_MORE_DATA) { -- WARN("ReadFile failed with error %ld\n", GetLastError()); ++ WARN("GetOverlappedResult failed with error %ld\n", GetLastError()); status = RPC_S_PROTOCOL_ERROR; goto fail; } @@@ -352,6 -352,6 +374,7 @@@ goto fail; } ++ /* read packet body */ switch (common_hdr.ptype) { case PKT_RESPONSE: @@@ -379,13 -379,13 +402,20 @@@ goto fail; } -- if (data_length == 0) dwRead = 0; else -- if (!ReadFile(Connection->conn, buffer_ptr, data_length, &dwRead, NULL)) { -- if (GetLastError() != ERROR_MORE_DATA) { ++ if (data_length == 0) dwRead = 0; else { ++ ResetEvent(Connection->ovl.hEvent); ++ if (!ReadFile(Connection->conn, buffer_ptr, data_length, &dwRead, &Connection->ovl)) { WARN("ReadFile failed with error %ld\n", GetLastError()); status = RPC_S_PROTOCOL_ERROR; goto fail; } ++ if (!GetOverlappedResult(Connection->conn, &Connection->ovl, &dwRead, TRUE)) { ++ if (GetLastError() != ERROR_MORE_DATA) { ++ WARN("GetOverlappedResult failed with error %ld\n", GetLastError()); ++ status = RPC_S_PROTOCOL_ERROR; ++ goto fail; ++ } ++ } } if (dwRead != data_length) { status = RPC_S_PROTOCOL_ERROR; @@@ -403,10 -403,10 +433,16 @@@ TRACE("next header\n"); /* read the header of next packet */ -- if (!ReadFile(Connection->conn, *Header, hdr_length, &dwRead, NULL)) { ++ ResetEvent(Connection->ovl.hEvent); ++ if (!ReadFile(Connection->conn, *Header, hdr_length, &dwRead, &Connection->ovl)) { ++ WARN("ReadFile failed with error %ld\n", GetLastError()); ++ status = GetLastError(); ++ goto fail; ++ } ++ if (!GetOverlappedResult(Connection->conn, &Connection->ovl, &dwRead, TRUE)) { if (GetLastError() != ERROR_MORE_DATA) { -- WARN("ReadFile failed with error %ld\n", GetLastError()); -- status = GetLastError(); ++ WARN("GetOverlappedResult failed with error %ld\n", GetLastError()); ++ status = RPC_S_PROTOCOL_ERROR; goto fail; } } diff --cc reactos/lib/setupapi/setupapi.xml index 697ccb34c4a,00000000000..b96e022458a mode 100644,000000..100644 --- a/reactos/lib/setupapi/setupapi.xml +++ b/reactos/lib/setupapi/setupapi.xml @@@ -1,34 -1,0 +1,34 @@@ + + winebuild + + . + include/wine + + + + + 0x600 + 0x501 + 0x501 + + + wine - wine_unicode + ntdll + kernel32 + advapi32 + user32 + rpcrt4 + version ++ cfgmgr.c + devinst.c + dirid.c + diskspace.c + install.c + misc.c + parser.c + queue.c + setupcab.c + stubs.c + setupapi.rc + setupapi.spec + diff --cc reactos/lib/shlwapi/shlwapi.xml index 357e683c00d,00000000000..ca01a3a3d7c mode 100644,000000..100644 --- a/reactos/lib/shlwapi/shlwapi.xml +++ b/reactos/lib/shlwapi/shlwapi.xml @@@ -1,43 -1,0 +1,42 @@@ + + winebuild + + . + include/wine + + + + + 0x600 + 0x501 + 0x501 + + "" + -nostdlib + -lgcc + wine - wine_unicode + uuid + msvcrt + ntdll + kernel32 + advapi32 + gdi32 + user32 + ole32 + oleaut32 + assoc.c + clist.c + istream.c + msgbox.c + ordinal.c + path.c + reg.c + regstream.c + shlwapi_main.c + stopwatch.c + string.c + thread.c + url.c + wsprintf.c + shlwapi.spec + diff --cc reactos/ntoskrnl/include/internal/io.h index 823c153c197,823c153c197..b23f6121742 --- a/reactos/ntoskrnl/include/internal/io.h +++ b/reactos/ntoskrnl/include/internal/io.h @@@ -426,6 -426,6 +426,11 @@@ IopBootLog(PUNICODE_STRING DriverName, VOID IopSaveBootLogToFile(VOID); ++/* cancel.c */ ++ ++VOID STDCALL ++IoCancelThreadIo(PETHREAD Thread); ++ /* errlog.c */ NTSTATUS diff --cc reactos/ntoskrnl/io/cancel.c index f5c4312eeb9,f5c4312eeb9..1ce6919fb34 --- a/reactos/ntoskrnl/io/cancel.c +++ b/reactos/ntoskrnl/io/cancel.c @@@ -20,12 -20,12 +20,181 @@@ static KSPIN_LOCK CancelSpinLock /* FUNCTIONS *****************************************************************/ ++/** ++ * @name NtCancelIoFile ++ * ++ * Cancel all pending I/O operations in the current thread for specified ++ * file object. ++ * ++ * @param FileHandle ++ * Handle to file object to cancel requests for. No specific ++ * access rights are needed. ++ * @param IoStatusBlock ++ * Pointer to status block which is filled with final completition ++ * status on successful return. ++ * ++ * @return Status. ++ * ++ * @implemented ++ */ ++ NTSTATUS STDCALL --NtCancelIoFile (IN HANDLE FileHandle, -- OUT PIO_STATUS_BLOCK IoStatusBlock) ++NtCancelIoFile( ++ IN HANDLE FileHandle, ++ OUT PIO_STATUS_BLOCK IoStatusBlock) { -- UNIMPLEMENTED; -- return(STATUS_NOT_IMPLEMENTED); ++ NTSTATUS Status; ++ PFILE_OBJECT FileObject; ++ PETHREAD Thread; ++ PLIST_ENTRY IrpEntry; ++ PIRP Irp; ++ KIRQL OldIrql; ++ BOOLEAN OurIrpsInList = FALSE; ++ LARGE_INTEGER Interval; ++ ++ if ((ULONG_PTR)IoStatusBlock >= MmUserProbeAddress && ++ KeGetPreviousMode() == UserMode) ++ return STATUS_ACCESS_VIOLATION; ++ ++ Status = ObReferenceObjectByHandle(FileHandle, 0, IoFileObjectType, ++ KeGetPreviousMode(), (PVOID*)&FileObject, ++ NULL); ++ if (!NT_SUCCESS(Status)) ++ return Status; ++ ++ /* IRP cancellations are synchronized at APC_LEVEL. */ ++ OldIrql = KfRaiseIrql(APC_LEVEL); ++ ++ /* ++ * Walk the list of active IRPs and cancel the ones that belong to ++ * our file object. ++ */ ++ ++ Thread = PsGetCurrentThread(); ++ for (IrpEntry = Thread->IrpList.Flink; ++ IrpEntry != &Thread->IrpList; ++ IrpEntry = IrpEntry->Flink) ++ { ++ Irp = CONTAINING_RECORD(IrpEntry, IRP, ThreadListEntry); ++ if (Irp->Tail.Overlay.OriginalFileObject == FileObject) ++ { ++ IoCancelIrp(Irp); ++ /* Don't break here, we want to cancel all IRPs for the file object. */ ++ OurIrpsInList = TRUE; ++ } ++ } ++ ++ KfLowerIrql(OldIrql); ++ ++ while (OurIrpsInList) ++ { ++ OurIrpsInList = FALSE; ++ ++ /* Wait a short while and then look if all our IRPs were completed. */ ++ Interval.QuadPart = -1000000; /* 100 milliseconds */ ++ KeDelayExecutionThread(KernelMode, FALSE, &Interval); ++ ++ OldIrql = KfRaiseIrql(APC_LEVEL); ++ ++ /* ++ * Look in the list if all IRPs for the specified file object ++ * are completed (or cancelled). If someone sends a new IRP ++ * for our file object while we're here we can happily loop ++ * forever. ++ */ ++ ++ for (IrpEntry = Thread->IrpList.Flink; ++ IrpEntry != &Thread->IrpList; ++ IrpEntry = IrpEntry->Flink) ++ { ++ Irp = CONTAINING_RECORD(IrpEntry, IRP, ThreadListEntry); ++ if (Irp->Tail.Overlay.OriginalFileObject == FileObject) ++ { ++ OurIrpsInList = TRUE; ++ break; ++ } ++ } ++ ++ KfLowerIrql(OldIrql); ++ } ++ ++ _SEH_TRY ++ { ++ IoStatusBlock->Status = STATUS_SUCCESS; ++ IoStatusBlock->Information = 0; ++ Status = STATUS_SUCCESS; ++ } ++ _SEH_HANDLE ++ { ++ Status = STATUS_UNSUCCESSFUL; ++ } ++ _SEH_END; ++ ++ ObDereferenceObject(FileObject); ++ ++ return Status; ++} ++ ++/** ++ * @name IoCancelThreadIo ++ * ++ * Cancel all pending I/O request associated with specified thread. ++ * ++ * @param Thread ++ * Thread to cancel requests for. ++ */ ++ ++VOID STDCALL ++IoCancelThreadIo(PETHREAD Thread) ++{ ++ PLIST_ENTRY IrpEntry; ++ PIRP Irp; ++ KIRQL OldIrql; ++ ULONG Retries = 3000; ++ LARGE_INTEGER Interval; ++ ++ OldIrql = KfRaiseIrql(APC_LEVEL); ++ ++ /* ++ * Start by cancelling all the IRPs in the current thread queue. ++ */ ++ ++ for (IrpEntry = Thread->IrpList.Flink; ++ IrpEntry != &Thread->IrpList; ++ IrpEntry = IrpEntry->Flink) ++ { ++ Irp = CONTAINING_RECORD(IrpEntry, IRP, ThreadListEntry); ++ IoCancelIrp(Irp); ++ } ++ ++ /* ++ * Wait till all the IRPs are completed or cancelled. ++ */ ++ ++ while (!IsListEmpty(&Thread->IrpList)) ++ { ++ KfLowerIrql(OldIrql); ++ ++ /* Wait a short while and then look if all our IRPs were completed. */ ++ Interval.QuadPart = -1000000; /* 100 milliseconds */ ++ KeDelayExecutionThread(KernelMode, FALSE, &Interval); ++ ++ /* ++ * Don't stay here forever if some broken driver doesn't complete ++ * the IRP. ++ */ ++ ++ if (Retries-- == 0) ++ { ++ /* FIXME: Handle this gracefully. */ ++ DPRINT1("Thread with dead IRPs!"); ++ ASSERT(FALSE); ++ } ++ ++ OldIrql = KfRaiseIrql(APC_LEVEL); ++ } ++ ++ KfLowerIrql(OldIrql); } /* diff --cc reactos/ntoskrnl/io/iomgr.c index b8a2dcf1ebb,81852d21362..eff2a12bcc0 --- a/reactos/ntoskrnl/io/iomgr.c +++ b/reactos/ntoskrnl/io/iomgr.c @@@ -105,15 -105,15 +105,24 @@@ IopDeleteFile(PVOID ObjectBody UserMode); #endif KeResetEvent( &FileObject->Event ); -- Irp = IoBuildSynchronousFsdRequest(IRP_MJ_CLOSE, -- FileObject->DeviceObject, -- NULL, -- 0, -- NULL, -- &FileObject->Event, -- NULL); ++ ++ Irp = IoAllocateIrp(FileObject->DeviceObject->StackSize, TRUE); ++ if (Irp == NULL) ++ { ++ /* ++ * FIXME: This case should eventually be handled. We should wait ++ * until enough memory is available to allocate the IRP. ++ */ ++ ASSERT(FALSE); ++ } ++ ++ Irp->UserEvent = &FileObject->Event; ++ Irp->Tail.Overlay.Thread = PsGetCurrentThread(); Irp->Flags |= IRP_CLOSE_OPERATION; ++ StackPtr = IoGetNextIrpStackLocation(Irp); ++ StackPtr->MajorFunction = IRP_MJ_CLOSE; ++ StackPtr->DeviceObject = FileObject->DeviceObject; StackPtr->FileObject = FileObject; Status = IoCallDriver(FileObject->DeviceObject, Irp); diff --cc reactos/ntoskrnl/io/irp.c index d898dc4f1c8,d898dc4f1c8..ed98e86d973 --- a/reactos/ntoskrnl/io/irp.c +++ b/reactos/ntoskrnl/io/irp.c @@@ -268,7 -268,7 +268,6 @@@ IoAllocateIrp(CCHAR StackSize return(NULL); } -- RtlZeroMemory(Irp, IoSizeOfIrp(StackSize)); IoInitializeIrp(Irp, IoSizeOfIrp(StackSize), StackSize); @@@ -364,6 -364,6 +363,9 @@@ IofCompleteRequest(PIRP Irp ULONG MasterIrpCount; PIRP MasterIrp = Irp->AssociatedIrp.MasterIrp; ++ /* This should never happen! */ ++ ASSERT(IsListEmpty(&Irp->ThreadListEntry)); ++ MasterIrpCount = InterlockedDecrement(&MasterIrp->AssociatedIrp.IrpCount); while ((Mdl = Irp->MdlAddress)) { @@@ -386,6 -386,6 +388,9 @@@ /* Windows NT File System Internals, page 165 */ if (Irp->Flags & (IRP_PAGING_IO|IRP_CLOSE_OPERATION)) { ++ /* This should never happen! */ ++ ASSERT(IsListEmpty(&Irp->ThreadListEntry)); ++ /* * If MDL_IO_PAGE_READ is set, then the caller is responsible * for deallocating of the mdl. @@@ -582,19 -582,19 +587,19 @@@ IoGetTopLevelIrp(VOID VOID STDCALL IoQueueThreadIrp(IN PIRP Irp) { --/* undefine this when (if ever) implementing irp cancellation */ --#if 0 -- KIRQL oldIrql; ++ KIRQL OldIrql; -- oldIrql = KfRaiseIrql(APC_LEVEL); ++ OldIrql = KfRaiseIrql(APC_LEVEL); -- /* Synchronous irp's are queued to requestor thread. If they are not completed -- when the thread exits, they are canceled (cleaned up). -- -Gunnar */ -- InsertTailList(&PsGetCurrentThread()->IrpList, &Irp->ThreadListEntry); ++ /* ++ * Synchronous irp's are queued to requestor thread. If they are not ++ * completed when the thread exits, they are canceled (cleaned up). ++ * - Gunnar ++ */ ++ ++ InsertTailList(&Irp->Tail.Overlay.Thread->IrpList, &Irp->ThreadListEntry); -- KfLowerIrql(oldIrql); --#endif ++ KfLowerIrql(OldIrql); } diff --cc reactos/ntoskrnl/ntoskrnl.xml index 4794940ec1e,00000000000..9aa63b2697b mode 100644,000000..100644 --- a/reactos/ntoskrnl/ntoskrnl.xml +++ b/reactos/ntoskrnl/ntoskrnl.xml @@@ -1,366 -1,0 +1,367 @@@ + + + + + + + + include + include + csq + hal + kjs + pseh + rosrtl + rtl + string + + + + main.S + bios.c + brkpoint.c + bthread.S + exp.c + fpu.c + gdt.c + i386-mcount.S + idt.c + irq.c + irqhand.s + kernel.c + ldt.c + stkswitch.S + syscall.S + thread.c + tlbflush.S + trap.s + tskswitch.S + tss.c + usercall.c + usertrap.c + v86m.c + v86m_sup.S + vdm.c + + + alert.c + apc.c + bug.c + catch.c ++ clock.c + critical.c + device.c + dpc.c + error.c + event.c + gmutex.c + ipi.c + kqueue.c + kthread.c + main.c + mutex.c + process.c + profile.c + queue.c + sem.c + spinlock.c + timer.c + wait.c + + + cacheman.c + copy.c + fs.c + mdl.c + pin.c + view.c + + + import.c + ntfunc.c + regfile.c + registry.c + regobj.c + + + + + + + i386-dis.c + kdb_help.S + + + + + + kdb.c + kdb_keyboard.c + kdb_serial.c + rdebug.c + profile.c + + + kdb_stabs.c + kdb_symbols.c + + dbgctrl.c + errinfo.c + print.c + user.c + + + + + interlck.c + + + btree.c + callback.c + event.c + evtpair.c + fmutex.c + hashtab.c + init.c + interlck.c + list.c + lookas.c + mutant.c + napi.c + power.c + profile.c + resource.c + rundown.c + sem.c + stree.c + synch.c + sysinfo.c + time.c + timer.c + util.c + uuid.c + win32k.c + work.c + zone.c + zw.S + + + dbcsname.c + filelock.c + mcb.c + mdl.c + name.c + notify.c + oplock.c + pool.c + tunnel.c + unc.c + util.c + + + inbv.c + + + adapter.c + arcname.c + bootlog.c + buildirp.c + cancel.c + cleanup.c + cntrller.c + create.c + device.c + deviface.c + dir.c + driver.c + efi.c + errlog.c + error.c + event.c + file.c + flush.c + fs.c + iocomp.c + ioctrl.c + iomgr.c + iowork.c + irp.c + irq.c + lock.c + mailslot.c + mdl.c + npipe.c + page.c + parttab.c + plugplay.c + pnpdma.c + pnpmgr.c + pnpnotify.c + pnpreport.c + pnproot.c + process.c + queue.c + rawfs.c + remlock.c + resource.c + rw.c + share.c + shutdown.c + symlink.c + timer.c + vpb.c + wdm.c + wmi.c + xhaldisp.c + xhaldrv.c + + + dlog.c + gdbstub.c + kdebug.c + mda.c + service.c + + + init.c + loader.c + resource.c + rtl.c + sysdll.c + userldr.c + + + close.c + complete.c + connect.c + create.c + listen.c + port.c + query.c + queue.c + receive.c + reply.c + send.c + + + + + memsafe.s + page.c + pfault.c + + + anonmem.c + aspace.c + balance.c + cont.c + drvlck.c + elf32.c + elf64.c + freelist.c + iospace.c + kmap.c + marea.c + mdl.c + mm.c + mminit.c + mpw.c + ncache.c + npool.c + pagefile.c + pageop.c + pager.c + pagfault.c + paging.c + pe.c + physical.c + pool.c + ppool.c + region.c + rmap.c + section.c + verifier.c + virtual.c + wset.c + + + dirobj.c + handle.c + namespc.c + ntobj.c + object.c + sdcache.c + security.c + symlink.c + + + power.c + + + + + continue.c + + + cid.c + create.c + debug.c + idle.c + job.c + kill.c + locale.c + process.c + psmgr.c + suspend.c + thread.c + tinfo.c + w32call.c + win32.c + + + + + alldiv.s + allmul.s + allrem.s + allshl.s + allshr.s + aulldiv.s + aullrem.s + aullshr.s + exception.c + seh.s + + + atom.c + capture.c + ctype.c + handle.c + libsupp.c + message.c + misc.c + nls.c + purecall.c + rangelist.c + regio.c + sprintf.c + stdlib.c + string.c + strtok.c + swprintf.c + wstring.c + + + access.c + acl.c + audit.c + lsa.c + luid.c + priv.c + sd.c + semgr.c + sid.c + token.c + + ntoskrnl.rc + diff --cc reactos/ntoskrnl/ob/handle.c index 7e2306a3ddd,58250750a72..dcc90efd882 --- a/reactos/ntoskrnl/ob/handle.c +++ b/reactos/ntoskrnl/ob/handle.c @@@ -1070,4 -1079,31 +1079,36 @@@ ObFindHandleForObject(IN PEPROCESS Proc return STATUS_UNSUCCESSFUL; } + VOID + ObpGetNextHandleByProcessCount(PSYSTEM_HANDLE_TABLE_ENTRY_INFO pshi, + PEPROCESS Process, + int Count) + { + ULONG P; + KIRQL oldIrql; + + // pshi->HandleValue; + ++/* ++ This will never work with ROS! M$, I guess uses 0 -> 65535. ++ Ros uses 0 -> 4294967295! ++ */ ++ + P = (ULONG) Process->UniqueProcessId; + pshi->UniqueProcessId = (USHORT) P; + + KeAcquireSpinLock( &Process->HandleTable.ListLock, &oldIrql ); + + // pshi->GrantedAccess; + // pshi->Object; + // pshi->ObjectTypeIndex; + // pshi->HandleAttributes; + + KeReleaseSpinLock( &Process->HandleTable.ListLock, oldIrql ); + + return; + } + + + /* EOF */ diff --cc reactos/ntoskrnl/ps/kill.c index 273f12d5808,1837f096b5a..acd9271c3e5 --- a/reactos/ntoskrnl/ps/kill.c +++ b/reactos/ntoskrnl/ps/kill.c @@@ -144,6 -158,6 +158,9 @@@ PsTerminateCurrentThread(NTSTATUS ExitS PsLockProcess(CurrentProcess, FALSE); ++ /* Cancel I/O for the thread. */ ++ IoCancelThreadIo(CurrentThread); ++ /* Remove the thread from the thread list of its process */ RemoveEntryList(&CurrentThread->ThreadListEntry); Last = IsListEmpty(&CurrentProcess->ThreadListHead); diff --cc reactos/subsys/csrss/csrss.xml index b308c472d3d,00000000000..a7cdac04d41 mode 100644,000000..100644 --- a/reactos/subsys/csrss/csrss.xml +++ b/reactos/subsys/csrss/csrss.xml @@@ -1,23 -1,0 +1,24 @@@ + + . + include + + 0x0600 + 0x0501 + rosrtl + ntdll ++ smdll + + handle.c + process.c + user.c + wapi.c + + csrss.c + init.c + print.c + video.c + csrss.rc + + + + diff --cc reactos/subsys/smss/smss.xml index c71a07130dc,00000000000..930edeb9110 mode 100644,000000..100644 --- a/reactos/subsys/smss/smss.xml +++ b/reactos/subsys/smss/smss.xml @@@ -1,21 -1,0 +1,26 @@@ + + . + + ntdll ++ smdll ++ -lgcc + client.c - Debug.c ++ debug.c + init.c + initdosdev.c + initenv.c + initheap.c + initmv.c + initobdir.c + initpage.c + initreg.c + initrun.c + initss.c + initwkdll.c ++ print.c + smapi.c ++ smapicomp.c ++ smapiexec.c + smss.c + smss.rc + diff --cc reactos/subsys/system/directory.xml index 499454c9840,00000000000..b54bc332368 mode 100644,000000..100644 --- a/reactos/subsys/system/directory.xml +++ b/reactos/subsys/system/directory.xml @@@ -1,60 -1,0 +1,57 @@@ + + + + + + + + + + + + + + + + + + + + + + + + - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --cc reactos/subsys/system/explorer/explorer.xml index 468625f38ae,00000000000..7994c7d89fe mode 100644,000000..100644 --- a/reactos/subsys/system/explorer/explorer.xml +++ b/reactos/subsys/system/explorer/explorer.xml @@@ -1,66 -1,0 +1,68 @@@ + + -fexceptions + . ++ include/expat + + + + + 0x0600 + 0x0501 + 0x0500 ++ + uuid + kernel32 + gdi32 + ws2_32 + msimg32 + comctl32 + ole32 + oleaut32 + shell32 + expat + notifyhook + + desktop.cpp + + + searchprogram.cpp + settings.cpp + + + entries.cpp + fatfs.cpp + filechild.cpp + shellfs.cpp + mainframe.cpp + ntobjfs.cpp + pane.cpp + regfs.cpp + shellbrowser.cpp + startup.c + unixfs.cpp + webchild.cpp + winfs.cpp + + + desktopbar.cpp + favorites.cpp + taskbar.cpp + startmenu.cpp + traynotify.cpp + quicklaunch.cpp + + + shellclasses.cpp + utility.cpp + window.cpp + dragdropimpl.cpp + shellbrowserimpl.cpp + xmlstorage.cpp + + explorer.cpp + i386-stub-win32.c + explorer.rc + + + + diff --cc reactos/subsys/system/ibrowser/ibrowser.xml index a381bf7bdfd,00000000000..2305957cb5a mode 100644,000000..100644 --- a/reactos/subsys/system/ibrowser/ibrowser.xml +++ b/reactos/subsys/system/ibrowser/ibrowser.xml @@@ -1,29 -1,0 +1,30 @@@ + + -fexceptions + . ++ include/expat + + + + + 0x0600 + 0x0501 + 0x0500 + uuid + kernel32 + gdi32 + comctl32 + ole32 + oleaut32 + shell32 + expat + + utility.cpp + window.cpp + xmlstorage.cpp + + ibrowser.cpp + favorites.cpp + mainframe.cpp + webchild.cpp + ibrowser.rc + diff --cc reactos/subsys/win32k/win32k.xml index 3a8a6a1c6bd,00000000000..f58aeb185ed mode 100644,000000..100644 --- a/reactos/subsys/win32k/win32k.xml +++ b/reactos/subsys/win32k/win32k.xml @@@ -1,134 -1,0 +1,135 @@@ + + + . + include + include + include + + + 0x0501 + 0x600 + + rosrtl + ntoskrnl + hal + pseh + freetype + + dib1bpp.c + dib4bpp.c + dib8bpp.c + dib16bpp.c + dib24bpp.c + dib32bpp.c + dib.c + + + bitblt.c + brush.c + clip.c + copybits.c + debug.c + device.c + driverobj.c + error.c + event.c + float.c + gradient.c + lineto.c + mem.c + misc.c + mouse.c + paint.c + palette.c + perfcnt.c + semaphor.c + sort.c + surface.c + transblt.c + window.c + xlate.c + + + loader.c + + + dllmain.c + svctabm.c + + + driver.c + error.c + math.c + object.c ++ ssec.c + + + ddraw.c + stubs.c + + + accelerator.c + callback.c + caret.c + class.c + clipboard.c + csr.c + cursoricon.c + desktop.c + focus.c + guicheck.c + hook.c + hotkey.c + input.c + keyboard.c + menu.c + message.c + metric.c + misc.c + monitor.c + msgqueue.c + painting.c + prop.c + scrollbar.c + stubs.c + timer.c + useratom.c + vis.c + windc.c + window.c + winpos.c + winsta.c + + + bezier.c + bitmaps.c + brush.c + cliprgn.c + color.c + coord.c + dc.c + dib.c + fillshap.c + font.c + gdiobj.c + icm.c + line.c + metafile.c + paint.c + palette.c + path.c + pen.c + polyfill.c + print.c + rect.c + region.c + stockobj.c + text.c + wingl.c + + + stubs.c + xpstubs.c + + win32k.rc + diff --cc reactos/tools/Makefile index 31b80f9a1e8,53c9b15294e..e121ae18829 --- a/reactos/tools/Makefile +++ b/reactos/tools/Makefile @@@ -1,60 -1,189 +1,34 @@@ -PATH_TO_TOP = .. +RMKDIR_BASE = tools -include $(PATH_TO_TOP)/rules.mak +RMKDIR_TARGET = \ + $(ROS_INTERMEDIATE)$(RMKDIR_BASE)$(SEP)rmkdir$(EXEPOSTFIX) -CFLAGS += -Wall -Werror +RMKDIR_SOURCES = \ + $(RMKDIR_BASE)$(SEP)rmkdir.c -TOOLS = \ - regtests$(EXE_POSTFIX) \ - rcopy$(EXE_POSTFIX) \ - rdel$(EXE_POSTFIX) \ - rline$(EXE_POSTFIX) \ - rmkdir$(EXE_POSTFIX) \ - rrmdir$(EXE_POSTFIX) \ - rsym$(EXE_POSTFIX) \ - rtouch$(EXE_POSTFIX) \ - mkflpimg$(EXE_POSTFIX) \ - depends$(EXE_POSTFIX) +RMKDIR_OBJECTS = \ + $(RMKDIR_SOURCES:.c=.o) -LIBS = lib_unicode lib_wpp +RMKDIR_HOST_CFLAGS = -g -Werror -Wall -CLEAN_FILES = $(TOOLS) +RMKDIR_HOST_LFLAGS = -g -all: $(TOOLS) $(LIBS) zlib_target wmc_target cabman_target cdmake_target mkhive_target rgenstat_target \ - wine2ros_target pipetools_target winebuild_target bin2res_target wrc_target widl_target \ - buildno_target +$(RMKDIR_TARGET): $(RMKDIR_OBJECTS) + ${host_gcc} $(RMKDIR_OBJECTS) $(RMKDIR_HOST_LFLAGS) -o $(RMKDIR_TARGET) -regtests$(EXE_POSTFIX): regtests.c - @$(HOST_CC) $(CFLAGS) -o regtests$(EXE_POSTFIX) regtests.c +$(RMKDIR_OBJECTS): %.o : %.c + ${host_gcc} $(RMKDIR_HOST_CFLAGS) -c $< -o $@ -ifeq ($(HOST),mingw32-linux) -rcopy$(EXE_POSTFIX): rcopy.c - @$(HOST_CC) $(CFLAGS) -DUNIX_PATHS rcopy.c -o rcopy$(EXE_POSTFIX) -endif -ifeq ($(HOST),mingw32-windows) -rcopy$(EXE_POSTFIX): rcopy.c - @$(HOST_CC) $(CFLAGS) -DDOS_PATHS rcopy.c -o rcopy$(EXE_POSTFIX) -endif +.PHONY: rmkdir_clean +rmkdir_clean: + -@$(rm) $(RMKDIR_TARGET) $(RMKDIR_OBJECTS) 2>$(NUL) +clean: rmkdir_clean -rdel$(EXE_POSTFIX): rdel.c - @$(HOST_CC) $(CFLAGS) rdel.c -o rdel$(EXE_POSTFIX) -- - BUILDNO_BASE = tools -ifeq ($(HOST),mingw32-linux) -rline$(EXE_POSTFIX): rline.c - @$(HOST_CC) $(CFLAGS) -DUNIX_PATHS rline.c -o rline$(EXE_POSTFIX) -endif -ifeq ($(HOST),mingw32-windows) -rline$(EXE_POSTFIX): rmkdir.c - @$(HOST_CC) $(CFLAGS) -DDOS_PATHS rline.c -o rline$(EXE_POSTFIX) -endif -- - BUILDNO_TARGET = \ - $(ROS_INTERMEDIATE)$(BUILDNO_BASE)$(SEP)buildno$(EXEPOSTFIX) -ifeq ($(HOST),mingw32-linux) -rmkdir$(EXE_POSTFIX): rmkdir.c - @$(HOST_CC) $(CFLAGS) -DUNIX_PATHS rmkdir.c -o rmkdir$(EXE_POSTFIX) -endif -ifeq ($(HOST),mingw32-windows) -rmkdir$(EXE_POSTFIX): rmkdir.c - @$(HOST_CC) $(CFLAGS) -DDOS_PATHS rmkdir.c -o rmkdir$(EXE_POSTFIX) -endif -- - BUILDNO_SOURCES = \ - $(BUILDNO_BASE)$(SEP)buildno.c -ifeq ($(HOST),mingw32-linux) -rrmdir$(EXE_POSTFIX): rrmdir.c - @$(HOST_CC) $(CFLAGS) -DUNIX_PATHS rrmdir.c -o rrmdir$(EXE_POSTFIX) -endif -ifeq ($(HOST),mingw32-windows) -rrmdir$(EXE_POSTFIX): rrmdir.c - @$(HOST_CC) $(CFLAGS) -DDOS_PATHS rrmdir.c -o rrmdir$(EXE_POSTFIX) -endif -- - BUILDNO_OBJECTS = \ - $(BUILDNO_SOURCES:.c=.o) -ifeq ($(HOST),mingw32-linux) -rsym$(EXE_POSTFIX): rsym.c - @$(HOST_CC) $(CFLAGS) -DUNIX_PATHS rsym.c -o rsym$(EXE_POSTFIX) -endif -ifeq ($(HOST),mingw32-windows) -rsym$(EXE_POSTFIX): rsym.c - @$(HOST_CC) $(CFLAGS) -DDOS_PATHS rsym.c -o rsym$(EXE_POSTFIX) -endif -- - BUILDNO_HOST_CFLAGS = -g -Werror -Wall -ifeq ($(HOST),mingw32-linux) -rtouch$(EXE_POSTFIX): rtouch.c - @$(HOST_CC) $(CFLAGS) -DUNIX_PATHS rtouch.c -o rtouch$(EXE_POSTFIX) -endif -ifeq ($(HOST),mingw32-windows) -rtouch$(EXE_POSTFIX): rtouch.c - @$(HOST_CC) $(CFLAGS) -DDOS_PATHS rtouch.c -o rtouch$(EXE_POSTFIX) -endif -- - BUILDNO_HOST_LFLAGS = -g -ifeq ($(HOST),mingw32-linux) -mkflpimg$(EXE_POSTFIX): mkflpimg.c - @$(HOST_CC) $(CFLAGS) -DUNIX_PATHS mkflpimg.c -o mkflpimg$(EXE_POSTFIX) -endif -ifeq ($(HOST),mingw32-windows) -mkflpimg$(EXE_POSTFIX): mkflpimg.c - @$(HOST_CC) $(CFLAGS) -DDOS_PATHS mkflpimg.c -o mkflpimg$(EXE_POSTFIX) -endif -- - $(BUILDNO_TARGET): $(BUILDNO_OBJECTS) - ${host_gcc} $(BUILDNO_OBJECTS) $(BUILDNO_HOST_LFLAGS) -o $(BUILDNO_TARGET) -depends$(EXE_POSTFIX): depends.c - @$(HOST_CC) $(CFLAGS) depends.c -o depends$(EXE_POSTFIX) -- - $(BUILDNO_OBJECTS): %.o : %.c - ${host_gcc} $(BUILDNO_HOST_CFLAGS) -c $< -o $@ -zlib_target: - $(MAKE) --silent -C ../lib/zlib -f Makefile.host -- - .PHONY: buildno_clean - buildno_clean: - -@$(rm) $(BUILDNO_TARGET) $(BUILDNO_OBJECTS) 2>$(NUL) - clean: buildno_clean -wmc_target: - $(MAKE) --silent -C wmc wmc$(EXE_POSTFIX) -- - include$(SEP)reactos$(SEP)buildno.h: $(BUILDNO_TARGET) - $(EXEPREFIX)$(BUILDNO_TARGET) include$(SEP)reactos$(SEP)buildno.h -cabman_target: - $(MAKE) --silent -C cabman cabman$(EXE_POSTFIX) - -cdmake_target: - $(MAKE) --silent -C cdmake cdmake$(EXE_POSTFIX) - -mkhive_target: - $(MAKE) --silent -C mkhive mkhive$(EXE_POSTFIX) - -rgenstat_target: - $(MAKE) --silent -C rgenstat rgenstat$(EXE_POSTFIX) - -wine2ros_target: - $(MAKE) --silent -C wine2ros wine2ros$(EXE_POSTFIX) - -pipetools_target: -ifeq ($(HOST),mingw32-windows) - $(MAKE) --silent -C pipetools -endif - -winebuild_target: - $(MAKE) --silent -C winebuild winebuild$(EXE_POSTFIX) - -bin2res_target: - $(MAKE) --silent -C bin2res bin2res$(EXE_POSTFIX) - -wrc_target: $(LIBS) - $(MAKE) --silent -C wrc wrc$(EXE_POSTFIX) - -widl_target: lib_wpp - $(MAKE) --silent -C widl widl$(EXE_POSTFIX) - -buildno_target: - $(MAKE) --silent -C buildno buildno$(EXE_POSTFIX) - -lib_unicode: - $(MAKE) -C unicode - -lib_wpp: - $(MAKE) -C wpp - -.PHONY: wmc_target cdmake_target mkhive_target rgenstat_target pipetools_target wrc_target \ - widl_target buildno_target lib_unicode lib_wpp - - -ifeq ($(HOST),mingw32-linux) -clean: - $(MAKE) --silent -C buildno clean - $(MAKE) --silent -C widl clean - $(MAKE) --silent -C wrc clean - $(MAKE) --silent -C cabman clean - $(MAKE) --silent -C cdmake clean - $(MAKE) --silent -C mkhive clean - $(MAKE) --silent -C wmc clean - $(MAKE) --silent -C rgenstat clean - $(MAKE) --silent -C wine2ros clean - $(MAKE) --silent -C winebuild clean - $(MAKE) --silent -C bin2res clean - $(MAKE) --silent -C ../lib/zlib -f Makefile.host clean - $(MAKE) -C wpp clean - $(MAKE) -C unicode clean - @rm mkconfig - @rm $(TOOLS) -endif -ifeq ($(HOST),mingw32-windows) -clean: - $(MAKE) --silent -C buildno clean - $(MAKE) --silent -C widl clean - $(MAKE) --silent -C wrc clean - $(MAKE) --silent -C cabman clean - $(MAKE) --silent -C cdmake clean - $(MAKE) --silent -C mkhive clean - $(MAKE) --silent -C wmc clean - $(MAKE) --silent -C rgenstat clean - $(MAKE) --silent -C pipetools clean - $(MAKE) --silent -C wine2ros clean - $(MAKE) --silent -C winebuild clean - $(MAKE) --silent -C bin2res clean - $(MAKE) --silent -C ../lib/zlib -f Makefile.host clean - $(MAKE) -C wpp clean - $(MAKE) -C unicode clean - -@del *$(EXE_POSTFIX) -endif -- -.PHONY: all clean ++include tools/buildno/Makefile +include tools/cdmake/makefile +include tools/nci/makefile +include tools/rbuild/makefile ++include tools/unicode/Makefile +include tools/wmc/makefile ++include tools/wpp/Makefile ++include tools/wrc/makefile diff --cc reactos/tools/buildno/Makefile index 00000000000,a5e3cd7493e..a7136accdd9 mode 000000,100644..100644 --- a/reactos/tools/buildno/Makefile +++ b/reactos/tools/buildno/Makefile @@@ -1,0 -1,42 +1,32 @@@ -PATH_TO_TOP = ../.. ++BUILDNO_BASE = tools$(SEP)buildno + -TARGET = buildno$(EXE_POSTFIX) ++BUILDNO_TARGET = \ ++ $(ROS_INTERMEDIATE)$(BUILDNO_BASE)$(SEP)buildno$(EXEPOSTFIX) + -all: $(TARGET) ++BUILDNO_SOURCES = \ ++ $(BUILDNO_BASE)$(SEP)buildno.cpp \ ++ $(BUILDNO_BASE)$(SEP)exception.cpp \ ++ $(BUILDNO_BASE)$(SEP)ssprintf.cpp \ ++ $(BUILDNO_BASE)$(SEP)XML.cpp + -OBJECTS = buildno.o XML.o exception.o ssprintf.o ++BUILDNO_OBJECTS = \ ++ $(BUILDNO_SOURCES:.cpp=.o) + -CLEAN_FILES = *.o buildno$(EXE_POSTFIX) ++BUILDNO_HOST_CFLAGS = -Iinclude/reactos -g -Werror -Wall + -HOST_CXXFLAGS = -I$(PATH_TO_TOP)/include/reactos -g -Wall -Werror ++BUILDNO_HOST_LFLAGS = -g + -buildno.o: buildno.cpp $(PATH_TO_TOP)/include/reactos/version.h - $(HOST_CXX) $(HOST_CXXFLAGS) -o buildno.o -c buildno.cpp ++$(BUILDNO_TARGET): $(BUILDNO_OBJECTS) ++ ${host_gpp} $(BUILDNO_OBJECTS) $(BUILDNO_HOST_CFLAGS) -o $(BUILDNO_TARGET) + -XML.o: XML.cpp - $(HOST_CXX) $(HOST_CXXFLAGS) -o XML.o -c XML.cpp ++$(BUILDNO_OBJECTS): %.o : %.cpp include$(SEP)reactos$(SEP)version.h ++ ${host_gpp} $(BUILDNO_HOST_CFLAGS) -c $< -o $@ + -exception.o: exception.cpp - $(HOST_CXX) $(HOST_CXXFLAGS) -o exception.o -c exception.cpp ++.PHONY: buildno_clean ++buildno_clean: ++ -@$(rm) $(BUILDNO_TARGET) $(BUILDNO_OBJECTS) 2>$(NUL) + -ssprintf.o: ssprintf.cpp - $(HOST_CXX) $(HOST_CXXFLAGS) -o ssprintf.o -c ssprintf.cpp ++BUILDNO_H = include$(SEP)reactos$(SEP)buildno.h + -buildno$(EXE_POSTFIX): $(OBJECTS) - $(HOST_CXX) -g $(OBJECTS) -o $(TARGET) - @$(EXE_PREFIX)buildno$(EXE_POSTFIX) - -ifeq ($(HOST),mingw32-linux) -clean: - -rm -f *.o $(TARGET) - -rm $(PATH_TO_TOP)/include/reactos/buildno.h -endif -ifneq ($(HOST),mingw32-linux) -clean: - -del *.o $(TARGET) - -del ..\..\include\reactos\buildno.h -endif - -.PHONY: clean - -include $(PATH_TO_TOP)/rules.mak ++$(BUILDNO_H): $(BUILDNO_TARGET) ++ $(EXEPREFIX)$(BUILDNO_TARGET) $(BUILDNO_H) diff --cc reactos/tools/rbuild/backend/mingw/mingw.cpp index ea997581403,00000000000..fa848a54958 mode 100644,000000..100644 --- a/reactos/tools/rbuild/backend/mingw/mingw.cpp +++ b/reactos/tools/rbuild/backend/mingw/mingw.cpp @@@ -1,281 -1,0 +1,282 @@@ + +#include "../../pch.h" + +#include "mingw.h" +#include + +using std::string; +using std::vector; + +static class MingwFactory : public Backend::Factory +{ +public: + MingwFactory() : Factory ( "mingw" ) {} + Backend* operator() ( Project& project ) + { + return new MingwBackend ( project ); + } +} factory; + + +MingwBackend::MingwBackend ( Project& project ) + : Backend ( project ) +{ +} + +void +MingwBackend::Process () +{ + CreateMakefile (); + GenerateHeader (); + GenerateGlobalVariables (); + GenerateAllTarget (); + GenerateInitTarget (); + for ( size_t i = 0; i < ProjectNode.modules.size (); i++ ) + { + Module& module = *ProjectNode.modules[i]; + ProcessModule ( module ); + } + CheckAutomaticDependencies (); + CloseMakefile (); +} + +void +MingwBackend::CreateMakefile () +{ + fMakefile = fopen ( ProjectNode.makefile.c_str (), "w" ); + if ( !fMakefile ) + throw AccessDeniedException ( ProjectNode.makefile ); + MingwModuleHandler::SetMakefile ( fMakefile ); +} + +void +MingwBackend::CloseMakefile () const +{ + if (fMakefile) + fclose ( fMakefile ); +} + +void +MingwBackend::GenerateHeader () const +{ + fprintf ( fMakefile, "# THIS FILE IS AUTOMATICALLY GENERATED, EDIT 'ReactOS.xml' INSTEAD\n\n" ); +} + +void +MingwBackend::GenerateProjectCFlagsMacro ( const char* assignmentOperation, + const vector& includes, + const vector& defines ) const +{ + size_t i; + + fprintf ( + fMakefile, + "PROJECT_CFLAGS %s", + assignmentOperation ); + for ( i = 0; i < includes.size(); i++ ) + { + fprintf ( + fMakefile, + " -I%s", + includes[i]->directory.c_str() ); + } + + for ( i = 0; i < defines.size(); i++ ) + { + Define& d = *defines[i]; + fprintf ( + fMakefile, + " -D%s", + d.name.c_str() ); + if ( d.value.size() ) + fprintf ( + fMakefile, + "=%s", + d.value.c_str() ); + } + fprintf ( fMakefile, "\n" ); +} + +void +MingwBackend::GenerateGlobalCFlagsAndProperties ( + const char* assignmentOperation, + const vector& properties, + const vector& includes, + const vector& defines, + const vector& ifs ) const +{ + size_t i; + + for ( i = 0; i < properties.size(); i++ ) + { + Property& prop = *properties[i]; + fprintf ( fMakefile, "%s := %s\n", + prop.name.c_str(), + prop.value.c_str() ); + } + + if ( includes.size() || defines.size() ) + { + GenerateProjectCFlagsMacro ( assignmentOperation, + includes, + defines ); + } + + for ( i = 0; i < ifs.size(); i++ ) + { + If& rIf = *ifs[i]; + if ( rIf.defines.size() || rIf.includes.size() || rIf.ifs.size() ) + { + fprintf ( + fMakefile, + "ifeq (\"$(%s)\",\"%s\")\n", + rIf.property.c_str(), + rIf.value.c_str() ); + GenerateGlobalCFlagsAndProperties ( + "+=", + rIf.properties, + rIf.includes, + rIf.defines, + rIf.ifs ); + fprintf ( + fMakefile, + "endif\n\n" ); + } + } +} + +string +MingwBackend::GenerateProjectLFLAGS () const +{ + string lflags; + for ( size_t i = 0; i < ProjectNode.linkerFlags.size (); i++ ) + { + LinkerFlag& linkerFlag = *ProjectNode.linkerFlags[i]; + if ( lflags.length () > 0 ) + lflags += " "; + lflags += linkerFlag.flag; + } + return lflags; +} + +void +MingwBackend::GenerateGlobalVariables () const +{ + fprintf ( fMakefile, "mkdir = tools" SSEP "rmkdir" EXEPOSTFIX "\n" ); + fprintf ( fMakefile, "winebuild = tools" SSEP "winebuild" SSEP "winebuild" EXEPOSTFIX "\n" ); + fprintf ( fMakefile, "bin2res = tools" SSEP "bin2res" SSEP "bin2res" EXEPOSTFIX "\n" ); + fprintf ( fMakefile, "cabman = tools" SSEP "cabman" SSEP "cabman" EXEPOSTFIX "\n" ); + fprintf ( fMakefile, "cdmake = tools" SSEP "cdmake" SSEP "cdmake" EXEPOSTFIX "\n" ); ++ fprintf ( fMakefile, "wrc = tools" SSEP "wrc" SSEP "wrc" EXEPOSTFIX "\n" ); + fprintf ( fMakefile, "\n" ); + GenerateGlobalCFlagsAndProperties ( + "=", + ProjectNode.properties, + ProjectNode.includes, + ProjectNode.defines, + ProjectNode.ifs ); + fprintf ( fMakefile, "PROJECT_RCFLAGS = $(PROJECT_CFLAGS)\n" ); + fprintf ( fMakefile, "PROJECT_LFLAGS = %s\n", + GenerateProjectLFLAGS ().c_str () ); + fprintf ( fMakefile, "\n" ); +} + +bool +MingwBackend::IncludeInAllTarget ( const Module& module ) const +{ + if ( module.type == ObjectLibrary ) + return false; + if ( module.type == BootSector ) + return false; + if ( module.type == Iso ) + return false; + return true; +} + +void +MingwBackend::GenerateAllTarget () const +{ + fprintf ( fMakefile, "all:" ); + for ( size_t i = 0; i < ProjectNode.modules.size (); i++ ) + { + Module& module = *ProjectNode.modules[i]; + if ( IncludeInAllTarget ( module ) ) + { + fprintf ( fMakefile, + " %s", + FixupTargetFilename ( module.GetPath () ).c_str () ); + } + } + fprintf ( fMakefile, "\n\t\n\n" ); +} + +string +MingwBackend::GetBuildToolDependencies () const +{ + string dependencies; + for ( size_t i = 0; i < ProjectNode.modules.size (); i++ ) + { + Module& module = *ProjectNode.modules[i]; + if ( module.type == BuildTool ) + { + if ( dependencies.length () > 0 ) + dependencies += " "; + dependencies += module.GetDependencyPath (); + } + } + return dependencies; +} + +void +MingwBackend::GenerateInitTarget () const +{ + fprintf ( fMakefile, + "init:"); + fprintf ( fMakefile, + " $(ROS_INTERMEDIATE)." SSEP "tools" ); + fprintf ( fMakefile, + " %s", + GetBuildToolDependencies ().c_str () ); + fprintf ( fMakefile, + " %s", + "include" SSEP "reactos" SSEP "buildno.h" ); + fprintf ( fMakefile, + "\n\t\n\n" ); + + fprintf ( fMakefile, + "$(ROS_INTERMEDIATE)." SSEP "tools:\n" ); + fprintf ( fMakefile, + "ifneq ($(ROS_INTERMEDIATE),)\n" ); + fprintf ( fMakefile, + "\t${nmkdir} $(ROS_INTERMEDIATE)\n" ); + fprintf ( fMakefile, + "endif\n" ); + fprintf ( fMakefile, + "\t${nmkdir} $(ROS_INTERMEDIATE)." SSEP "tools\n" ); + fprintf ( fMakefile, + "\n" ); +} + +void +MingwBackend::CheckAutomaticDependencies () +{ + AutomaticDependency automaticDependency ( ProjectNode ); + automaticDependency.Process (); + automaticDependency.CheckAutomaticDependencies (); +} + +void +MingwBackend::ProcessModule ( Module& module ) const +{ + MingwModuleHandler* h = MingwModuleHandler::LookupHandler ( + module.node.location, + module.type ); + h->Process ( module ); + h->GenerateDirectoryTargets (); +} + +string +FixupTargetFilename ( const string& targetFilename ) +{ + return string("$(ROS_INTERMEDIATE)") + NormalizeFilename ( targetFilename ); +} diff --cc reactos/tools/rbuild/backend/mingw/modulehandler.cpp index 9a82bff6dea,00000000000..50986984839 mode 100644,000000..100644 --- a/reactos/tools/rbuild/backend/mingw/modulehandler.cpp +++ b/reactos/tools/rbuild/backend/mingw/modulehandler.cpp @@@ -1,2126 -1,0 +1,2144 @@@ +#include "../../pch.h" +#include + +#include "../../rbuild.h" +#include "mingw.h" +#include "modulehandler.h" + +using std::string; +using std::vector; +using std::map; +using std::set; + +typedef set set_string; + +map* +MingwModuleHandler::handler_map = NULL; +set_string +MingwModuleHandler::directory_set; +int +MingwModuleHandler::ref = 0; + +FILE* +MingwModuleHandler::fMakefile = NULL; + +string +ReplaceExtension ( const string& filename, - const string& newExtension ) ++ const string& newExtension ) +{ + size_t index = filename.find_last_of ( '/' ); + if (index == string::npos) index = 0; + string tmp = filename.substr( index, filename.size() - index ); + size_t ext_index = tmp.find_last_of( '.' ); + if (ext_index != string::npos) + return filename.substr ( 0, index + ext_index ) + newExtension; + return filename + newExtension; +} + + +MingwModuleHandler::MingwModuleHandler ( ModuleType moduletype ) +{ + if ( !ref++ ) + handler_map = new map; + (*handler_map)[moduletype] = this; +} + +MingwModuleHandler::~MingwModuleHandler() +{ + if ( !--ref ) + { + delete handler_map; + handler_map = NULL; + } +} + +const string & +MingwModuleHandler::PassThruCacheDirectory ( const string &file ) const +{ + directory_set.insert ( GetDirectory ( file ) ); + return file; +} + +void +MingwModuleHandler::SetMakefile ( FILE* f ) +{ + fMakefile = f; +} + +MingwModuleHandler* +MingwModuleHandler::LookupHandler ( const string& location, + ModuleType moduletype ) +{ + if ( !handler_map ) + throw Exception ( "internal tool error: no registered module handlers" ); + MingwModuleHandler* h = (*handler_map)[moduletype]; + if ( !h ) + { + throw UnknownModuleTypeException ( location, moduletype ); + return NULL; + } + return h; +} + +string +MingwModuleHandler::GetWorkingDirectory () const +{ + return "."; +} + +string +MingwModuleHandler::GetBasename ( const string& filename ) const +{ + size_t index = filename.find_last_of ( '.' ); + if ( index != string::npos ) + return filename.substr ( 0, index ); + return ""; +} + +string +MingwModuleHandler::GetActualSourceFilename ( const string& filename ) const +{ + string extension = GetExtension ( filename ); + if ( extension == ".spec" || extension == "SPEC" ) + { + string basename = GetBasename ( filename ); + return basename + ".stubs.c"; + } + else + return filename; +} + +string +MingwModuleHandler::GetModuleArchiveFilename ( const Module& module ) const +{ + return ReplaceExtension ( FixupTargetFilename ( module.GetPath () ), + ".a" ); +} + +bool +MingwModuleHandler::IsGeneratedFile ( const File& file ) const +{ + string extension = GetExtension ( file.name ); + if ( extension == ".spec" || extension == "SPEC" ) + return true; + else + return false; +} + +string +MingwModuleHandler::GetImportLibraryDependency ( const Module& importedModule ) const +{ + if ( importedModule.type == ObjectLibrary ) + return GetObjectsMacro ( importedModule ); + else + return PassThruCacheDirectory ( FixupTargetFilename ( importedModule.GetDependencyPath () ) ); +} + +string +MingwModuleHandler::GetImportLibraryDependencies ( const Module& module ) const +{ + string dependencies ( "" ); + for ( size_t i = 0; i < module.libraries.size (); i++ ) + { + if ( dependencies.size () > 0 ) + dependencies += " "; + const Module* importedModule = module.project.LocateModule ( module.libraries[i]->name ); + assert ( importedModule != NULL ); + dependencies += GetImportLibraryDependency ( *importedModule ); + } + return dependencies; +} + +string +MingwModuleHandler::GetModuleDependencies ( const Module& module ) const +{ + if ( module.dependencies.size () == 0 ) + return ""; + + string dependencies ( "" ); + for ( size_t i = 0; i < module.dependencies.size (); i++ ) + { + if ( dependencies.size () > 0 ) + dependencies += " "; + const Dependency* dependency = module.dependencies[i]; + const Module* dependencyModule = dependency->dependencyModule; + dependencies += dependencyModule->GetTargets (); + } + string definitionDependencies = GetDefinitionDependencies ( module ); + if ( dependencies.length () > 0 && definitionDependencies.length () > 0 ) + dependencies += " " + definitionDependencies; + else if ( definitionDependencies.length () > 0 ) + dependencies = definitionDependencies; + return dependencies; +} + +string +MingwModuleHandler::GetAllDependencies ( const Module& module ) const +{ + string dependencies = GetImportLibraryDependencies ( module ); + string s = GetModuleDependencies ( module ); + if ( s.length () > 0 ) + { + dependencies += " "; + dependencies += s; + } + return dependencies; +} + +string +MingwModuleHandler::GetSourceFilenames ( const Module& module, + bool includeGeneratedFiles ) const +{ + size_t i; + + string sourceFilenames ( "" ); + for ( i = 0; i < module.files.size (); i++ ) + { + if ( includeGeneratedFiles || !IsGeneratedFile ( *module.files[i] ) ) + sourceFilenames += " " + GetActualSourceFilename ( module.files[i]->name ); + } + vector ifs = module.ifs; + for ( i = 0; i < ifs.size (); i++ ) + { + size_t j; + If& rIf = *ifs[i]; + for ( j = 0; j < rIf.ifs.size (); j++ ) + ifs.push_back ( rIf.ifs[j] ); + for ( j = 0; j < rIf.files.size (); j++ ) + { + if ( includeGeneratedFiles || !IsGeneratedFile ( *rIf.files[j] ) ) + sourceFilenames += " " + GetActualSourceFilename ( rIf.files[j]->name ); + } + } + return sourceFilenames; +} + +string +MingwModuleHandler::GetSourceFilenames ( const Module& module ) const +{ + return GetSourceFilenames ( module, + true ); +} + +string +MingwModuleHandler::GetSourceFilenamesWithoutGeneratedFiles ( const Module& module ) const +{ + return GetSourceFilenames ( module, + false ); +} + +string +MingwModuleHandler::GetObjectFilename ( const string& sourceFilename ) +{ + string newExtension; + string extension = GetExtension ( sourceFilename ); + if ( extension == ".rc" || extension == ".RC" ) + newExtension = ".coff"; + else if ( extension == ".spec" || extension == ".SPEC" ) + newExtension = ".stubs.o"; + else + newExtension = ".o"; + return FixupTargetFilename ( ReplaceExtension ( sourceFilename, newExtension ) ); +} + +string +MingwModuleHandler::GetObjectFilenames ( const Module& module ) const +{ + if ( module.files.size () == 0 ) + return ""; + + string objectFilenames ( "" ); + for ( size_t i = 0; i < module.files.size (); i++ ) + { + if ( objectFilenames.size () > 0 ) + objectFilenames += " "; + objectFilenames += PassThruCacheDirectory ( MingwModuleHandler::GetObjectFilename ( module.files[i]->name ) ); + } + return objectFilenames; +} + +bool +MingwModuleHandler::IncludeDirectoryTarget ( const string& directory ) const +{ + if ( directory == "$(ROS_INTERMEDIATE)." SSEP "tools") + return false; + else + return true; +} + +void +MingwModuleHandler::GenerateDirectoryTargets () const +{ + if ( directory_set.size () == 0 ) + return; + + set_string::iterator i; + fprintf ( fMakefile, "directories::" ); + + for ( i = directory_set.begin (); + i != directory_set.end (); + i++ ) + { + if ( IncludeDirectoryTarget ( *i ) ) + { + fprintf ( fMakefile, + " %s", + i->c_str () ); + } + } + + fprintf ( fMakefile, "\n\n" ); + + for ( i = directory_set.begin (); + i != directory_set.end (); + i++ ) + { + if ( IncludeDirectoryTarget ( *i ) ) + { + fprintf ( fMakefile, + "%s ", + i->c_str () ); + } + } + + fprintf ( fMakefile, + "::\n\t${mkdir} $@\n\n" ); + + directory_set.clear (); +} + +string +MingwModuleHandler::GenerateGccDefineParametersFromVector ( const vector& defines ) const +{ + string parameters; + for ( size_t i = 0; i < defines.size (); i++ ) + { + Define& define = *defines[i]; + if (parameters.length () > 0) + parameters += " "; + parameters += "-D"; + parameters += define.name; + if (define.value.length () > 0) + { + parameters += "="; + parameters += define.value; + } + } + return parameters; +} + +string +MingwModuleHandler::GenerateGccDefineParameters ( const Module& module ) const +{ + string parameters = GenerateGccDefineParametersFromVector ( module.project.defines ); + string s = GenerateGccDefineParametersFromVector ( module.defines ); + if ( s.length () > 0 ) + { + parameters += " "; + parameters += s; + } + return parameters; +} + +string +MingwModuleHandler::ConcatenatePaths ( const string& path1, + const string& path2 ) const +{ + if ( ( path1.length () == 0 ) || ( path1 == "." ) || ( path1 == "./" ) ) + return path2; + if ( path1[path1.length ()] == CSEP ) + return path1 + path2; + else + return path1 + CSEP + path2; +} + +string +MingwModuleHandler::GenerateGccIncludeParametersFromVector ( const vector& includes ) const +{ + string parameters; + for ( size_t i = 0; i < includes.size (); i++ ) + { + Include& include = *includes[i]; + if ( parameters.length () > 0 ) + parameters += " "; + parameters += "-I" + include.directory; + } + return parameters; +} + +string +MingwModuleHandler::GenerateGccIncludeParameters ( const Module& module ) const +{ + string parameters = GenerateGccIncludeParametersFromVector ( module.includes ); + string s = GenerateGccIncludeParametersFromVector ( module.project.includes ); + if ( s.length () > 0 ) + { + parameters += " "; + parameters += s; + } + return parameters; +} + + +string +MingwModuleHandler::GenerateCompilerParametersFromVector ( const vector& compilerFlags ) const +{ + string parameters; + for ( size_t i = 0; i < compilerFlags.size (); i++ ) + { + CompilerFlag& compilerFlag = *compilerFlags[i]; + if ( parameters.length () > 0 ) + parameters += " "; + parameters += compilerFlag.flag; + } + return parameters; +} + +string +MingwModuleHandler::GenerateLinkerParametersFromVector ( const vector& linkerFlags ) const +{ + string parameters; + for ( size_t i = 0; i < linkerFlags.size (); i++ ) + { + LinkerFlag& linkerFlag = *linkerFlags[i]; + if ( parameters.length () > 0 ) + parameters += " "; + parameters += linkerFlag.flag; + } + return parameters; +} + +string +MingwModuleHandler::GenerateLinkerParameters ( const Module& module ) const +{ + return GenerateLinkerParametersFromVector ( module.linkerFlags ); +} + +void +MingwModuleHandler::GenerateMacro ( const char* assignmentOperation, + const string& macro, + const vector& includes, + const vector& defines, + const vector* compilerFlags ) const +{ + size_t i; + + fprintf ( + fMakefile, + "%s %s", + macro.c_str(), + assignmentOperation ); + + if ( compilerFlags != NULL ) + { + string compilerParameters = GenerateCompilerParametersFromVector ( *compilerFlags ); + if ( compilerParameters.size () > 0 ) + { + fprintf ( + fMakefile, + " %s", + compilerParameters.c_str () ); + } + } + + for ( i = 0; i < includes.size(); i++ ) + { + fprintf ( + fMakefile, + " -I%s", + includes[i]->directory.c_str() ); + } + for ( i = 0; i < defines.size(); i++ ) + { + Define& d = *defines[i]; + fprintf ( + fMakefile, + " -D%s", + d.name.c_str() ); + if ( d.value.size() ) + fprintf ( + fMakefile, + "=%s", + d.value.c_str() ); + } + fprintf ( fMakefile, "\n" ); +} + +void +MingwModuleHandler::GenerateMacros ( + const char* assignmentOperation, + const vector& files, + const vector& includes, + const vector& defines, + const vector* compilerFlags, + const vector* linkerFlags, + const vector& ifs, + const string& cflags_macro, + const string& nasmflags_macro, + const string& windresflags_macro, + const string& linkerflags_macro, + const string& objs_macro) const +{ + size_t i; + + if ( includes.size() || defines.size() ) + { + GenerateMacro ( assignmentOperation, + cflags_macro, + includes, + defines, + compilerFlags ); + GenerateMacro ( assignmentOperation, + windresflags_macro, + includes, + defines, + compilerFlags ); + } + + if ( linkerFlags != NULL ) + { + string linkerParameters = GenerateLinkerParametersFromVector ( *linkerFlags ); + if ( linkerParameters.size () > 0 ) + { + fprintf ( + fMakefile, + "%s %s %s\n", + linkerflags_macro.c_str (), + assignmentOperation, + linkerParameters.c_str() ); + } + } + + if ( files.size() ) + { + for ( i = 0; i < files.size(); i++ ) + { + if ( files[i]->first ) + { + fprintf ( fMakefile, + "%s := %s $(%s)\n", + objs_macro.c_str(), + PassThruCacheDirectory ( MingwModuleHandler::GetObjectFilename ( files[i]->name ) ).c_str (), + objs_macro.c_str() ); + } + } + fprintf ( + fMakefile, + "%s %s", + objs_macro.c_str(), + assignmentOperation ); + for ( i = 0; i < files.size(); i++ ) + { + string extension = GetExtension ( files[i]->name ); + if ( extension != ".spec" + && extension != ".SPEC" + && !files[i]->first ) + { + fprintf ( + fMakefile, + "%s%s", + ( i%10 == 9 ? "\\\n\t" : " " ), + PassThruCacheDirectory ( MingwModuleHandler::GetObjectFilename ( files[i]->name ) ).c_str () ); + } + } + fprintf ( fMakefile, "\n" ); + } + + for ( i = 0; i < ifs.size(); i++ ) + { + If& rIf = *ifs[i]; + if ( rIf.defines.size() || rIf.includes.size() || rIf.files.size() || rIf.ifs.size() ) + { + fprintf ( + fMakefile, + "ifeq (\"$(%s)\",\"%s\")\n", + rIf.property.c_str(), + rIf.value.c_str() ); + GenerateMacros ( + "+=", + rIf.files, + rIf.includes, + rIf.defines, + NULL, + NULL, + rIf.ifs, + cflags_macro, + nasmflags_macro, + windresflags_macro, + linkerflags_macro, + objs_macro ); + fprintf ( + fMakefile, + "endif\n\n" ); + } + } +} + +void +MingwModuleHandler::GenerateMacros ( + const Module& module, + const string& cflags_macro, + const string& nasmflags_macro, + const string& windresflags_macro, + const string& linkerflags_macro, + const string& objs_macro) const +{ + GenerateMacros ( + "=", + module.files, + module.includes, + module.defines, + &module.compilerFlags, + &module.linkerFlags, + module.ifs, + cflags_macro, + nasmflags_macro, + windresflags_macro, + linkerflags_macro, + objs_macro ); + fprintf ( fMakefile, "\n" ); + + fprintf ( + fMakefile, + "%s += $(PROJECT_CFLAGS)\n\n", + cflags_macro.c_str () ); + + fprintf ( + fMakefile, + "%s += $(PROJECT_RCFLAGS)\n\n", + windresflags_macro.c_str () ); + + fprintf ( + fMakefile, + "%s_LFLAGS += $(PROJECT_LFLAGS)\n\n", + module.name.c_str () ); +} + +void +MingwModuleHandler::GenerateGccCommand ( const Module& module, + const string& sourceFilename, + const string& cc, + const string& cflagsMacro ) const +{ + string objectFilename = PassThruCacheDirectory ( MingwModuleHandler::GetObjectFilename ( sourceFilename ) ); + fprintf ( fMakefile, + "%s: %s\n", + objectFilename.c_str (), + sourceFilename.c_str () ); + fprintf ( fMakefile, + "\t%s -c %s -o %s %s\n", + cc.c_str (), + sourceFilename.c_str (), + objectFilename.c_str (), + cflagsMacro.c_str () ); +} + +void +MingwModuleHandler::GenerateGccAssemblerCommand ( const Module& module, + const string& sourceFilename, + const string& cc, + const string& cflagsMacro ) const +{ + string objectFilename = PassThruCacheDirectory ( MingwModuleHandler::GetObjectFilename ( sourceFilename ) ); + fprintf ( fMakefile, + "%s: %s\n", + objectFilename.c_str (), + sourceFilename.c_str () ); + fprintf ( fMakefile, + "\t%s -x assembler-with-cpp -c %s -o %s -D__ASM__ %s\n", + cc.c_str (), + sourceFilename.c_str (), + objectFilename.c_str (), + cflagsMacro.c_str () ); +} + +void +MingwModuleHandler::GenerateNasmCommand ( const Module& module, + const string& sourceFilename, + const string& nasmflagsMacro ) const +{ + string objectFilename = PassThruCacheDirectory ( MingwModuleHandler::GetObjectFilename ( sourceFilename ) ); + fprintf ( fMakefile, + "%s: %s\n", + objectFilename.c_str (), + sourceFilename.c_str () ); + fprintf ( fMakefile, + "\t%s -f win32 %s -o %s %s\n", + "nasm", + sourceFilename.c_str (), + objectFilename.c_str (), + nasmflagsMacro.c_str () ); +} + +void +MingwModuleHandler::GenerateWindresCommand ( const Module& module, + const string& sourceFilename, + const string& windresflagsMacro ) const +{ + string objectFilename = PassThruCacheDirectory ( MingwModuleHandler::GetObjectFilename ( sourceFilename ) ); ++ string rciFilename = ReplaceExtension ( sourceFilename, ++ ".rci" ); ++ string resFilename = ReplaceExtension ( sourceFilename, ++ ".res" ); + fprintf ( fMakefile, + "%s: %s\n", + objectFilename.c_str (), + sourceFilename.c_str () ); + fprintf ( fMakefile, - "\t%s %s -o %s ${%s}\n", - "${windres}", ++ "\t${gcc} -xc -E -DRC_INVOKED ${%s} %s > %s\n", ++ windresflagsMacro.c_str (), + sourceFilename.c_str (), - objectFilename.c_str (), - windresflagsMacro.c_str () ); ++ rciFilename.c_str () ); ++ fprintf ( fMakefile, ++ "\t${wrc} ${%s} %s %s\n", ++ windresflagsMacro.c_str (), ++ rciFilename.c_str (), ++ resFilename.c_str () ); ++ fprintf ( fMakefile, ++ "\t${rm} %s\n", ++ rciFilename.c_str () ); ++ fprintf ( fMakefile, ++ "\t${windres} %s -o %s\n", ++ resFilename.c_str (), ++ objectFilename.c_str () ); ++ fprintf ( fMakefile, ++ "\t${rm} %s\n", ++ resFilename.c_str () ); +} + +void +MingwModuleHandler::GenerateWinebuildCommands ( const Module& module, + const string& sourceFilename ) const +{ + string basename = GetBasename ( sourceFilename ); + fprintf ( fMakefile, + "%s.spec.def: %s\n", + basename.c_str (), + sourceFilename.c_str () ); + fprintf ( fMakefile, + "\t%s --def=%s -o %s.spec.def\n", + "${winebuild}", + sourceFilename.c_str (), + basename.c_str () ); + + fprintf ( fMakefile, + "%s.stubs.c: %s\n", + basename.c_str (), + sourceFilename.c_str () ); + fprintf ( fMakefile, + "\t%s --pedll=%s -o %s.stubs.c\n", + "${winebuild}", + sourceFilename.c_str (), + basename.c_str () ); +} + +void +MingwModuleHandler::GenerateCommands ( const Module& module, + const string& sourceFilename, + const string& cc, + const string& cppc, + const string& cflagsMacro, + const string& nasmflagsMacro, + const string& windresflagsMacro ) const +{ + string extension = GetExtension ( sourceFilename ); + if ( extension == ".c" || extension == ".C" ) + { + GenerateGccCommand ( module, + sourceFilename, + cc, + cflagsMacro ); + return; + } + else if ( extension == ".cc" || extension == ".CC" || + extension == ".cpp" || extension == ".CPP" || + extension == ".cxx" || extension == ".CXX" ) + { + GenerateGccCommand ( module, + sourceFilename, + cppc, + cflagsMacro ); + return; + } + else if ( extension == ".s" || extension == ".S" ) + { + GenerateGccAssemblerCommand ( module, + sourceFilename, + cc, + cflagsMacro ); + return; + } + else if ( extension == ".asm" || extension == ".ASM" ) + { + GenerateNasmCommand ( module, + sourceFilename, + nasmflagsMacro ); + return; + } + else if ( extension == ".rc" || extension == ".RC" ) + { + GenerateWindresCommand ( module, + sourceFilename, + windresflagsMacro ); + return; + } + else if ( extension == ".spec" || extension == ".SPEC" ) + { + GenerateWinebuildCommands ( module, + sourceFilename ); + GenerateGccCommand ( module, + GetActualSourceFilename ( sourceFilename ), + cc, + cflagsMacro ); + return; + } + + throw InvalidOperationException ( __FILE__, + __LINE__, + "Unsupported filename extension '%s' in file '%s'", + extension.c_str (), + sourceFilename.c_str () ); +} + +void +MingwModuleHandler::GenerateLinkerCommand ( const Module& module, + const string& linker, + const string& linkerParameters, + const string& objectFilenames ) const +{ + string targetName ( module.GetTargetName () ); + string target ( FixupTargetFilename ( module.GetPath () ) ); + string importLibraryDependencies = GetImportLibraryDependencies ( module ); + if ( module.importLibrary != NULL ) + { + static string ros_junk ( "$(ROS_TEMPORARY)" ); + string base_tmp = ros_junk + module.name + ".base.tmp"; + string junk_tmp = ros_junk + module.name + ".junk.tmp"; + string temp_exp = ros_junk + module.name + ".temp.exp"; + + fprintf ( fMakefile, + "\t%s %s -Wl,--base-file,%s -o %s %s %s %s\n", + linker.c_str (), + linkerParameters.c_str (), + base_tmp.c_str (), + junk_tmp.c_str (), + objectFilenames.c_str (), + importLibraryDependencies.c_str (), + GetLinkerMacro ( module ).c_str () ); + + fprintf ( fMakefile, + "\t${rm} %s\n", + junk_tmp.c_str () ); + + string killAt = module.mangledSymbols ? "" : "--kill-at"; + fprintf ( fMakefile, + "\t${dlltool} --dllname %s --base-file %s --def %s --output-exp %s %s\n", + targetName.c_str (), + base_tmp.c_str (), + ( module.GetBasePath () + SSEP + module.importLibrary->definition ).c_str (), + temp_exp.c_str (), + killAt.c_str () ); + + fprintf ( fMakefile, + "\t${rm} %s\n", + base_tmp.c_str () ); + + fprintf ( fMakefile, + "\t%s %s %s -o %s %s %s %s\n\n", + linker.c_str (), + linkerParameters.c_str (), + temp_exp.c_str (), + target.c_str (), + objectFilenames.c_str (), + importLibraryDependencies.c_str (), + GetLinkerMacro ( module ).c_str () ); + + fprintf ( fMakefile, + "\t${rm} %s\n\n", + temp_exp.c_str () ); + } + else + { + fprintf ( fMakefile, + "\t%s %s -o %s %s %s %s\n\n", + linker.c_str (), + linkerParameters.c_str (), + target.c_str (), + objectFilenames.c_str (), + importLibraryDependencies.c_str (), + GetLinkerMacro ( module ).c_str () ); + } +} + +void +MingwModuleHandler::GenerateObjectFileTargets ( const Module& module, + const vector& files, + const vector& ifs, + const string& cc, + const string& cppc, + const string& cflagsMacro, + const string& nasmflagsMacro, + const string& windresflagsMacro ) const +{ + size_t i; + + for ( i = 0; i < files.size (); i++ ) + { + string sourceFilename = files[i]->name; + GenerateCommands ( module, + sourceFilename, + cc, + cppc, + cflagsMacro, + nasmflagsMacro, + windresflagsMacro ); + fprintf ( fMakefile, + "\n" ); + } + + for ( i = 0; i < ifs.size(); i++ ) + { + GenerateObjectFileTargets ( module, + ifs[i]->files, + ifs[i]->ifs, + cc, + cppc, + cflagsMacro, + nasmflagsMacro, + windresflagsMacro ); + } +} + +void +MingwModuleHandler::GenerateObjectFileTargets ( const Module& module, + const string& cc, + const string& cppc, + const string& cflagsMacro, + const string& nasmflagsMacro, + const string& windresflagsMacro ) const +{ + GenerateObjectFileTargets ( module, + module.files, + module.ifs, + cc, + cppc, + cflagsMacro, + nasmflagsMacro, + windresflagsMacro ); + fprintf ( fMakefile, "\n" ); +} + +void +MingwModuleHandler::GetCleanTargets ( vector& out, + const vector& files, + const vector& ifs ) const +{ + size_t i; + + for ( i = 0; i < files.size(); i++ ) + out.push_back ( PassThruCacheDirectory ( MingwModuleHandler::GetObjectFilename ( files[i]->name ) ) ); + + for ( i = 0; i < ifs.size(); i++ ) + GetCleanTargets ( out, ifs[i]->files, ifs[i]->ifs ); +} + +string +MingwModuleHandler::GenerateArchiveTarget ( const Module& module, + const string& ar, + const string& objs_macro ) const +{ + string archiveFilename = GetModuleArchiveFilename ( module ); + + fprintf ( fMakefile, + "%s: %s\n", + archiveFilename.c_str (), + objs_macro.c_str ()); + + fprintf ( fMakefile, + "\t%s -rc %s %s\n\n", + ar.c_str (), + archiveFilename.c_str (), + objs_macro.c_str ()); + + return archiveFilename; +} + +string +MingwModuleHandler::GetCFlagsMacro ( const Module& module ) const +{ + return ssprintf ( "$(%s_CFLAGS)", + module.name.c_str () ); +} + +string +MingwModuleHandler::GetObjectsMacro ( const Module& module ) const +{ + return ssprintf ( "$(%s_OBJS)", + module.name.c_str () ); +} + +string +MingwModuleHandler::GetLinkerMacro ( const Module& module ) const +{ + return ssprintf ( "$(%s_LFLAGS)", + module.name.c_str () ); +} + +void +MingwModuleHandler::GenerateMacrosAndTargets ( + const Module& module, + const string& cc, + const string& cppc, + const string& ar, + const string* cflags, + const string* nasmflags ) const +{ + string cflagsMacro = ssprintf ("%s_CFLAGS", module.name.c_str ()); + string nasmflagsMacro = ssprintf ("%s_NASMFLAGS", module.name.c_str ()); + string windresflagsMacro = ssprintf ("%s_RCFLAGS", module.name.c_str ()); + string linkerFlagsMacro = ssprintf ("%s_LFLAGS", module.name.c_str ()); + string objectsMacro = ssprintf ("%s_OBJS", module.name.c_str ()); + + GenerateMacros ( module, + cflagsMacro, + nasmflagsMacro, + windresflagsMacro, + linkerFlagsMacro, + objectsMacro ); + + if ( cflags != NULL ) + { + fprintf ( fMakefile, + "%s += %s\n\n", + cflagsMacro.c_str (), + cflags->c_str () ); + } + + if ( nasmflags != NULL ) + { + fprintf ( fMakefile, + "%s += %s\n\n", + nasmflagsMacro.c_str (), + nasmflags->c_str () ); + } + + // generate phony target for module name + fprintf ( fMakefile, ".PHONY: %s\n", + module.name.c_str () ); + fprintf ( fMakefile, "%s: %s\n\n", + module.name.c_str (), + FixupTargetFilename ( module.GetPath () ).c_str () ); + + // future references to the macros will be to get their values + cflagsMacro = ssprintf ("$(%s)", cflagsMacro.c_str ()); + nasmflagsMacro = ssprintf ("$(%s)", nasmflagsMacro.c_str ()); + objectsMacro = ssprintf ("$(%s)", objectsMacro.c_str ()); + + string ar_target = GenerateArchiveTarget ( module, ar, objectsMacro ); + GenerateObjectFileTargets ( module, + cc, + cppc, + cflagsMacro, + nasmflagsMacro, + windresflagsMacro ); + + vector clean_files; + clean_files.push_back ( FixupTargetFilename(module.GetPath()) ); + clean_files.push_back ( ar_target ); + GetCleanTargets ( clean_files, module.files, module.ifs ); + + fprintf ( fMakefile, ".PHONY: %s_clean\n", module.name.c_str() ); + fprintf ( fMakefile, "%s_clean:\n\t-@$(rm)", module.name.c_str() ); + for ( size_t i = 0; i < clean_files.size(); i++ ) + { + if ( 9==(i%10) ) + fprintf ( fMakefile, " 2>$(NUL)\n\t-@$(rm)" ); + fprintf ( fMakefile, " %s", clean_files[i].c_str() ); + } + fprintf ( fMakefile, " 2>$(NUL)\n" ); + fprintf ( fMakefile, "clean: %s_clean\n\n", module.name.c_str() ); +} + +void +MingwModuleHandler::GenerateMacrosAndTargetsHost ( const Module& module ) const +{ + GenerateMacrosAndTargets ( module, + "${host_gcc}", + "${host_gpp}", + "${host_ar}", + NULL, + NULL ); +} + +void +MingwModuleHandler::GenerateMacrosAndTargetsTarget ( const Module& module ) const +{ + GenerateMacrosAndTargetsTarget ( module, + NULL, + NULL ); +} + +void +MingwModuleHandler::GenerateMacrosAndTargetsTarget ( const Module& module, + const string* cflags, + const string* nasmflags ) const +{ + GenerateMacrosAndTargets ( module, + "${gcc}", + "${gpp}", + "${ar}", + cflags, + nasmflags ); +} + +string +MingwModuleHandler::GetInvocationDependencies ( const Module& module ) const +{ + string dependencies; + for ( size_t i = 0; i < module.invocations.size (); i++ ) + { + Invoke& invoke = *module.invocations[i]; + if (invoke.invokeModule == &module) + /* Protect against circular dependencies */ + continue; + if ( dependencies.length () > 0 ) + dependencies += " "; + dependencies += invoke.GetTargets (); + } + return dependencies; +} + +void +MingwModuleHandler::GenerateInvocations ( const Module& module ) const +{ + if ( module.invocations.size () == 0 ) + return; + + for ( size_t i = 0; i < module.invocations.size (); i++ ) + { + const Invoke& invoke = *module.invocations[i]; + + if ( invoke.invokeModule->type != BuildTool ) + { + throw InvalidBuildFileException ( module.node.location, + "Only modules of type buildtool can be invoked." ); + } + + string invokeTarget = module.GetInvocationTarget ( i ); + fprintf ( fMakefile, + ".PHONY: %s\n\n", + invokeTarget.c_str () ); + fprintf ( fMakefile, + "%s: %s\n\n", + invokeTarget.c_str (), + invoke.GetTargets ().c_str () ); + fprintf ( fMakefile, + "%s: %s\n", + invoke.GetTargets ().c_str (), + FixupTargetFilename ( invoke.invokeModule->GetPath () ).c_str () ); + fprintf ( fMakefile, + "\t%s %s\n\n", + FixupTargetFilename ( invoke.invokeModule->GetPath () ).c_str (), + invoke.GetParameters ().c_str () ); + } +} + +string +MingwModuleHandler::GetPreconditionDependenciesName ( const Module& module ) const +{ + return ssprintf ( "%s_precondition", + module.name.c_str () ); +} + +string +MingwModuleHandler::GetDefaultDependencies ( const Module& module ) const +{ + /* Avoid circular dependency */ + if ( module.type == BuildTool || module.name == "zlib" ) + return "$(ROS_INTERMEDIATE)." SSEP "tools $(ROS_INTERMEDIATE)." SSEP "lib" SSEP "zlib"; + else + return "init"; +} + +void +MingwModuleHandler::GeneratePreconditionDependencies ( const Module& module ) const +{ + string preconditionDependenciesName = GetPreconditionDependenciesName ( module ); + string sourceFilenames = GetSourceFilenamesWithoutGeneratedFiles ( module ); + string dependencies = GetDefaultDependencies ( module ); + string s = GetModuleDependencies ( module ); + if ( s.length () > 0 ) + { + if ( dependencies.length () > 0 ) + dependencies += " "; + dependencies += s; + } + + s = GetInvocationDependencies ( module ); + if ( s.length () > 0 ) + { + if ( dependencies.length () > 0 ) + dependencies += " "; + dependencies += s; + } + + fprintf ( fMakefile, + ".PHONY: %s\n\n", + preconditionDependenciesName.c_str () ); + fprintf ( fMakefile, + "%s: %s\n\n", + preconditionDependenciesName.c_str (), + dependencies.c_str () ); + const char* p = sourceFilenames.c_str(); + const char* end = p + strlen(p); + while ( p < end ) + { + const char* p2 = &p[512]; + if ( p2 > end ) + p2 = end; + while ( p2 > p && !isspace(*p2) ) + --p2; + if ( p == p2 ) + { + p2 = strpbrk ( p, " \t" ); + if ( !p2 ) + p2 = end; + } + fprintf ( fMakefile, + "%.*s: %s\n", + p2-p, + p, + preconditionDependenciesName.c_str ()); + p = p2; + p += strspn ( p, " \t" ); + } + fprintf ( fMakefile, "\n" ); +} + +void +MingwModuleHandler::GenerateImportLibraryTargetIfNeeded ( const Module& module ) const +{ + if ( module.importLibrary != NULL ) + { + string definitionDependencies = GetDefinitionDependencies ( module ); + fprintf ( fMakefile, "%s: %s\n", + FixupTargetFilename( module.GetDependencyPath () ).c_str (), + definitionDependencies.c_str () ); + + string killAt = module.mangledSymbols ? "" : "--kill-at"; + fprintf ( fMakefile, + "\t${dlltool} --dllname %s --def %s --output-lib %s %s\n\n", + module.GetTargetName ().c_str (), + ( module.GetBasePath () + SSEP + module.importLibrary->definition ).c_str (), + FixupTargetFilename ( module.GetDependencyPath () ).c_str (), + killAt.c_str () ); + } +} + +string +MingwModuleHandler::GetSpecObjectDependencies ( const string& filename ) const +{ + string basename = GetBasename ( filename ); + return basename + ".spec.def" + " " + basename + ".stubs.c"; +} + +string +MingwModuleHandler::GetDefinitionDependencies ( const Module& module ) const +{ + string dependencies; + string dkNkmLibNoFixup = "dk/nkm/lib"; + dependencies += FixupTargetFilename ( dkNkmLibNoFixup ); + PassThruCacheDirectory ( dkNkmLibNoFixup + SSEP ); + for ( size_t i = 0; i < module.files.size (); i++ ) + { + File& file = *module.files[i]; + string extension = GetExtension ( file.name ); + if ( extension == ".spec" || extension == ".SPEC" ) + { + if ( dependencies.length () > 0 ) + dependencies += " "; + dependencies += GetSpecObjectDependencies ( file.name ); + } + } + return dependencies; +} + +string +MingwModuleHandler::GetLinkingDependencies ( const Module& module ) const +{ + string dependencies = GetImportLibraryDependencies ( module ); + string s = GetDefinitionDependencies ( module ); + if ( s.length () > 0 ) + { + dependencies += " "; + dependencies += s; + } + return dependencies; +} + +bool +MingwModuleHandler::IsCPlusPlusModule ( const Module& module ) const +{ + if ( module.HasFileWithExtensions ( ".cc", ".CC" ) ) + return true; + if ( module.HasFileWithExtensions ( ".cxx", ".CXX" ) ) + return true; + if ( module.HasFileWithExtensions ( ".cpp", ".CPP" ) ) + return true; + return false; +} + + +static MingwBuildToolModuleHandler buildtool_handler; + +MingwBuildToolModuleHandler::MingwBuildToolModuleHandler() + : MingwModuleHandler ( BuildTool ) +{ +} + +void +MingwBuildToolModuleHandler::Process ( const Module& module ) +{ + GeneratePreconditionDependencies ( module ); + GenerateBuildToolModuleTarget ( module ); + GenerateInvocations ( module ); +} + +void +MingwBuildToolModuleHandler::GenerateBuildToolModuleTarget ( const Module& module ) +{ + string target ( FixupTargetFilename ( module.GetPath () ) ); + string archiveFilename = GetModuleArchiveFilename ( module ); + string importLibraryDependencies = GetImportLibraryDependencies ( module ); + + GenerateMacrosAndTargetsHost ( module ); + + string linker; + if ( IsCPlusPlusModule ( module ) ) + linker = "${host_gpp}"; + else + linker = "${host_gcc}"; + + fprintf ( fMakefile, "%s: %s %s\n", + target.c_str (), + archiveFilename.c_str (), + importLibraryDependencies.c_str () ); + fprintf ( fMakefile, + "\t%s %s -o %s %s %s\n\n", + linker.c_str (), + GetLinkerMacro ( module ).c_str (), + target.c_str (), + archiveFilename.c_str (), + importLibraryDependencies.c_str () ); +} + + +static MingwKernelModuleHandler kernelmodule_handler; + +MingwKernelModuleHandler::MingwKernelModuleHandler () + : MingwModuleHandler ( Kernel ) +{ +} + +void +MingwKernelModuleHandler::Process ( const Module& module ) +{ + GeneratePreconditionDependencies ( module ); + GenerateKernelModuleTarget ( module ); + GenerateInvocations ( module ); +} + +void +MingwKernelModuleHandler::GenerateKernelModuleTarget ( const Module& module ) +{ + static string ros_junk ( "$(ROS_TEMPORARY)" ); + string targetName ( module.GetTargetName () ); + string target ( FixupTargetFilename (module.GetPath ()) ); + string workingDirectory = GetWorkingDirectory (); + string objectsMacro = GetObjectsMacro ( module ); + string importLibraryDependencies = GetImportLibraryDependencies ( module ); + string base_tmp = ros_junk + module.name + ".base.tmp"; + string junk_tmp = ros_junk + module.name + ".junk.tmp"; + string temp_exp = ros_junk + module.name + ".temp.exp"; + string gccOptions = ssprintf ("-Wl,-T,%s" SSEP "ntoskrnl.lnk -Wl,--subsystem,native -Wl,--entry,%s -Wl,--image-base,%s -Wl,--file-alignment,0x1000 -Wl,--section-alignment,0x1000 -nostartfiles -mdll", + module.GetBasePath ().c_str (), + module.entrypoint.c_str (), + module.baseaddress.c_str () ); + + GenerateMacrosAndTargetsTarget ( module ); + + GenerateImportLibraryTargetIfNeeded ( module ); + + fprintf ( fMakefile, "%s: %s %s\n", + target.c_str (), + objectsMacro.c_str (), + importLibraryDependencies.c_str () ); + fprintf ( fMakefile, + "\t${gcc} %s %s -Wl,--base-file,%s -o %s %s %s\n", + GetLinkerMacro ( module ).c_str (), + gccOptions.c_str (), + base_tmp.c_str (), + junk_tmp.c_str (), + objectsMacro.c_str (), + importLibraryDependencies.c_str () ); + fprintf ( fMakefile, + "\t${rm} %s\n", + junk_tmp.c_str () ); + string killAt = module.mangledSymbols ? "" : "--kill-at"; + fprintf ( fMakefile, + "\t${dlltool} --dllname %s --base-file %s --def ntoskrnl/ntoskrnl.def --output-exp %s %s\n", + targetName.c_str (), + base_tmp.c_str (), + temp_exp.c_str (), + killAt.c_str () ); + fprintf ( fMakefile, + "\t${rm} %s\n", + base_tmp.c_str () ); + fprintf ( fMakefile, + "\t${gcc} %s %s -Wl,%s -o %s %s %s\n", + GetLinkerMacro ( module ).c_str (), + gccOptions.c_str (), + temp_exp.c_str (), + target.c_str (), + objectsMacro.c_str (), + importLibraryDependencies.c_str () ); + fprintf ( fMakefile, + "\t${rm} %s\n\n", + temp_exp.c_str () ); +} + + +static MingwStaticLibraryModuleHandler staticlibrary_handler; + +MingwStaticLibraryModuleHandler::MingwStaticLibraryModuleHandler () + : MingwModuleHandler ( StaticLibrary ) +{ +} + +void +MingwStaticLibraryModuleHandler::Process ( const Module& module ) +{ + GeneratePreconditionDependencies ( module ); + GenerateStaticLibraryModuleTarget ( module ); + GenerateInvocations ( module ); +} + +void +MingwStaticLibraryModuleHandler::GenerateStaticLibraryModuleTarget ( const Module& module ) +{ + GenerateMacrosAndTargetsTarget ( module ); +} + + +static MingwObjectLibraryModuleHandler objectlibrary_handler; + +MingwObjectLibraryModuleHandler::MingwObjectLibraryModuleHandler () + : MingwModuleHandler ( ObjectLibrary ) +{ +} + +void +MingwObjectLibraryModuleHandler::Process ( const Module& module ) +{ + GeneratePreconditionDependencies ( module ); + GenerateObjectLibraryModuleTarget ( module ); + GenerateInvocations ( module ); +} + +void +MingwObjectLibraryModuleHandler::GenerateObjectLibraryModuleTarget ( const Module& module ) +{ + GenerateMacrosAndTargetsTarget ( module ); +} + + +static MingwKernelModeDLLModuleHandler kernelmodedll_handler; + +MingwKernelModeDLLModuleHandler::MingwKernelModeDLLModuleHandler () + : MingwModuleHandler ( KernelModeDLL ) +{ +} + +void +MingwKernelModeDLLModuleHandler::Process ( const Module& module ) +{ + GeneratePreconditionDependencies ( module ); + GenerateKernelModeDLLModuleTarget ( module ); + GenerateInvocations ( module ); +} + +void +MingwKernelModeDLLModuleHandler::GenerateKernelModeDLLModuleTarget ( const Module& module ) +{ + static string ros_junk ( "$(ROS_TEMPORARY)" ); + string target ( FixupTargetFilename ( module.GetPath () ) ); + string workingDirectory = GetWorkingDirectory ( ); + string archiveFilename = GetModuleArchiveFilename ( module ); + string importLibraryDependencies = GetImportLibraryDependencies ( module ); + + GenerateImportLibraryTargetIfNeeded ( module ); + + if ( module.files.size () > 0 ) + { + GenerateMacrosAndTargetsTarget ( module ); + + fprintf ( fMakefile, "%s: %s %s\n", + target.c_str (), + archiveFilename.c_str (), + importLibraryDependencies.c_str () ); + + string linkerParameters = ssprintf ( "-Wl,--subsystem,native -Wl,--entry,%s -Wl,--image-base,%s -Wl,--file-alignment,0x1000 -Wl,--section-alignment,0x1000 -nostartfiles -mdll", + module.entrypoint.c_str (), + module.baseaddress.c_str () ); + GenerateLinkerCommand ( module, + "${gcc}", + linkerParameters, + archiveFilename ); + } + else + { + fprintf ( fMakefile, ".PHONY: %s\n\n", + target.c_str ()); + fprintf ( fMakefile, "%s:\n", + target.c_str ()); + } +} + + +static MingwKernelModeDriverModuleHandler kernelmodedriver_handler; + +MingwKernelModeDriverModuleHandler::MingwKernelModeDriverModuleHandler () + : MingwModuleHandler ( KernelModeDriver ) +{ +} + +void +MingwKernelModeDriverModuleHandler::Process ( const Module& module ) +{ + GeneratePreconditionDependencies ( module ); + GenerateKernelModeDriverModuleTarget ( module ); + GenerateInvocations ( module ); +} + + +void +MingwKernelModeDriverModuleHandler::GenerateKernelModeDriverModuleTarget ( const Module& module ) +{ + static string ros_junk ( "$(ROS_TEMPORARY)" ); + string target ( PassThruCacheDirectory( FixupTargetFilename ( module.GetPath () ) ) ); + string workingDirectory = GetWorkingDirectory ( ); + string archiveFilename = GetModuleArchiveFilename ( module ); + string importLibraryDependencies = GetImportLibraryDependencies ( module ); + + GenerateImportLibraryTargetIfNeeded ( module ); + + if ( module.files.size () > 0 ) + { + string* cflags = new string ( "-D__NTDRIVER__" ); + GenerateMacrosAndTargetsTarget ( module, + cflags, + NULL ); + delete cflags; + + fprintf ( fMakefile, "%s: %s %s\n", + target.c_str (), + archiveFilename.c_str (), + importLibraryDependencies.c_str () ); + + string linkerParameters = ssprintf ( "-Wl,--subsystem,native -Wl,--entry,%s -Wl,--image-base,%s -Wl,--file-alignment,0x1000 -Wl,--section-alignment,0x1000 -nostartfiles -mdll", + module.entrypoint.c_str (), + module.baseaddress.c_str () ); + GenerateLinkerCommand ( module, + "${gcc}", + linkerParameters, + archiveFilename ); + } + else + { + fprintf ( fMakefile, ".PHONY: %s\n\n", + target.c_str ()); + fprintf ( fMakefile, "%s:\n", + target.c_str () ); + } +} + + +static MingwNativeDLLModuleHandler nativedll_handler; + +MingwNativeDLLModuleHandler::MingwNativeDLLModuleHandler () + : MingwModuleHandler ( NativeDLL ) +{ +} + +void +MingwNativeDLLModuleHandler::Process ( const Module& module ) +{ + GeneratePreconditionDependencies ( module ); + GenerateNativeDLLModuleTarget ( module ); + GenerateInvocations ( module ); +} + +void +MingwNativeDLLModuleHandler::GenerateNativeDLLModuleTarget ( const Module& module ) +{ + static string ros_junk ( "$(ROS_TEMPORARY)" ); + string target ( FixupTargetFilename ( module.GetPath () ) ); + string workingDirectory = GetWorkingDirectory ( ); + string objectFilenames = GetObjectFilenames ( module ); + string archiveFilename = GetModuleArchiveFilename ( module ); + string importLibraryDependencies = GetImportLibraryDependencies ( module ); + + GenerateImportLibraryTargetIfNeeded ( module ); + + if ( module.files.size () > 0 ) + { + GenerateMacrosAndTargetsTarget ( module ); + + fprintf ( fMakefile, "%s: %s %s\n", + target.c_str (), + archiveFilename.c_str (), + importLibraryDependencies.c_str () ); + + string linkerParameters = ssprintf ( "-Wl,--subsystem,native -Wl,--entry,%s -Wl,--image-base,%s -Wl,--file-alignment,0x1000 -Wl,--section-alignment,0x1000 -nostartfiles -nostdlib -mdll", + module.entrypoint.c_str (), + module.baseaddress.c_str () ); + GenerateLinkerCommand ( module, + "${gcc}", + linkerParameters, + objectFilenames ); + } + else + { + fprintf ( fMakefile, ".PHONY: %s\n\n", + target.c_str ()); + fprintf ( fMakefile, "%s:\n\n", + target.c_str ()); + } +} + + +static MingwNativeCUIModuleHandler nativecui_handler; + +MingwNativeCUIModuleHandler::MingwNativeCUIModuleHandler () + : MingwModuleHandler ( NativeCUI ) +{ +} + +void +MingwNativeCUIModuleHandler::Process ( const Module& module ) +{ + GeneratePreconditionDependencies ( module ); + GenerateNativeCUIModuleTarget ( module ); + GenerateInvocations ( module ); +} + +void +MingwNativeCUIModuleHandler::GenerateNativeCUIModuleTarget ( const Module& module ) +{ + static string ros_junk ( "$(ROS_TEMPORARY)" ); + string target ( FixupTargetFilename ( module.GetPath () ) ); + string workingDirectory = GetWorkingDirectory ( ); + string objectFilenames = GetObjectFilenames ( module ); + string archiveFilename = GetModuleArchiveFilename ( module ); + string importLibraryDependencies = GetImportLibraryDependencies ( module ); + + GenerateImportLibraryTargetIfNeeded ( module ); + + if ( module.files.size () > 0 ) + { + string* cflags = new string ( "-D__NTAPP__" ); + GenerateMacrosAndTargetsTarget ( module, + cflags, + NULL ); + delete cflags; + + fprintf ( fMakefile, "%s: %s %s\n", + target.c_str (), + archiveFilename.c_str (), + importLibraryDependencies.c_str () ); + + string linkerParameters = ssprintf ( "-Wl,--subsystem,native -Wl,--entry,%s -Wl,--image-base,%s -Wl,--file-alignment,0x1000 -Wl,--section-alignment,0x1000 -nostartfiles -nostdlib", + module.entrypoint.c_str (), + module.baseaddress.c_str () ); + GenerateLinkerCommand ( module, + "${gcc}", + linkerParameters, + objectFilenames ); + } + else + { + fprintf ( fMakefile, ".PHONY: %s\n\n", + target.c_str ()); + fprintf ( fMakefile, "%s:\n\n", + target.c_str ()); + } +} + + +static MingwWin32DLLModuleHandler win32dll_handler; + +MingwWin32DLLModuleHandler::MingwWin32DLLModuleHandler () + : MingwModuleHandler ( Win32DLL ) +{ +} + +void +MingwWin32DLLModuleHandler::Process ( const Module& module ) +{ + GenerateExtractWineDLLResourcesTarget ( module ); + GeneratePreconditionDependencies ( module ); + GenerateWin32DLLModuleTarget ( module ); + GenerateInvocations ( module ); +} + +void +MingwWin32DLLModuleHandler::GenerateExtractWineDLLResourcesTarget ( const Module& module ) +{ + fprintf ( fMakefile, ".PHONY: %s_extractresources\n\n", + module.name.c_str () ); + fprintf ( fMakefile, "%s_extractresources: bin2res\n", + module.name.c_str () ); + for ( size_t i = 0; i < module.files.size (); i++ ) + { + File& file = *module.files[i]; + string extension = GetExtension ( file.name ); + if ( extension == ".rc" || extension == ".RC" ) + { + string resource = FixupTargetFilename ( file.name ); + fprintf ( fMakefile, "\t@echo ${bin2res} -f -x %s\n", + resource.c_str () ); + } + } + fprintf ( fMakefile, "\n"); +} + +void +MingwWin32DLLModuleHandler::GenerateWin32DLLModuleTarget ( const Module& module ) +{ + static string ros_junk ( "$(ROS_TEMPORARY)" ); + string target ( FixupTargetFilename ( module.GetPath () ) ); + string workingDirectory = GetWorkingDirectory ( ); + string objectFilenames = GetObjectFilenames ( module ); + string linkingDependencies = GetLinkingDependencies ( module ); + + GenerateImportLibraryTargetIfNeeded ( module ); + if ( module.files.size () > 0 ) + { + GenerateMacrosAndTargetsTarget ( module ); + + fprintf ( fMakefile, "%s: %s %s\n", + target.c_str (), + objectFilenames.c_str (), + linkingDependencies.c_str () ); + + string linker; + if ( IsCPlusPlusModule ( module ) ) + linker = "${gpp}"; + else + linker = "${gcc}"; + + string linkerParameters = ssprintf ( "-Wl,--subsystem,console -Wl,--entry,%s -Wl,--image-base,%s -Wl,--file-alignment,0x1000 -Wl,--section-alignment,0x1000 -mdll", + module.entrypoint.c_str (), + module.baseaddress.c_str () ); + GenerateLinkerCommand ( module, + linker, + linkerParameters, + objectFilenames ); + } + else + { + fprintf ( fMakefile, ".PHONY: %s\n\n", + target.c_str () ); + fprintf ( fMakefile, "%s:\n\n", + target.c_str () ); + } +} + + +static MingwWin32CUIModuleHandler win32cui_handler; + +MingwWin32CUIModuleHandler::MingwWin32CUIModuleHandler () + : MingwModuleHandler ( Win32CUI ) +{ +} + +void +MingwWin32CUIModuleHandler::Process ( const Module& module ) +{ + GeneratePreconditionDependencies ( module ); + GenerateWin32CUIModuleTarget ( module ); + GenerateInvocations ( module ); +} + +void +MingwWin32CUIModuleHandler::GenerateWin32CUIModuleTarget ( const Module& module ) +{ + static string ros_junk ( "$(ROS_TEMPORARY)" ); + string target ( FixupTargetFilename ( module.GetPath () ) ); + string workingDirectory = GetWorkingDirectory ( ); + string objectFilenames = GetObjectFilenames ( module ); + string importLibraryDependencies = GetImportLibraryDependencies ( module ); + + GenerateImportLibraryTargetIfNeeded ( module ); + + if ( module.files.size () > 0 ) + { + GenerateMacrosAndTargetsTarget ( module ); + + fprintf ( fMakefile, "%s: %s %s\n", + target.c_str (), + objectFilenames.c_str (), + importLibraryDependencies.c_str () ); + + string linker; + if ( IsCPlusPlusModule ( module ) ) + linker = "${gpp}"; + else + linker = "${gcc}"; + + string linkerParameters = ssprintf ( "-Wl,--subsystem,console -Wl,--entry,%s -Wl,--image-base,%s -Wl,--file-alignment,0x1000 -Wl,--section-alignment,0x1000", + module.entrypoint.c_str (), + module.baseaddress.c_str () ); + GenerateLinkerCommand ( module, + linker, + linkerParameters, + objectFilenames ); + } + else + { + fprintf ( fMakefile, ".PHONY: %s\n\n", + target.c_str ()); + fprintf ( fMakefile, "%s:\n\n", + target.c_str ()); + } +} + + +static MingwWin32GUIModuleHandler win32gui_handler; + +MingwWin32GUIModuleHandler::MingwWin32GUIModuleHandler () + : MingwModuleHandler ( Win32GUI ) +{ +} + +void +MingwWin32GUIModuleHandler::Process ( const Module& module ) +{ + GeneratePreconditionDependencies ( module ); + GenerateWin32GUIModuleTarget ( module ); + GenerateInvocations ( module ); +} + +void +MingwWin32GUIModuleHandler::GenerateWin32GUIModuleTarget ( const Module& module ) +{ + static string ros_junk ( "$(ROS_TEMPORARY)" ); + string target ( FixupTargetFilename ( module.GetPath () ) ); + string workingDirectory = GetWorkingDirectory ( ); + string objectFilenames = GetObjectFilenames ( module ); + string importLibraryDependencies = GetImportLibraryDependencies ( module ); + + GenerateImportLibraryTargetIfNeeded ( module ); + + if ( module.files.size () > 0 ) + { + GenerateMacrosAndTargetsTarget ( module ); + + fprintf ( fMakefile, "%s: %s %s\n", + target.c_str (), + objectFilenames.c_str (), + importLibraryDependencies.c_str () ); + + string linker; + if ( IsCPlusPlusModule ( module ) ) + linker = "${gpp}"; + else + linker = "${gcc}"; + + string linkerParameters = ssprintf ( "-Wl,--subsystem,windows -Wl,--entry,%s -Wl,--image-base,%s -Wl,--file-alignment,0x1000 -Wl,--section-alignment,0x1000", + module.entrypoint.c_str (), + module.baseaddress.c_str () ); + GenerateLinkerCommand ( module, + linker, + linkerParameters, + objectFilenames ); + } + else + { + fprintf ( fMakefile, ".PHONY: %s\n\n", + target.c_str ()); + fprintf ( fMakefile, "%s:\n\n", + target.c_str ()); + } +} + + +static MingwBootLoaderModuleHandler bootloadermodule_handler; + +MingwBootLoaderModuleHandler::MingwBootLoaderModuleHandler () + : MingwModuleHandler ( BootLoader ) +{ +} + +void +MingwBootLoaderModuleHandler::Process ( const Module& module ) +{ + GeneratePreconditionDependencies ( module ); + GenerateBootLoaderModuleTarget ( module ); + GenerateInvocations ( module ); +} + +void +MingwBootLoaderModuleHandler::GenerateBootLoaderModuleTarget ( const Module& module ) +{ + static string ros_junk ( "$(ROS_TEMPORARY)" ); + string targetName ( module.GetTargetName () ); + string target ( FixupTargetFilename ( module.GetPath () ) ); + string workingDirectory = GetWorkingDirectory (); + string junk_tmp = ros_junk + module.name + ".junk.tmp"; + string objectsMacro = GetObjectsMacro ( module ); + string importLibraryDependencies = GetImportLibraryDependencies ( module ); + + GenerateMacrosAndTargetsTarget ( module ); + + fprintf ( fMakefile, "%s: %s %s\n", + target.c_str (), + objectsMacro.c_str (), + importLibraryDependencies.c_str () ); + + fprintf ( fMakefile, + "\t${ld} %s -N -Ttext=0x8000 -o %s %s %s\n", + GetLinkerMacro ( module ).c_str (), + junk_tmp.c_str (), + objectsMacro.c_str (), + importLibraryDependencies.c_str () ); + fprintf ( fMakefile, + "\t${objcopy} -O binary %s %s\n", + junk_tmp.c_str (), + target.c_str () ); + fprintf ( fMakefile, + "\t${rm} %s\n", + junk_tmp.c_str () ); +} + + +static MingwBootSectorModuleHandler bootsectormodule_handler; + +MingwBootSectorModuleHandler::MingwBootSectorModuleHandler () + : MingwModuleHandler ( BootSector ) +{ +} + +void +MingwBootSectorModuleHandler::Process ( const Module& module ) +{ + GeneratePreconditionDependencies ( module ); + GenerateBootSectorModuleTarget ( module ); + GenerateInvocations ( module ); +} + +void +MingwBootSectorModuleHandler::GenerateBootSectorModuleTarget ( const Module& module ) +{ + string objectsMacro = GetObjectsMacro ( module ); + + string* nasmflags = new string ( "-f bin" ); + GenerateMacrosAndTargetsTarget ( module, + NULL, + nasmflags); + + fprintf ( fMakefile, ".PHONY: %s\n\n", + module.name.c_str ()); + fprintf ( fMakefile, + "%s: %s\n", + module.name.c_str (), + objectsMacro.c_str () ); +} + + +static MingwIsoModuleHandler isomodule_handler; + +MingwIsoModuleHandler::MingwIsoModuleHandler () + : MingwModuleHandler ( Iso ) +{ +} + +void +MingwIsoModuleHandler::Process ( const Module& module ) +{ + GeneratePreconditionDependencies ( module ); + GenerateIsoModuleTarget ( module ); + GenerateInvocations ( module ); +} + +void +MingwIsoModuleHandler::OutputBootstrapfileCopyCommands ( const string bootcdDirectory, + const Module& module ) const +{ + for ( size_t i = 0; i < module.project.modules.size (); i++ ) + { + const Module& m = *module.project.modules[i]; + if ( m.bootstrap != NULL ) + { + string targetFilenameNoFixup = bootcdDirectory + SSEP + m.bootstrap->base + SSEP + m.bootstrap->nameoncd; + string targetFilename = PassThruCacheDirectory ( FixupTargetFilename ( targetFilenameNoFixup ) ); + fprintf ( fMakefile, + "\t${cp} %s %s\n", + m.GetPath ().c_str (), + targetFilename.c_str () ); + } + } +} + +void +MingwIsoModuleHandler::OutputCdfileCopyCommands ( const string bootcdDirectory, + const Module& module ) const +{ + for ( size_t i = 0; i < module.project.cdfiles.size (); i++ ) + { + const CDFile& cdfile = *module.project.cdfiles[i]; + string targetFilenameNoFixup = bootcdDirectory + SSEP + cdfile.base + SSEP + cdfile.nameoncd; + string targetFilename = PassThruCacheDirectory ( FixupTargetFilename ( targetFilenameNoFixup ) ); + fprintf ( fMakefile, + "\t${cp} %s %s\n", + cdfile.GetPath ().c_str (), + targetFilename.c_str () ); + } +} + +string +MingwIsoModuleHandler::GetBootstrapCdDirectories ( const string bootcdDirectory, + const Module& module ) const +{ + string directories; + for ( size_t i = 0; i < module.project.modules.size (); i++ ) + { + const Module& m = *module.project.modules[i]; + if ( m.bootstrap != NULL ) + { + string targetDirecctory = bootcdDirectory + SSEP + m.bootstrap->base; + if ( directories.size () > 0 ) + directories += " "; + directories += FixupTargetFilename ( targetDirecctory ); + } + } + return directories; +} + +string +MingwIsoModuleHandler::GetNonModuleCdDirectories ( const string bootcdDirectory, + const Module& module ) const +{ + string directories; + for ( size_t i = 0; i < module.project.cdfiles.size (); i++ ) + { + const CDFile& cdfile = *module.project.cdfiles[i]; + string targetDirecctory = bootcdDirectory + SSEP + cdfile.base; + if ( directories.size () > 0 ) + directories += " "; + directories += FixupTargetFilename ( targetDirecctory ); + } + return directories; +} + +string +MingwIsoModuleHandler::GetCdDirectories ( const string bootcdDirectory, + const Module& module ) const +{ + string directories = GetBootstrapCdDirectories ( bootcdDirectory, + module ); + directories += " " + GetNonModuleCdDirectories ( bootcdDirectory, + module ); + return directories; +} + +string +MingwIsoModuleHandler::GetBootstrapCdFiles ( const string bootcdDirectory, + const Module& module ) const +{ + string cdfiles; + for ( size_t i = 0; i < module.project.modules.size (); i++ ) + { + const Module& m = *module.project.modules[i]; + if ( m.bootstrap != NULL ) + { + if ( cdfiles.size () > 0 ) + cdfiles += " "; + cdfiles += FixupTargetFilename ( m.GetPath () ); + } + } + return cdfiles; +} + +string +MingwIsoModuleHandler::GetNonModuleCdFiles ( const string bootcdDirectory, + const Module& module ) const +{ + string cdfiles; + for ( size_t i = 0; i < module.project.cdfiles.size (); i++ ) + { + const CDFile& cdfile = *module.project.cdfiles[i]; + if ( cdfiles.size () > 0 ) + cdfiles += " "; + cdfiles += NormalizeFilename ( cdfile.GetPath () ); + } + return cdfiles; +} + +string +MingwIsoModuleHandler::GetCdFiles ( const string bootcdDirectory, + const Module& module ) const +{ + string cdfiles = GetBootstrapCdFiles ( bootcdDirectory, + module ); + cdfiles += " " + GetNonModuleCdFiles ( bootcdDirectory, + module ); + return cdfiles; +} + +void +MingwIsoModuleHandler::GenerateIsoModuleTarget ( const Module& module ) +{ + string bootcdDirectory = "cd"; + string isoboot = FixupTargetFilename ( "boot/freeldr/bootsect/isoboot.o" ); + string bootcdReactosNoFixup = bootcdDirectory + "/reactos"; + string bootcdReactos = FixupTargetFilename ( bootcdReactosNoFixup ); + PassThruCacheDirectory ( bootcdReactos + SSEP ); + string reactosInf = FixupTargetFilename ( bootcdReactosNoFixup + "/reactos.inf" ); + string reactosDff = NormalizeFilename ( "bootdata/packages/reactos.dff" ); + string cdDirectories = bootcdReactos + " " + GetCdDirectories ( bootcdDirectory, + module ); + string cdFiles = GetCdFiles ( bootcdDirectory, + module ); + + fprintf ( fMakefile, ".PHONY: %s\n\n", + module.name.c_str ()); + fprintf ( fMakefile, + "%s: all %s %s %s\n", + module.name.c_str (), + isoboot.c_str (), + cdDirectories.c_str (), + cdFiles.c_str () ); + fprintf ( fMakefile, + "\t${cabman} -C %s -L %s -I\n", + reactosDff.c_str (), + bootcdReactos.c_str () ); + fprintf ( fMakefile, + "\t${cabman} -C %s -RC %s -L %s -N\n", + reactosDff.c_str (), + reactosInf.c_str (), + bootcdReactos.c_str () ); + fprintf ( fMakefile, + "\t- ${rm} %s\n", + reactosInf.c_str () ); + OutputBootstrapfileCopyCommands ( bootcdDirectory, + module ); + OutputCdfileCopyCommands ( bootcdDirectory, + module ); + fprintf ( fMakefile, + "\t${cdmake} -v -m -b %s %s REACTOS ReactOS.iso\n", + isoboot.c_str (), + bootcdDirectory.c_str () ); + fprintf ( fMakefile, + "\n" ); +} diff --cc reactos/tools/unicode/Makefile index 00000000000,a5d9fd921e2..51977c401c2 mode 000000,100644..100644 --- a/reactos/tools/unicode/Makefile +++ b/reactos/tools/unicode/Makefile @@@ -1,0 -1,87 +1,95 @@@ -PATH_TO_TOP = ../.. ++UNICODE_BASE = tools$(SEP)unicode + -include $(PATH_TO_TOP)/config ++UNICODE_TARGET = \ ++ $(ROS_INTERMEDIATE)$(UNICODE_BASE)$(SEP)libunicode.a + -TARGET_TYPE = host_library - -TARGET_NAME = unicode - -TARGET_CFLAGS = -D__USE_W32API -DWINVER=0x501 -DWINE_UNICODE_API= \ - -Dwchar_t="unsigned short" -D_WCHAR_T_DEFINED \ - -I$(PATH_TO_TOP)/include/wine - -CODEPAGES = \ ++UNICODE_CODEPAGES = \ + 037 \ + 424 \ + 437 \ + 500 \ + 737 \ + 775 \ + 850 \ + 852 \ + 855 \ + 856 \ + 857 \ + 860 \ + 861 \ + 862 \ + 863 \ + 864 \ + 865 \ + 866 \ + 869 \ + 874 \ + 875 \ + 878 \ + 932 \ + 936 \ + 949 \ + 950 \ + 1006 \ + 1026 \ + 1250 \ + 1251 \ + 1252 \ + 1253 \ + 1254 \ + 1255 \ + 1256 \ + 1257 \ + 1258 \ + 10000 \ + 10006 \ + 10007 \ + 10029 \ + 10079 \ + 10081 \ + 20866 \ + 20932 \ + 21866 \ + 28591 \ + 28592 \ + 28593 \ + 28594 \ + 28595 \ + 28596 \ + 28597 \ + 28598 \ + 28599 \ + 28600 \ + 28603 \ + 28604 \ + 28605 \ + 28606 + -TARGET_OBJECTS = \ - casemap.o \ - compose.o \ - cptable.o \ - mbtowc.o \ - string.o \ - wctomb.o \ - wctype.o \ - $(CODEPAGES:%=c_%.o) ++UNICODE_SOURCES = \ ++ $(UNICODE_BASE)$(SEP)casemap.c \ ++ $(UNICODE_BASE)$(SEP)compose.c \ ++ $(UNICODE_BASE)$(SEP)cptable.c \ ++ $(UNICODE_BASE)$(SEP)mbtowc.c \ ++ $(UNICODE_BASE)$(SEP)string.c \ ++ $(UNICODE_BASE)$(SEP)wctomb.c \ ++ $(UNICODE_BASE)$(SEP)wctype.c \ ++ $(addprefix $(UNICODE_BASE)$(SEP), $(UNICODE_CODEPAGES:%=c_%.o)) ++ ++UNICODE_OBJECTS = \ ++ $(UNICODE_SOURCES:.c=.o) ++ ++UNICODE_HOST_CFLAGS = \ ++ -D__USE_W32API -DWINVER=0x501 -DWINE_UNICODE_API= \ ++ -Dwchar_t="unsigned short" -D_WCHAR_T_DEFINED \ ++ -I$(UNICODE_BASE) -Iinclude/wine ++ ++$(UNICODE_TARGET): $(UNICODE_OBJECTS) ++ ${host_ar} -rc $(UNICODE_TARGET) $(UNICODE_OBJECTS) + -include $(PATH_TO_TOP)/rules.mak ++$(UNICODE_OBJECTS): %.o : %.c ++ ${host_gcc} $(UNICODE_HOST_CFLAGS) -c $< -o $@ + -include $(TOOLS_PATH)/helper.mk ++.PHONY: unicode_clean ++unicode_clean: ++ -@$(rm) $(UNICODE_TARGET) $(UNICODE_OBJECTS) 2>$(NUL) ++clean: unicode_clean diff --cc reactos/tools/wpp/Makefile index 00000000000,32288175b14..60cdb598585 mode 000000,100644..100644 --- a/reactos/tools/wpp/Makefile +++ b/reactos/tools/wpp/Makefile @@@ -1,0 -1,33 +1,26 @@@ -PATH_TO_TOP = ../.. ++WPP_BASE = tools$(SEP)wpp + -include $(PATH_TO_TOP)/config ++WPP_TARGET = \ ++ $(ROS_INTERMEDIATE)$(WPP_BASE)$(SEP)libwpp.a + -TARGET_TYPE = host_library ++WPP_SOURCES = \ ++ $(WPP_BASE)$(SEP)lex.yy.c \ ++ $(WPP_BASE)$(SEP)preproc.c \ ++ $(WPP_BASE)$(SEP)wpp.c \ ++ $(WPP_BASE)$(SEP)wpp.tab.c + -TARGET_NAME = wpp ++WPP_OBJECTS = \ ++ $(WPP_SOURCES:.c=.o) + -TARGET_CFLAGS = -D__USE_W32API -I$(PATH_TO_TOP)/include/wine ++WPP_HOST_CFLAGS = -D__USE_W32API -I$(WPP_BASE) -Iinclude -Iinclude/wine -g + -TARGET_OBJECTS = preproc.o wpp.o wpp.tab.o lex.yy.o ++$(WPP_TARGET): $(WPP_OBJECTS) ++ ${host_ar} -rc $(WPP_TARGET) $(WPP_OBJECTS) + -#DEP_OBJECTS = $(TARGET_OBJECTS) ++$(WPP_OBJECTS): %.o : %.c ++ ${host_gcc} $(WPP_HOST_CFLAGS) -c $< -o $@ + -include $(PATH_TO_TOP)/rules.mak - -include $(TOOLS_PATH)/helper.mk - -#include $(TOOLS_PATH)/depend.mk - -LEXOPT = -Cf #-w -b -YACCOPT = #-v -# -# Optional use of bison, this will allow independent building from -# Wine. -# -#y.tab.c y.tab.h: ppl.l -# bison $(YACCOPT) -ppp -d -t ppy.y -o wpp.tab.c -# -#lex.yy.c: ppl.l -# flex $(LEXOPT) -d -8 -Ppp -olex.yy.c ppl.l - -# EOF ++.PHONY: wpp_clean ++wpp_clean: ++ -@$(rm) $(WPP_TARGET) $(WPP_OBJECTS) 2>$(NUL) ++clean: wpp_clean diff --cc reactos/tools/wrc/Makefile index 00000000000,db39b91d2d7..333bef9f0fa mode 000000,100644..100644 --- a/reactos/tools/wrc/Makefile +++ b/reactos/tools/wrc/Makefile @@@ -1,0 -1,72 +1,39 @@@ -# -# wrc -# -PATH_TO_TOP = ../.. - -LIB_WPP_DIR = ../wpp -LIB_UNICODE_DIR = ../unicode - -include $(PATH_TO_TOP)/rules.mak - -TARGET = wrc$(EXE_POSTFIX) - -all: $(TARGET) - -BASE_OBJECTS = \ - dumpres.o \ - genres.o \ - newstruc.o \ - readres.o \ - translation.o \ - utils.o \ - wrc.o \ - writeres.o \ - y.tab.o \ - lex.yy.o - -PORT_OBJECTS = \ - port/mkstemps.o - -OBJECTS = $(BASE_OBJECTS) $(PORT_OBJECTS) - -LIBS = $(LIB_UNICODE_DIR)/libunicode.a $(LIB_WPP_DIR)/libwpp.a - -CLEAN_FILES = *.o $(TARGET) - -HOST_CFLAGS = -D__USE_W32API -DWINE_UNICODE_API= \ - -Dwchar_t="unsigned short" -D_WCHAR_T_DEFINED \ - -I$(LIB_UNICODE_DIR) -I$(LIB_WPP_DIR) -I$(PATH_TO_TOP)/include/wine \ - -I$(PATH_TO_TOP)/include -I$(PATH_TO_TOP)/w32api/include - -%.o: %.c - $(HOST_CC) $(HOST_CFLAGS) -c $< -o $@ - -$(TARGET): $(OBJECTS) $(LIBS) - $(HOST_CC) -o $(TARGET) $(OBJECTS) $(LIBS) - -ifeq ($(HOST),mingw32-linux) -clean: - -rm -f $(OBJECTS) $(TARGET) -endif -ifneq ($(HOST),mingw32-linux) -clean: - -del $(TARGET) - -del *.o - -del port\*.o -endif - -.PHONY: clean - -LEXOPT = -Cf #-w -b -YACCOPT = #-v -# -# Optional use of bison, this will allow independent building from -# Wine. -# -#y.tab.c y.tab.h: parser.y -# bison $(YACCOPT) -d -t parser.y -o y.tab.c -# -#lex.yy.c: parser.l -# flex $(LEXOPT) -d -8 parser.l - -# EOF ++WRC_BASE = tools$(SEP)wrc ++ ++WRC_TARGET = \ ++ $(ROS_INTERMEDIATE)$(WRC_BASE)$(SEP)wrc$(EXEPOSTFIX) ++ ++WRC_SOURCES = \ ++ $(WRC_BASE)$(SEP)dumpres.c \ ++ $(WRC_BASE)$(SEP)genres.c \ ++ $(WRC_BASE)$(SEP)newstruc.c \ ++ $(WRC_BASE)$(SEP)readres.c \ ++ $(WRC_BASE)$(SEP)translation.c \ ++ $(WRC_BASE)$(SEP)utils.c \ ++ $(WRC_BASE)$(SEP)wrc.c \ ++ $(WRC_BASE)$(SEP)writeres.c \ ++ $(WRC_BASE)$(SEP)y.tab.c \ ++ $(WRC_BASE)$(SEP)lex.yy.c \ ++ $(WRC_BASE)$(SEP)port$(SEP)mkstemps.o ++ ++WRC_OBJECTS = \ ++ $(WRC_SOURCES:.c=.o) ++ ++WRC_HOST_CFLAGS = -I$(WRC_BASE) -g -Werror -Wall \ ++ -D__USE_W32API -DWINE_UNICODE_API= \ ++ -Dwchar_t="unsigned short" -D_WCHAR_T_DEFINED \ ++ -I$(UNICODE_BASE) -I$(WPP_BASE) -I$(WRC_BASE) \ ++ -Iinclude/wine -Iinclude -Iw32api/include ++ ++WRC_HOST_LFLAGS = -g ++ ++$(WRC_TARGET): $(WRC_OBJECTS) $(UNICODE_TARGET) $(WPP_TARGET) ++ ${host_gcc} $(WRC_OBJECTS) $(UNICODE_TARGET) $(WPP_TARGET) $(WRC_HOST_LFLAGS) -o $(WRC_TARGET) ++ ++$(WRC_OBJECTS): %.o : %.c ++ ${host_gcc} $(WRC_HOST_CFLAGS) -c $< -o $@ ++ ++.PHONY: wrc_clean ++wrc_clean: ++ -@$(rm) $(WRC_TARGET) $(WRC_OBJECTS) 2>$(NUL) ++clean: wrc_clean diff --cc reactos/tools/wrc/parser.y index 00000000000,ab11dcdb8e4..f9d3da8b655 mode 000000,100644..100644 --- a/reactos/tools/wrc/parser.y +++ b/reactos/tools/wrc/parser.y @@@ -1,0 -1,3027 +1,3032 @@@ + %{ + /* + * Copyright 1994 Martin von Loewis + * Copyright 1998-2000 Bertho A. Stultiens (BS) + * 1999 Juergen Schmied (JS) + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * History: + * 24-Jul-2000 BS - Made a fix for broken Berkeley yacc on + * non-terminals (see cjunk rule). + * 21-May-2000 BS - Partial implementation of font resources. + * - Corrected language propagation for binary + * resources such as bitmaps, icons, cursors, + * userres and rcdata. The language is now + * correct in .res files. + * - Fixed reading the resource name as ident, + * so that it may overlap keywords. + * 20-May-2000 BS - Implemented animated cursors and icons + * resource types. + * 30-Apr-2000 BS - Reintegration into the wine-tree + * 14-Jan-2000 BS - Redid the usertype resources so that they + * are compatible. + * 02-Jan-2000 BS - Removed the preprocessor from the grammar + * except for the # command (line numbers). + * + * 06-Nov-1999 JS - see CHANGES + * + * 29-Dec-1998 AdH - Grammar and function extensions. + * grammar: TOOLBAR resources, Named ICONs in + * DIALOGS + * functions: semantic actions for the grammar + * changes, resource files can now be anywhere + * on the include path instead of just in the + * current directory + * + * 20-Jun-1998 BS - Fixed a bug in load_file() where the name was not + * printed out correctly. + * + * 17-Jun-1998 BS - Fixed a bug in CLASS statement parsing which should + * also accept a tSTRING as argument. + * + * 25-May-1998 BS - Found out that I need to support language, version + * and characteristics in inline resources (bitmap, + * cursor, etc) but they can also be specified with + * a filename. This renders my filename-scanning scheme + * worthless. Need to build newline parsing to solve + * this one. + * It will come with version 1.1.0 (sigh). + * + * 19-May-1998 BS - Started to build a builtin preprocessor + * + * 30-Apr-1998 BS - Redid the stringtable parsing/handling. My previous + * ideas had some serious flaws. + * + * 27-Apr-1998 BS - Removed a lot of dead comments and put it in a doc + * file. + * + * 21-Apr-1998 BS - Added correct behavior for cursors and icons. + * - This file is growing too big. It is time to strip + * things and put it in a support file. + * + * 19-Apr-1998 BS - Tagged the stringtable resource so that only one + * resource will be created. This because the table + * has a different layout than other resources. The + * table has to be sorted, and divided into smaller + * resource entries (see comment in source). + * + * 17-Apr-1998 BS - Almost all strings, including identifiers, are parsed + * as string_t which include unicode strings upon + * input. + * - Parser now emits a warning when compiling win32 + * extensions in win16 mode. + * + * 16-Apr-1998 BS - Raw data elements are now *optionally* separated + * by commas. Read the comments in file sq2dq.l. + * - FIXME: there are instances in the source that rely + * on the fact that int==32bit and pointers are int size. + * - Fixed the conflict in menuex by changing a rule + * back into right recursion. See note in source. + * - UserType resources cannot have an expression as its + * typeclass. See note in source. + * + * 15-Apr-1998 BS - Changed all right recursion into left recursion to + * get reduction of the parsestack. + * This also helps communication between bison and flex. + * Main advantage is that the Empty rule gets reduced + * first, which is used to allocate/link things. + * It also added a shift/reduce conflict in the menuex + * handling, due to expression/option possibility, + * although not serious. + * + * 14-Apr-1998 BS - Redone almost the entire parser. We're not talking + * about making it more efficient, but readable (for me) + * and slightly easier to expand/change. + * This is done primarily by using more reduce states + * with many (intuitive) types for the various resource + * statements. + * - Added expression handling for all resources where a + * number is accepted (not only for win32). Also added + * multiply and division (not MS compatible, but handy). + * Unary minus introduced a shift/reduce conflict, but + * it is not serious. + * + * 13-Apr-1998 BS - Reordered a lot of things + * - Made the source more readable + * - Added Win32 resource definitions + * - Corrected syntax problems with an old yacc (;) + * - Added extra comment about grammar + */ + #include "config.h" + + #include + #include + #include + #include + #include + #include + #ifdef HAVE_ALLOCA_H + #include + #endif + + #include "wrc.h" + #include "utils.h" + #include "newstruc.h" + #include "dumpres.h" + #include "wine/wpp.h" + #include "wine/unicode.h" + #include "parser.h" + #include "windef.h" + #include "winbase.h" + #include "wingdi.h" + #include "winuser.h" + + #if defined(YYBYACC) + /* Berkeley yacc (byacc) doesn't seem to know about these */ + /* Some *BSD supplied versions do define these though */ + # ifndef YYEMPTY + # define YYEMPTY (-1) /* Empty lookahead value of yychar */ + # endif + # ifndef YYLEX + # define YYLEX yylex() + # endif + + #elif defined(YYBISON) + /* Bison was used for original development */ + /* #define YYEMPTY -2 */ + /* #define YYLEX yylex() */ + + #else + /* No yacc we know yet */ + # if !defined(YYEMPTY) || !defined(YYLEX) + # error Yacc version/type unknown. This version needs to be verified for settings of YYEMPTY and YYLEX. + # elif defined(__GNUC__) /* gcc defines the #warning directive */ + # warning Yacc version/type unknown. It defines YYEMPTY and YYLEX, but is not tested + /* #else we just take a chance that it works... */ + # endif + #endif + + int want_nl = 0; /* Signal flex that we need the next newline */ + int want_id = 0; /* Signal flex that we need the next identifier */ + stringtable_t *tagstt; /* Stringtable tag. + * It is set while parsing a stringtable to one of + * the stringtables in the sttres list or a new one + * if the language was not parsed before. + */ + stringtable_t *sttres; /* Stringtable resources. This holds the list of + * stringtables with different lanuages + */ + static int dont_want_id = 0; /* See language parsing for details */ + + /* Set to the current options of the currently scanning stringtable */ + static int *tagstt_memopt; + static characts_t *tagstt_characts; + static version_t *tagstt_version; + + static const char riff[4] = "RIFF"; /* RIFF file magic for animated cursor/icon */ + + /* Prototypes of here defined functions */ + static event_t *get_event_head(event_t *p); + static control_t *get_control_head(control_t *p); + static ver_value_t *get_ver_value_head(ver_value_t *p); + static ver_block_t *get_ver_block_head(ver_block_t *p); + static resource_t *get_resource_head(resource_t *p); + static menuex_item_t *get_itemex_head(menuex_item_t *p); + static menu_item_t *get_item_head(menu_item_t *p); + static raw_data_t *merge_raw_data_str(raw_data_t *r1, string_t *str); + static raw_data_t *merge_raw_data_int(raw_data_t *r1, int i); + static raw_data_t *merge_raw_data_long(raw_data_t *r1, int i); + static raw_data_t *merge_raw_data(raw_data_t *r1, raw_data_t *r2); + static raw_data_t *str2raw_data(string_t *str); + static raw_data_t *int2raw_data(int i); + static raw_data_t *long2raw_data(int i); + static raw_data_t *load_file(string_t *name, language_t *lang); + static itemex_opt_t *new_itemex_opt(int id, int type, int state, int helpid); + static event_t *add_string_event(string_t *key, int id, int flags, event_t *prev); + static event_t *add_event(int key, int id, int flags, event_t *prev); + static dialogex_t *dialogex_version(version_t *v, dialogex_t *dlg); + static dialogex_t *dialogex_characteristics(characts_t *c, dialogex_t *dlg); + static dialogex_t *dialogex_language(language_t *l, dialogex_t *dlg); + static dialogex_t *dialogex_menu(name_id_t *m, dialogex_t *dlg); + static dialogex_t *dialogex_class(name_id_t *n, dialogex_t *dlg); + static dialogex_t *dialogex_font(font_id_t *f, dialogex_t *dlg); + static dialogex_t *dialogex_caption(string_t *s, dialogex_t *dlg); + static dialogex_t *dialogex_exstyle(style_t *st, dialogex_t *dlg); + static dialogex_t *dialogex_style(style_t *st, dialogex_t *dlg); + static name_id_t *convert_ctlclass(name_id_t *cls); + static control_t *ins_ctrl(int type, int special_style, control_t *ctrl, control_t *prev); + static dialog_t *dialog_version(version_t *v, dialog_t *dlg); + static dialog_t *dialog_characteristics(characts_t *c, dialog_t *dlg); + static dialog_t *dialog_language(language_t *l, dialog_t *dlg); + static dialog_t *dialog_menu(name_id_t *m, dialog_t *dlg); + static dialog_t *dialog_class(name_id_t *n, dialog_t *dlg); + static dialog_t *dialog_font(font_id_t *f, dialog_t *dlg); + static dialog_t *dialog_caption(string_t *s, dialog_t *dlg); + static dialog_t *dialog_exstyle(style_t * st, dialog_t *dlg); + static dialog_t *dialog_style(style_t * st, dialog_t *dlg); + static resource_t *build_stt_resources(stringtable_t *stthead); + static stringtable_t *find_stringtable(lvc_t *lvc); + static toolbar_item_t *ins_tlbr_button(toolbar_item_t *prev, toolbar_item_t *idrec); + static toolbar_item_t *get_tlbr_buttons_head(toolbar_item_t *p, int *nitems); + static string_t *make_filename(string_t *s); + static resource_t *build_fontdirs(resource_t *tail); + static resource_t *build_fontdir(resource_t **fnt, int nfnt); + static int rsrcid_to_token(int lookahead); + + %} + %union{ + string_t *str; + int num; + int *iptr; + char *cptr; + resource_t *res; + accelerator_t *acc; + bitmap_t *bmp; + dialog_t *dlg; + dialogex_t *dlgex; + font_t *fnt; + fontdir_t *fnd; + menu_t *men; + menuex_t *menex; + rcdata_t *rdt; + stringtable_t *stt; + stt_entry_t *stte; + user_t *usr; + messagetable_t *msg; + versioninfo_t *veri; + control_t *ctl; + name_id_t *nid; + font_id_t *fntid; + language_t *lan; + version_t *ver; + characts_t *chars; + event_t *event; + menu_item_t *menitm; + menuex_item_t *menexitm; + itemex_opt_t *exopt; + raw_data_t *raw; + lvc_t *lvc; + ver_value_t *val; + ver_block_t *blk; + ver_words_t *verw; + toolbar_t *tlbar; + toolbar_item_t *tlbarItems; + dlginit_t *dginit; + style_pair_t *styles; + style_t *style; + ani_any_t *ani; + } + + %token tNL + %token tNUMBER tLNUMBER + %token tSTRING tIDENT tFILENAME + %token tRAWDATA + %token tACCELERATORS tBITMAP tCURSOR tDIALOG tDIALOGEX tMENU tMENUEX tMESSAGETABLE + %token tRCDATA tVERSIONINFO tSTRINGTABLE tFONT tFONTDIR tICON + %token tAUTO3STATE tAUTOCHECKBOX tAUTORADIOBUTTON tCHECKBOX tDEFPUSHBUTTON + %token tPUSHBUTTON tRADIOBUTTON tSTATE3 /* PUSHBOX */ + %token tGROUPBOX tCOMBOBOX tLISTBOX tSCROLLBAR + %token tCONTROL tEDITTEXT + %token tRTEXT tCTEXT tLTEXT + %token tBLOCK tVALUE + %token tSHIFT tALT tASCII tVIRTKEY tGRAYED tCHECKED tINACTIVE tNOINVERT + %token tPURE tIMPURE tDISCARDABLE tLOADONCALL tPRELOAD tFIXED tMOVEABLE + %token tCLASS tCAPTION tCHARACTERISTICS tEXSTYLE tSTYLE tVERSION tLANGUAGE + %token tFILEVERSION tPRODUCTVERSION tFILEFLAGSMASK tFILEOS tFILETYPE tFILEFLAGS tFILESUBTYPE + %token tMENUBARBREAK tMENUBREAK tMENUITEM tPOPUP tSEPARATOR + %token tHELP + %token tSTRING tIDENT tRAWDATA + %token tTOOLBAR tBUTTON + %token tBEGIN tEND + %token tDLGINIT + %left '|' + %left '^' + %left '&' + %left '+' '-' + %left '*' '/' + %right '~' tNOT + %left pUPM + + %type resource_file resource resources resource_definition + %type stringtable strings + %type font + %type fontdir + %type accelerators + %type events + %type bitmap + %type cursor icon + %type dialog dlg_attributes + %type ctrls gen_ctrl lab_ctrl ctrl_desc iconinfo + %type helpid + %type dialogex dlgex_attribs + %type exctrls gen_exctrl lab_exctrl exctrl_desc + %type rcdata + %type raw_data raw_elements opt_data file_raw + %type versioninfo fix_version + %type ver_words + %type ver_blocks ver_block + %type ver_values ver_value + %type menu + %type item_definitions menu_body + %type menuex + %type itemex_definitions menuex_body + %type itemex_p_options itemex_options + %type messagetable + %type userres + %type item_options + %type nameid nameid_s ctlclass usertype + %type acc_opt acc accs + %type loadmemopts lamo lama + %type opt_font opt_exfont opt_expr + %type opt_lvc + %type opt_language + %type opt_characts + %type opt_version + %type expr xpr + %type e_expr + %type toolbar + %type toolbar_items + %type dlginit + %type optional_style_pair + %type any_num + %type