KD System Rewrite:
[reactos.git] / reactos / rules.mak
1 # Default to half-verbose mode
2 ifeq ($(VERBOSE),no)
3 Q = @
4 HALFVERBOSEECHO = @:
5 # Do not print "Entering directory ..."
6 export MAKEFLAGS += --no-print-directory
7 # Be silent
8 export MAKEFLAGS += --silent
9 else
10 ifeq ($(VERBOSE),yes)
11 Q =
12 HALFVERBOSEECHO = @:
13 else
14 Q = @
15 # the following is a hack to get the target name for wine dlls
16 # it's disabled because it produces warnings about overriden rules for author.c
17 #ifeq ($(TARGET_TYPE),winedll)
18 # export TOOLS_PATH = $(PATH_TO_TOP)/tools
19 # -include Makefile.ros
20 #endif
21 ifeq ($(TARGET_NAME),)
22 HALFVERBOSEECHO = @echo
23 else
24 HALFVERBOSEECHO = @echo $(TARGET_NAME):
25 endif
26 # Do not print "Entering directory ..."
27 export MAKEFLAGS += --no-print-directory
28 # Be silent
29 export MAKEFLAGS += --silent
30 endif
31 endif
32
33 export MAKE := @$(MAKE)
34
35 ifeq ($(VERBOSE),no)
36 endif
37
38 # detect Windows host environment
39 ifeq ($(HOST),)
40 ifeq ($(word 1,$(shell gcc -dumpmachine)),mingw32)
41 export HOST=mingw32-windows
42 else
43 export HOST=mingw32-linux
44 endif
45 endif
46
47 # Default to building map files which includes source and asm code
48 # Other options are: yes
49 ifeq ($(BUILD_MAP),)
50 export BUILD_MAP = full
51 endif
52
53 # Default to dumping .sym files out of .nostrip files
54 ifeq ($(BUILD_SYM),)
55 export BUILD_SYM = yes
56 endif
57
58 # Default to minimal dependencies, making components not
59 # depend on all import libraries
60 ifeq ($(MINIMALDEPENDENCIES),)
61 export MINIMALDEPENDENCIES = yes
62 endif
63
64 # Default to no PCH support
65 ifeq ($(ROS_USE_PCH),)
66 export ROS_USE_PCH = no
67 endif
68
69 # uncomment if you use bochs and it displays only 30 rows
70 # BOCHS_30ROWS = yes
71
72 #
73 # Choose various options
74 #
75 ifeq ($(HOST),mingw32-linux)
76 export NASM_FORMAT = win32
77 export PREFIX = mingw32-
78 export EXE_POSTFIX :=
79 export EXE_PREFIX := ./
80 export DLLTOOL = $(PREFIX)dlltool --as=$(PREFIX)as
81 #
82 # Do not change NASM_CMD to NASM because older versions of
83 # nasm doesn't like an environment variable NASM
84 #
85 export NASM_CMD = nasm
86 export DOSCLI =
87 export FLOPPY_DIR = /mnt/floppy
88 export SEP := /
89 export PIPE :=
90 endif
91
92 ifeq ($(HOST),mingw32-windows)
93 export NASM_FORMAT = win32
94 export PREFIX =
95 export EXE_PREFIX :=
96 export EXE_POSTFIX := .exe
97 export DLLTOOL = $(Q)$(PREFIX)dlltool --as=$(PREFIX)as
98 #
99 # Do not change NASM_CMD to NASM because older versions of
100 # nasm doesn't like an environment variable NASM
101 #
102 export NASM_CMD = $(Q)nasmw
103 export DOSCLI = yes
104 export FLOPPY_DIR = A:
105 export SEP := \$(EMPTY_VAR)
106 export PIPE := -pipe
107 endif
108
109 # TOPDIR is used by make bootcd but not defined anywhere. Usurp pointed out
110 # that it has the same meaning as PATH_TO_TOP.
111 export TOPDIR = $(PATH_TO_TOP)
112
113 # Directory to build a bootable CD image in
114 export BOOTCD_DIR=$(TOPDIR)/../bootcd/disk
115 export LIVECD_DIR=$(TOPDIR)/../livecd/disk
116
117 ifeq ($(LIVECD_INSTALL),yes)
118 export INSTALL_DIR=$(LIVECD_DIR)/reactos
119 else
120 # Use environment var ROS_INSTALL to override default install dir
121 ifeq ($(ROS_INSTALL),)
122 ifeq ($(HOST),mingw32-windows)
123 export INSTALL_DIR = C:/reactos
124 else
125 export INSTALL_DIR = $(PATH_TO_TOP)/reactos
126 endif
127 else
128 export INSTALL_DIR = $(ROS_INSTALL)
129 endif
130 endif
131
132
133 export CC = $(Q)$(PREFIX)gcc
134 export CXX = $(Q)$(PREFIX)g++
135 export HOST_CC = $(Q)gcc
136 export HOST_CXX = $(Q)g++
137 export HOST_AR = $(Q)ar
138 export HOST_NM = $(Q)nm
139 export LD = $(Q)$(PREFIX)ld
140 export NM = $(Q)$(PREFIX)nm
141 export OBJCOPY = $(Q)$(PREFIX)objcopy
142 export STRIP = $(Q)$(PREFIX)strip
143 export AS = $(Q)$(PREFIX)gcc -c -x assembler-with-cpp
144 export CPP = $(Q)$(PREFIX)cpp
145 export AR = $(Q)$(PREFIX)ar
146 export RC = $(Q)$(PREFIX)windres
147 export WRC = $(Q)$(WINE_TOP)/tools/wrc/wrc
148 export OBJCOPY = $(Q)$(PREFIX)objcopy
149 export OBJDUMP =$(Q)$(PREFIX)objdump
150 export TOOLS_PATH = $(PATH_TO_TOP)/tools
151 export W32API_PATH = $(PATH_TO_TOP)/w32api
152 export CP = $(Q)$(TOOLS_PATH)/rcopy
153 export RM = $(Q)$(TOOLS_PATH)/rdel
154 export RLINE = $(Q)$(TOOLS_PATH)/rline
155 export RMDIR = $(Q)$(TOOLS_PATH)/rrmdir
156 export RMKDIR = $(Q)$(TOOLS_PATH)/rmkdir
157 export RSYM = $(Q)$(TOOLS_PATH)/rsym
158 export RTOUCH = $(Q)$(TOOLS_PATH)/rtouch
159 export REGTESTS = $(Q)$(TOOLS_PATH)/regtests
160 export MC = $(Q)$(TOOLS_PATH)/wmc/wmc
161 export CABMAN = $(Q)$(TOOLS_PATH)/cabman/cabman
162 export WINEBUILD = $(Q)$(TOOLS_PATH)/winebuild/winebuild
163 export WINE2ROS = $(Q)$(TOOLS_PATH)/wine2ros/wine2ros
164 export MKHIVE = $(Q)$(TOOLS_PATH)/mkhive/mkhive
165 export CDMAKE = $(Q)$(TOOLS_PATH)/cdmake/cdmake
166 export BIN2RES = $(Q)$(TOOLS_PATH)/bin2res/bin2res
167 export XSLTPROC = $(Q)xsltproc
168 export MS2PS = $(Q)$(TOOLS_PATH)/ms2ps/ms2ps
169 export WRC = $(Q)$(TOOLS_PATH)/wrc/wrc
170 export WIDL = $(Q)$(TOOLS_PATH)/widl/widl
171
172 export STD_CFLAGS = -I$(PATH_TO_TOP)/include -I$(W32API_PATH)/include -pipe -march=$(OARCH) -D_M_IX86
173 export STD_CPPFLAGS = $(STD_CFLAGS)
174 # Check for 3GB
175 ifeq ($(3GB), 1)
176 export STD_ASFLAGS = -I$(PATH_TO_TOP)/include -I$(W32API_PATH)/include -D__ASM__ -D_M_IX86 -D__3GB__
177 else
178 export STD_ASFLAGS = -I$(PATH_TO_TOP)/include -I$(W32API_PATH)/include -D__ASM__ -D_M_IX86
179 endif
180 export STD_RCFLAGS = --include-dir $(PATH_TO_TOP)/include --include-dir $(W32API_PATH)/include
181 export STD_NFLAGS = -f win32
182
183 # Developer Kits
184 export DK_PATH=$(PATH_TO_TOP)/dk
185 # Native and kernel mode
186 export DDK_PATH=$(DK_PATH)/nkm
187 export DDK_PATH_LIB=$(DDK_PATH)/lib
188 export DDK_PATH_INC=$(PATH_TO_TOP)/include
189 # Win32
190 export SDK_PATH=$(DK_PATH)/w32
191 export SDK_PATH_LIB=$(SDK_PATH)/lib
192 export SDK_PATH_INC=$(PATH_TO_TOP)/include
193 # POSIX+
194 export XDK_PATH=$(DK_PATH)/psx
195 export XDK_PATH_LIB=$(XDK_PATH)/lib
196 export XDK_PATH_INC=$(XDK_PATH)/include
197
198 # Wine Integration
199 export WINE_PATH=$(PATH_TO_TOP)/../wine
200 export WINE_PATH_LIB=$(WINE_PATH)/lib
201 export WINE_PATH_INC=$(WINE_PATH)/include
202
203 # Posix+ Integration
204 export POSIX_PATH=$(PATH_TO_TOP)/../posix
205 export POSIX_PATH_LIB=$(POSIX_PATH)/lib
206 export POSIX_PATH_INC=$(POSIX_PATH)/include
207
208 # OS/2 Integration
209 export OS2_PATH=$(PATH_TO_TOP)/../os2
210 export OS2_PATH_LIB=$(OS2_PATH)/lib
211 export OS2_PATH_INC=$(OS2_PATH)/include
212
213 # Other systems integration
214 export REGTESTS_PATH=$(PATH_TO_TOP)/regtests
215 export REGTESTS_PATH_INC=$(PATH_TO_TOP)/regtests/shared