Little change to make version resource linked in ne2000.sys.
[reactos.git] / reactos / rules.mak
1 #
2 # Important
3 #
4 .EXPORT_ALL_VARIABLES:
5
6 ifeq ($(HOST),mingw32-linux)
7 TOPDIR := $(shell if [ "$$PWD" != "" ]; then echo $$PWD; else pwd; fi)
8 endif
9
10 #
11 # Choose various options
12 #
13 ifeq ($(HOST),mingw32-linux)
14 NASM_FORMAT = win32
15 PREFIX = i586-mingw32-
16 EXE_POSTFIX =
17 EXE_PREFIX = ./
18 #CP = cp
19 CP = $(PATH_TO_TOP)/rcopy
20 DLLTOOL = $(PREFIX)dlltool --as=$(PREFIX)as
21 NASM_CMD = nasm
22 KM_SPECS = $(TOPDIR)/specs
23 FLOPPY_DIR = /a
24 # DIST_DIR should be relative from the top of the tree
25 DIST_DIR = dist
26 endif
27
28 ifeq ($(HOST),mingw32-windows)
29 NASM_FORMAT = win32
30 PREFIX =
31 EXE_POSTFIX = .exe
32 #CP = copy /B
33 CP = rcopy
34 DLLTOOL = $(PREFIX)dlltool --as=$(PREFIX)as
35 NASM_CMD = nasm
36 RM = del
37 RMDIR = rmdir
38 KM_SPECS = specs
39 DOSCLI = yes
40 FLOPPY_DIR = A:
41 # DIST_DIR should be relative from the top of the tree
42 DIST_DIR = dist
43 endif
44
45 #
46 # Create variables for all the compiler tools
47 #
48 ifeq ($(WITH_DEBUGGING),yes)
49 DEBUGGING_CFLAGS = -g
50 OPTIMIZATIONS = -O2
51 else
52 DEBUGGING_CFLAGS =
53 OPTIMIZATIONS = -O2
54 endif
55
56 ifeq ($(WARNINGS_ARE_ERRORS),yes)
57 EXTRA_CFLAGS = -Werror
58 endif
59
60 DEFINES = -DDBG
61
62 ifeq ($(WIN32_LEAN_AND_MEAN),yes)
63 LEAN_AND_MEAN_DEFINE = -DWIN32_LEAN_AND_MEAN
64 else
65 LEAN_AND_MEAN_DEFINE =
66 endif
67
68 CC = $(PREFIX)gcc
69 NATIVE_CC = gcc
70 NATIVE_NM = nm
71 CFLAGS = $(BASE_CFLAGS) \
72 -pipe \
73 $(OPTIMIZATIONS) \
74 $(LEAN_AND_MEAN_DEFINE) \
75 $(DEFINES) -Wall \
76 -Wstrict-prototypes $(DEBUGGING_CFLAGS) \
77 $(EXTRA_CFLAGS)
78 CXXFLAGS = $(CFLAGS)
79 NFLAGS = -i../../include/ -i../include/ -pinternal/asm.inc -f$(NASM_FORMAT) -d$(NASM_FORMAT)
80 LD = $(PREFIX)ld
81 NM = $(PREFIX)nm
82 OBJCOPY = $(PREFIX)objcopy
83 STRIP = $(PREFIX)strip
84 AS_INCLUDES = -I../include
85 AS = $(PREFIX)gcc -c -x assembler-with-cpp -D__ASM__ $(AS_BASEFLAGS) $(AS_INCLUDES)
86 CPP = $(PREFIX)cpp
87 AR = $(PREFIX)ar
88 RC = $(PREFIX)windres
89 RCINC = \
90 --include-dir ../include \
91 --include-dir ../../include \
92 --include-dir ../../../include \
93 --include-dir ../../../../include
94
95 %.o: %.cc
96 $(CC) $(CFLAGS) -c $< -o $@
97 %.o: %.c
98 $(CC) $(CFLAGS) -c $< -o $@
99 %.o: %.asm
100 $(NASM_CMD) $(NFLAGS) $< -o $@
101 %.coff: %.rc
102 $(RC) $(RCINC) $< $@
103
104 %.sys: %.o
105 $(CC) \
106 -specs=$(PATH_TO_TOP)/services/svc_specs \
107 -mdll \
108 -o junk.tmp \
109 -Wl,--defsym,_end=end \
110 -Wl,--defsym,_edata=__data_end__ \
111 -Wl,--defsym,_etext=etext \
112 -Wl,--base-file,base.tmp $^
113 - $(RM) junk.tmp
114 $(DLLTOOL) \
115 --dllname $@ \
116 --base-file base.tmp \
117 --output-exp temp.exp \
118 --kill-at
119 - $(RM) base.tmp
120 $(CC) \
121 --verbose \
122 -Wl,--image-base,0x10000 \
123 -Wl,-e,_DriverEntry@8 \
124 -Wl,temp.exp \
125 -specs=$(PATH_TO_TOP)/services/svc_specs \
126 -mdll \
127 -o $@.unstripped \
128 $^
129 - $(RM) temp.exp
130 $(STRIP) --strip-debug $<
131 $(CC) \
132 -specs=$(PATH_TO_TOP)/services/svc_specs \
133 -mdll \
134 -o junk.tmp \
135 -Wl,--defsym,_end=end \
136 -Wl,--defsym,_edata=__data_end__ \
137 -Wl,--defsym,_etext=etext \
138 -Wl,--base-file,base.tmp $^
139 - $(RM) junk.tmp
140 $(DLLTOOL) \
141 --dllname $@ \
142 --base-file base.tmp \
143 --output-exp temp.exp \
144 --kill-at
145 - $(RM) base.tmp
146 $(CC) \
147 --verbose \
148 -Wl,--image-base,0x10000 \
149 -Wl,-e,_DriverEntry@8 \
150 -Wl,temp.exp \
151 -specs=$(PATH_TO_TOP)/services/svc_specs \
152 -mdll \
153 -o $@ \
154 $^
155 - $(RM) temp.exp
156
157 RULES_MAK_INCLUDED = 1