Little change to make version resource linked in ne2000.sys.
[reactos.git] / reactos / rules.mak
index 8756beb..0684fcf 100644 (file)
@@ -14,24 +14,32 @@ ifeq ($(HOST),mingw32-linux)
 NASM_FORMAT = win32
 PREFIX = i586-mingw32-
 EXE_POSTFIX = 
-CP = cp
+EXE_PREFIX = ./
+#CP = cp
+CP = $(PATH_TO_TOP)/rcopy
 DLLTOOL = $(PREFIX)dlltool --as=$(PREFIX)as
 NASM_CMD = nasm
 KM_SPECS = $(TOPDIR)/specs
+FLOPPY_DIR = /a
+# DIST_DIR should be relative from the top of the tree
+DIST_DIR = dist
 endif
 
 ifeq ($(HOST),mingw32-windows)
 NASM_FORMAT = win32
 PREFIX = 
 EXE_POSTFIX = .exe
-CP = copy
+#CP = copy /B
+CP = rcopy
 DLLTOOL = $(PREFIX)dlltool --as=$(PREFIX)as
 NASM_CMD = nasm
 RM = del
+RMDIR = rmdir
 KM_SPECS = specs
 DOSCLI = yes
-FLOPPY_DIR=A:
-DIST_DIR=dist
+FLOPPY_DIR = A:
+# DIST_DIR should be relative from the top of the tree
+DIST_DIR = dist
 endif
 
 #
@@ -39,8 +47,10 @@ endif
 #
 ifeq ($(WITH_DEBUGGING),yes)
 DEBUGGING_CFLAGS = -g
+OPTIMIZATIONS = -O2
 else
-DEBUGGING_CFLAGS = 
+DEBUGGING_CFLAGS =
+OPTIMIZATIONS = -O2
 endif
 
 ifeq ($(WARNINGS_ARE_ERRORS),yes)
@@ -57,20 +67,30 @@ endif
 
 CC = $(PREFIX)gcc
 NATIVE_CC = gcc
-CFLAGS = -O2 -I../../../include -I../../include  \
-         -I../include -fno-builtin $(LEAN_AND_MEAN_DEFINE)  \
-         $(DEFINES) -Wall -Wstrict-prototypes $(DEBUGGING_CFLAGS) \
-        $(EXTRA_CFLAGS)
+NATIVE_NM = nm
+CFLAGS = $(BASE_CFLAGS) \
+       -pipe \
+       $(OPTIMIZATIONS) \
+       $(LEAN_AND_MEAN_DEFINE)  \
+       $(DEFINES) -Wall \
+       -Wstrict-prototypes $(DEBUGGING_CFLAGS) \
+       $(EXTRA_CFLAGS)
 CXXFLAGS = $(CFLAGS)
 NFLAGS = -i../../include/ -i../include/ -pinternal/asm.inc -f$(NASM_FORMAT) -d$(NASM_FORMAT)
 LD = $(PREFIX)ld
 NM = $(PREFIX)nm
 OBJCOPY = $(PREFIX)objcopy
 STRIP = $(PREFIX)strip
-AS = $(PREFIX)gcc -c -x assembler-with-cpp
+AS_INCLUDES = -I../include
+AS = $(PREFIX)gcc -c -x assembler-with-cpp -D__ASM__ $(AS_BASEFLAGS) $(AS_INCLUDES)
 CPP = $(PREFIX)cpp
 AR = $(PREFIX)ar
 RC = $(PREFIX)windres
+RCINC = \
+       --include-dir ../include        \
+       --include-dir ../../include     \
+       --include-dir ../../../include  \
+       --include-dir ../../../../include
 
 %.o: %.cc
        $(CC) $(CFLAGS) -c $< -o $@
@@ -79,7 +99,59 @@ RC = $(PREFIX)windres
 %.o: %.asm
        $(NASM_CMD) $(NFLAGS) $< -o $@
 %.coff: %.rc
-       $(RC) $< $@
+       $(RC) $(RCINC) $< $@
 
+%.sys: %.o
+       $(CC) \
+               -specs=$(PATH_TO_TOP)/services/svc_specs \
+               -mdll \
+               -o junk.tmp \
+               -Wl,--defsym,_end=end \
+               -Wl,--defsym,_edata=__data_end__ \
+               -Wl,--defsym,_etext=etext \
+               -Wl,--base-file,base.tmp $^
+       - $(RM) junk.tmp
+       $(DLLTOOL) \
+               --dllname $@ \
+               --base-file base.tmp \
+               --output-exp temp.exp \
+               --kill-at
+       - $(RM) base.tmp
+       $(CC) \
+               --verbose \
+               -Wl,--image-base,0x10000 \
+               -Wl,-e,_DriverEntry@8 \
+               -Wl,temp.exp \
+               -specs=$(PATH_TO_TOP)/services/svc_specs \
+               -mdll \
+               -o $@.unstripped \
+               $^
+       - $(RM) temp.exp
+       $(STRIP) --strip-debug $<
+       $(CC) \
+               -specs=$(PATH_TO_TOP)/services/svc_specs \
+               -mdll \
+               -o junk.tmp \
+               -Wl,--defsym,_end=end \
+               -Wl,--defsym,_edata=__data_end__ \
+               -Wl,--defsym,_etext=etext \
+               -Wl,--base-file,base.tmp $^
+       - $(RM) junk.tmp
+       $(DLLTOOL) \
+               --dllname $@ \
+               --base-file base.tmp \
+               --output-exp temp.exp \
+               --kill-at
+       - $(RM) base.tmp
+       $(CC) \
+               --verbose \
+               -Wl,--image-base,0x10000 \
+               -Wl,-e,_DriverEntry@8 \
+               -Wl,temp.exp \
+               -specs=$(PATH_TO_TOP)/services/svc_specs \
+               -mdll \
+               -o $@ \
+               $^
+       - $(RM) temp.exp
 
 RULES_MAK_INCLUDED = 1