FLG macros added.
[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 = i586-mingw32-
21 EXE_POSTFIX =
22 EXE_PREFIX = ./
23 #CP = cp
24 CP = $(PATH_TO_TOP)/rcopy
25 DLLTOOL = $(PREFIX)dlltool --as=$(PREFIX)as
26 NASM_CMD = nasm
27 #KM_SPECS = $(TOPDIR)/specs
28 FLOPPY_DIR = /a
29 # DIST_DIR should be relative from the top of the tree
30 DIST_DIR = dist
31 endif
32
33 ifeq ($(HOST),mingw32-windows)
34 NASM_FORMAT = win32
35 PREFIX =
36 EXE_POSTFIX = .exe
37 #CP = copy /B
38 CP = $(PATH_TO_TOP)/rcopy
39 DLLTOOL = $(PREFIX)dlltool --as=$(PREFIX)as
40 NASM_CMD = nasm
41 RM = del
42 RMDIR = rmdir
43 #KM_SPECS = specs
44 DOSCLI = yes
45 FLOPPY_DIR = A:
46 # DIST_DIR should be relative from the top of the tree
47 DIST_DIR = dist
48 endif
49
50 CC = $(PREFIX)gcc
51 HOST_CC = gcc
52 HOST_NM = nm
53 CFLAGS := $(CFLAGS) -I$(PATH_TO_TOP)/include -pipe
54 CXXFLAGS = $(CFLAGS)
55 NFLAGS = -i$(PATH_TO_TOP)/include/ -f$(NASM_FORMAT) -d$(NASM_FORMAT)
56 LD = $(PREFIX)ld
57 NM = $(PREFIX)nm
58 OBJCOPY = $(PREFIX)objcopy
59 STRIP = $(PREFIX)strip
60 ASFLAGS := $(ASFLAGS) -I$(PATH_TO_TOP)/include -D__ASM__
61 AS = $(PREFIX)gcc -c -x assembler-with-cpp
62 CPP = $(PREFIX)cpp
63 AR = $(PREFIX)ar
64 RC = $(PREFIX)windres
65 RCINC = --include-dir $(PATH_TO_TOP)/include
66 OBJCOPY = $(PREFIX)objcopy
67
68 %.o: %.cc
69 $(CC) $(CFLAGS) -c $< -o $@
70 %.o: %.c
71 $(CC) $(CFLAGS) -c $< -o $@
72 %.o: %.S
73 $(AS) $(ASFLAGS) -c $< -o $@
74 %.o: %.s
75 $(AS) $(ASFLAGS) -c $< -o $@
76 %.o: %.asm
77 $(NASM_CMD) $(NFLAGS) $< -o $@
78 %.coff: %.rc
79 $(RC) $(RCINC) $< $@
80
81 %.sys: %.o
82 $(CC) \
83 -nostartfiles -nostdlib -e _DriverEntry@8\
84 -mdll \
85 -o junk.tmp \
86 -Wl,--defsym,_end=end \
87 -Wl,--defsym,_edata=__data_end__ \
88 -Wl,--defsym,_etext=etext \
89 -Wl,--base-file,base.tmp $^
90 - $(RM) junk.tmp
91 $(DLLTOOL) \
92 --dllname $@ \
93 --base-file base.tmp \
94 --output-exp temp.exp \
95 --kill-at
96 - $(RM) base.tmp
97 $(CC) \
98 --verbose \
99 -Wl,--subsystem,native \
100 -Wl,--image-base,0x10000 \
101 -Wl,-e,_DriverEntry@8 \
102 -Wl,temp.exp \
103 -nostartfiles -nostdlib -e _DriverEntry@8 \
104 -mdll \
105 -o $@.unstripped \
106 $^
107 - $(RM) temp.exp
108 $(STRIP) --strip-debug $<
109 $(CC) \
110 -nostartfiles -nostdlib -e _DriverEntry@8 \
111 -mdll \
112 -o junk.tmp \
113 -Wl,--defsym,_end=end \
114 -Wl,--defsym,_edata=__data_end__ \
115 -Wl,--defsym,_etext=etext \
116 -Wl,--base-file,base.tmp $^
117 - $(RM) junk.tmp
118 $(DLLTOOL) \
119 --dllname $@ \
120 --base-file base.tmp \
121 --output-exp temp.exp \
122 --kill-at
123 - $(RM) base.tmp
124 $(CC) \
125 --verbose \
126 -Wl,--subsystem,native \
127 -Wl,--image-base,0x10000 \
128 -Wl,-e,_DriverEntry@8 \
129 -Wl,temp.exp \
130 -nostartfiles -nostdlib -e _DriverEntry@8 \
131 -mdll \
132 -o $@ \
133 $^
134 - $(RM) temp.exp
135
136 RULES_MAK_INCLUDED = 1
137
138
139
140
141
142
143
144