549a989aa91384208ad0d8b40935384d3428e606
[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 DLLTOOL = $(PREFIX)dlltool --as=$(PREFIX)as
20 NASM_CMD = nasm
21 KM_SPECS = $(TOPDIR)/specs
22 FLOPPY_DIR = /a
23 # DIST_DIR should be relative from the top of the tree
24 DIST_DIR = dist
25 endif
26
27 ifeq ($(HOST),mingw32-windows)
28 NASM_FORMAT = win32
29 PREFIX =
30 EXE_POSTFIX = .exe
31 CP = copy /B
32 DLLTOOL = $(PREFIX)dlltool --as=$(PREFIX)as
33 NASM_CMD = nasm
34 RM = del
35 RMDIR = rmdir
36 KM_SPECS = specs
37 DOSCLI = yes
38 FLOPPY_DIR = A:
39 # DIST_DIR should be relative from the top of the tree
40 DIST_DIR = dist
41 endif
42
43 #
44 # Create variables for all the compiler tools
45 #
46 ifeq ($(WITH_DEBUGGING),yes)
47 DEBUGGING_CFLAGS = -g
48 OPTIMIZATIONS = -O2
49 else
50 DEBUGGING_CFLAGS =
51 OPTIMIZATIONS = -O2
52 endif
53
54 ifeq ($(WARNINGS_ARE_ERRORS),yes)
55 EXTRA_CFLAGS = -Werror
56 endif
57
58 DEFINES = -DDBG
59
60 ifeq ($(WIN32_LEAN_AND_MEAN),yes)
61 LEAN_AND_MEAN_DEFINE = -DWIN32_LEAN_AND_MEAN
62 else
63 LEAN_AND_MEAN_DEFINE =
64 endif
65
66 CC = $(PREFIX)gcc
67 NATIVE_CC = gcc
68 NATIVE_NM = nm
69 CFLAGS = $(BASE_CFLAGS) \
70 -pipe \
71 $(OPTIMIZATIONS) \
72 $(LEAN_AND_MEAN_DEFINE) \
73 $(DEFINES) -Wall \
74 -Wstrict-prototypes $(DEBUGGING_CFLAGS) \
75 $(EXTRA_CFLAGS)
76 CXXFLAGS = $(CFLAGS)
77 NFLAGS = -i../../include/ -i../include/ -pinternal/asm.inc -f$(NASM_FORMAT) -d$(NASM_FORMAT)
78 LD = $(PREFIX)ld
79 NM = $(PREFIX)nm
80 OBJCOPY = $(PREFIX)objcopy
81 STRIP = $(PREFIX)strip
82 AS_INCLUDES = -I../include
83 AS = $(PREFIX)gcc -c -x assembler-with-cpp -D__ASM__ $(AS_BASEFLAGS) $(AS_INCLUDES)
84 CPP = $(PREFIX)cpp
85 AR = $(PREFIX)ar
86 RC = $(PREFIX)windres
87 RCINC = --include-dir ../include --include-dir ../../include --include-dir ../../../include
88
89 %.o: %.cc
90 $(CC) $(CFLAGS) -c $< -o $@
91 %.o: %.c
92 $(CC) $(CFLAGS) -c $< -o $@
93 %.o: %.asm
94 $(NASM_CMD) $(NFLAGS) $< -o $@
95 %.coff: %.rc
96 $(RC) $(RCINC) $< $@
97
98
99 RULES_MAK_INCLUDED = 1