# HG changeset patch
# User Alexander De Sousa <aphanic@hotmail.com>
# Date 1408211297 -7200
#      Sat Aug 16 19:48:17 2014 +0200
# Node ID 9c68c06d48095e9c2a72c4088c09514602b6fb44
# Parent  59a07c85e37afb8edb6366647bc3f8eb7dcdc99a
Windows: Enable unicode startup code in build scripts.

diff -r 59a07c85e37a -r 9c68c06d4809 lib/Makefile
--- a/lib/Makefile	Sat Aug 16 19:47:00 2014 +0200
+++ b/lib/Makefile	Sat Aug 16 19:48:17 2014 +0200
@@ -47,8 +47,8 @@
 I386_O = libtcc1.o alloca86.o alloca86-bt.o $(BCHECK_O)
 X86_64_O = libtcc1.o alloca86_64.o
 ARM_O = libtcc1.o armeabi.o alloca-arm.o
-WIN32_O = $(I386_O) crt1.o wincrt1.o dllcrt1.o dllmain.o chkstk.o
-WIN64_O = $(X86_64_O) crt1.o wincrt1.o dllcrt1.o dllmain.o chkstk.o
+WIN32_O = $(I386_O) crt1.o wcrt1.o wincrt1.o wwincrt1.o dllcrt1.o dllmain.o chkstk.o
+WIN64_O = $(X86_64_O) crt1.o wcrt1.o wincrt1.o wwincrt1.o dllcrt1.o dllmain.o chkstk.o
 
 # build TCC runtime library to contain PIC code, so it can be linked
 # into shared libraries
@@ -104,6 +104,10 @@
 
 $(DIR)/libtcc1.a ../libtcc1.a : $(OBJ) $(XAR)
 	$(AR) rcs $@ $(OBJ)
+$(DIR)/wcrt1.o : crt1.c
+	$(XCC) -c $< -o $@ $(XFLAGS) -D_UNICODE -DUNICODE
+$(DIR)/wwincrt1.o : wincrt1.c
+	$(XCC) -c $< -o $@ $(XFLAGS) -D_UNICODE -DUNICODE
 $(DIR)/%.o : %.c
 	$(XCC) -c $< -o $@ $(XFLAGS)
 $(DIR)/%.o : %.S
diff -r 59a07c85e37a -r 9c68c06d4809 win32/build-tcc.bat
--- a/win32/build-tcc.bat	Sat Aug 16 19:47:00 2014 +0200
+++ b/win32/build-tcc.bat	Sat Aug 16 19:48:17 2014 +0200
@@ -39,7 +39,9 @@
 :libtcc1.a
 .\tcc %target% -c ../lib/libtcc1.c
 .\tcc %target% -c lib/crt1.c
+.\tcc %target% -c lib/crt1.c -D_UNICODE -DUNICODE -o wcrt1.o
 .\tcc %target% -c lib/wincrt1.c
+.\tcc %target% -c lib/wincrt1.c -D_UNICODE -DUNICODE -o wwincrt1.o
 .\tcc %target% -c lib/dllcrt1.c
 .\tcc %target% -c lib/dllmain.c
 .\tcc %target% -c lib/chkstk.S
@@ -49,12 +51,12 @@
 .\tcc %target% -c ../lib/alloca86.S
 .\tcc %target% -c ../lib/alloca86-bt.S
 .\tcc %target% -c ../lib/bcheck.c
-tiny_libmaker lib/libtcc1.a libtcc1.o alloca86.o alloca86-bt.o crt1.o wincrt1.o dllcrt1.o dllmain.o chkstk.o bcheck.o
+tiny_libmaker lib/libtcc1.a libtcc1.o alloca86.o alloca86-bt.o crt1.o wcrt1.o wincrt1.o wwincrt1.o dllcrt1.o dllmain.o chkstk.o bcheck.o
 @goto the_end
 
 :lib64
 .\tcc %target% -c ../lib/alloca86_64.S
-tiny_libmaker lib/libtcc1.a libtcc1.o alloca86_64.o crt1.o wincrt1.o dllcrt1.o dllmain.o chkstk.o
+tiny_libmaker lib/libtcc1.a libtcc1.o alloca86_64.o crt1.o wcrt1.o wincrt1.o wwincrt1.o dllcrt1.o dllmain.o chkstk.o
 
 :the_end
 del *.o
