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