Full memory management support (memory.c & memory.h & mem.S)
[reactos.git] / reactos / rules.mak
1 #
2 # Important
3 #
4 .EXPORT_ALL_VARIABLES:
5
6 HOST = mingw32-windows
7
8 # uncomment if you use bochs and it displays only 30 rows
9 # BOCHS_30ROWS = yes
10
11 ifeq ($(HOST),mingw32-linux)
12 TOPDIR := $(shell if [ "$$PWD" != "" ]; then echo $$PWD; else pwd; fi)
13 endif
14
15 #
16 # Choose various options
17 #
18 ifeq ($(HOST),mingw32-linux)
19 NASM_FORMAT = win32
20 PREFIX = /usr/mingw32-cvs-000216/bin/mingw32-pc-
21 #PREFIX = i586-mingw32-
22 #PREFIX = /usr/mingw32-cvs-000207/bin/mingw32-cvs-000207-
23 EXE_POSTFIX :=
24 EXE_PREFIX := ./
25 #CP = cp
26 CP = $(PATH_TO_TOP)/rcopy
27 DLLTOOL = $(PREFIX)dlltool --as=$(PREFIX)as
28 NASM_CMD = nasm
29 #KM_SPECS = $(TOPDIR)/specs
30 FLOPPY_DIR = /a
31 # DIST_DIR should be relative from the top of the tree
32 DIST_DIR = dist
33 #DOT := \\.
34 #DSEP := /
35 #ENABLE_DEPENDENCY_TRACKING := 1
36 endif
37
38 ifeq ($(HOST),mingw32-windows)
39 NASM_FORMAT = win32
40 PREFIX =
41 EXE_PREFIX :=
42 EXE_POSTFIX := .exe
43 #CP = copy /B
44 CP = $(PATH_TO_TOP)/rcopy
45 DLLTOOL = $(PREFIX)dlltool --as=$(PREFIX)as
46 NASM_CMD = nasmw
47 RM = del
48 RMDIR = rmdir
49 #KM_SPECS = specs
50 DOSCLI = yes
51 FLOPPY_DIR = A:
52 # DIST_DIR should be relative from the top of the tree
53 DIST_DIR = dist
54 #DOT := \.
55 #DSEP := \\
56 #ENABLE_DEPENDENCY_TRACKING := 1
57 endif
58
59 CC = $(PREFIX)gcc
60 CXX = $(PREFIX)g++
61 HOST_CC = gcc
62 HOST_NM = nm
63 CFLAGS := $(CFLAGS) -I$(PATH_TO_TOP)/include -pipe -m386
64 CXXFLAGS = $(CFLAGS)
65 NFLAGS = -i$(PATH_TO_TOP)/include/ -f$(NASM_FORMAT) -d$(NASM_FORMAT)
66 LD = $(PREFIX)ld
67 NM = $(PREFIX)nm
68 OBJCOPY = $(PREFIX)objcopy
69 STRIP = $(PREFIX)strip
70 ASFLAGS := $(ASFLAGS) -I$(PATH_TO_TOP)/include -D__ASM__
71 AS = $(PREFIX)gcc -c -x assembler-with-cpp
72 CPP = $(PREFIX)cpp
73 AR = $(PREFIX)ar
74 RC = $(PREFIX)windres
75 RCINC = --include-dir $(PATH_TO_TOP)/include
76 OBJCOPY = $(PREFIX)objcopy
77
78 %.o: %.cc
79 $(CC) $(CFLAGS) -c $< -o $@
80 %.o: %.c
81 $(CC) $(CFLAGS) -c $< -o $@
82 %.o: %.S
83 $(AS) $(ASFLAGS) -c $< -o $@
84 %.o: %.s
85 $(AS) $(ASFLAGS) -c $< -o $@
86 %.o: %.asm
87 $(NASM_CMD) $(NFLAGS) $< -o $@
88 %.coff: %.rc
89 $(RC) $(RCINC) $< $@
90
91 %.sys: %.o
92 $(CC) \
93 -nostartfiles -nostdlib -e _DriverEntry@8\
94 -mdll \
95 -o junk.tmp \
96 -Wl,--defsym,_end=end \
97 -Wl,--defsym,_edata=__data_end__ \
98 -Wl,--defsym,_etext=etext \
99 -Wl,--base-file,base.tmp $^
100 - $(RM) junk.tmp
101 $(DLLTOOL) \
102 --dllname $@ \
103 --base-file base.tmp \
104 --output-exp temp.exp \
105 --kill-at
106 - $(RM) base.tmp
107 $(CC) \
108 --verbose \
109 -Wl,--subsystem,native \
110 -Wl,--image-base,0x10000 \
111 -Wl,-e,_DriverEntry@8 \
112 -Wl,temp.exp \
113 -nostartfiles -nostdlib -e _DriverEntry@8 \
114 -mdll \
115 -o $@.unstripped \
116 $^
117 - $(RM) temp.exp
118 - $(NM) --numeric-sort $@.unstripped > $@.sym
119 $(STRIP) --strip-debug $<
120 $(CC) \
121 -nostartfiles -nostdlib -e _DriverEntry@8 \
122 -mdll \
123 -o junk.tmp \
124 -Wl,--defsym,_end=end \
125 -Wl,--defsym,_edata=__data_end__ \
126 -Wl,--defsym,_etext=etext \
127 -Wl,--base-file,base.tmp $^
128 - $(RM) junk.tmp
129 $(DLLTOOL) \
130 --dllname $@ \
131 --base-file base.tmp \
132 --output-exp temp.exp \
133 --kill-at
134 - $(RM) base.tmp
135 $(CC) \
136 --verbose \
137 -Wl,--subsystem,native \
138 -Wl,--image-base,0x10000 \
139 -Wl,-e,_DriverEntry@8 \
140 -Wl,temp.exp \
141 -nostartfiles -nostdlib -e _DriverEntry@8 \
142 -mdll \
143 -o $@ \
144 $^
145 - $(RM) temp.exp
146
147 RULES_MAK_INCLUDED = 1