Added .o -> .sys rule to simplify driver makefiles
[reactos.git] / reactos / Makefile
1 #
2 # Global makefile
3 #
4
5 #
6 # Select your host
7 #
8 #HOST = mingw32-linux
9 #HOST = mingw32-windows
10
11 include rules.mak
12
13 #
14 # Required to run the system
15 #
16 COMPONENTS = iface_native iface_additional ntoskrnl
17 DLLS = ntdll kernel32 crtdll advapi32 fmifs gdi32 secur32
18 SUBSYS = smss win32k csrss
19
20 #
21 # Select the server(s) you want to build
22 #
23 SERVERS = win32
24 # SERVERS = posix linux os2
25
26 #
27 # Select the loader(s) you want to build
28 #
29 LOADERS = dos
30 # LOADERS = boot
31
32 #
33 # Select the device drivers and filesystems you want
34 #
35 DEVICE_DRIVERS = vidport vga blue ide keyboard null parallel serial floppy
36 # DEVICE_DRIVERS = beep event floppy ide_test mouse sound test test1
37
38 FS_DRIVERS = vfat
39 # FS_DRIVERS = minix ext2 template
40
41 # ndis tdi tcpip tditest
42 NET_DRIVERS = ndis tcpip tditest
43
44 KERNEL_SERVICES = $(DEVICE_DRIVERS) $(FS_DRIVERS) $(NET_DRIVERS)
45
46 APPS = args hello shell test cat bench apc shm lpc thread event file gditest \
47 pteb consume dump_shared_data
48
49 # objdir
50
51 all: buildno $(COMPONENTS) $(DLLS) $(SUBSYS) $(LOADERS) $(KERNEL_SERVICES) $(APPS)
52
53 .PHONY: all
54
55 clean: buildno_clean $(COMPONENTS:%=%_clean) $(DLLS:%=%_clean) $(LOADERS:%=%_clean) \
56 $(KERNEL_SERVICES:%=%_clean) $(SUBSYS:%=%_clean) $(APPS:%=%_clean)
57
58 .PHONY: clean
59
60 ifeq ($(HOST),mingw32-linux)
61 rcopy$(EXE_POSTFIX): rcopy.c
62 $(NATIVE_CC) -g -DUNIX_PATHS rcopy.c -o rcopy$(EXE_POSTFIX)
63 endif
64 ifeq ($(HOST),mingw32-windows)
65 rcopy$(EXE_POSTFIX): rcopy.c
66 $(NATIVE_CC) -g -DDOS_PATHS rcopy.c -o rcopy$(EXE_POSTFIX)
67 endif
68
69 install: rcopy$(EXE_POSTFIX) make_install_dirs autoexec_install $(COMPONENTS:%=%_install) \
70 $(DLLS:%=%_install) $(LOADERS:%=%_install) \
71 $(KERNEL_SERVICES:%=%_install) $(SUBSYS:%=%_install) \
72 $(APPS:%=%_install)
73
74 dist: clean_dist_dir make_dist_dirs $(COMPONENTS:%=%_dist) $(DLLS:%=%_dist) \
75 $(LOADERS:%=%_dist) $(KERNEL_SERVICES:%=%_dist) $(SUBSYS:%=%_dist) \
76 $(APPS:%=%_dist)
77
78 #
79 # Build number generator
80 #
81 buildno: include/reactos/version.h
82 make -C apps/buildno
83
84 buildno_clean:
85 make -C apps/buildno clean
86
87 buildno_dist:
88
89 buildno_install:
90
91 .PHONY: buildno buildno_clean buildno_dist buildno_install
92
93 #
94 # Applications
95 #
96 $(APPS): %:
97 make -C apps/$*
98
99 $(APPS:%=%_clean): %_clean:
100 make -C apps/$* clean
101
102 $(APPS:%=%_dist): %_dist:
103 make -C apps/$* dist
104
105 $(APPS:%=%_install): %_install:
106 make -C apps/$* install
107
108 .PHONY: $(APPS) $(APPS:%=%_clean) $(APPS:%=%_install) $(APPS:%=%_dist)
109
110 #
111 # Interfaces
112 #
113 iface_native:
114 make -C iface/native
115
116 iface_native_clean:
117 make -C iface/native clean
118
119 iface_native_install:
120
121 iface_native_dist:
122
123 iface_additional:
124 make -C iface/addsys
125
126 iface_additional_clean:
127 make -C iface/addsys clean
128
129 iface_additional_install:
130
131 iface_additional_dist:
132
133 .PHONY: iface_native iface_native_clean iface_native_install \
134 iface_native_dist \
135 iface_additional iface_additional_clean iface_additional_install \
136 iface_additional_dist
137
138 #
139 # Device driver rules
140 #
141 $(DEVICE_DRIVERS): %:
142 make -C services/dd/$*
143
144 $(DEVICE_DRIVERS:%=%_clean): %_clean:
145 make -C services/dd/$* clean
146
147 $(DEVICE_DRIVERS:%=%_install): %_install:
148 make -C services/dd/$* install
149
150 $(DEVICE_DRIVERS:%=%_dist): %_dist:
151 make -C services/dd/$* dist
152
153 .PHONY: $(DEVICE_DRIVERS) $(DEVICE_DRIVERS:%=%_clean) \
154 $(DEVICE_DRIVERS:%=%_install) $(DEVICE_DRIVERS:%=%_dist)
155
156 $(FS_DRIVERS): %:
157 make -C services/fs/$*
158
159 $(FS_DRIVERS:%=%_clean): %_clean:
160 make -C services/fs/$* clean
161
162 $(FS_DRIVERS:%=%_install): %_install:
163 make -C services/fs/$* install
164
165 $(FS_DRIVERS:%=%_dist): %_dist:
166 make -C services/fs/$* dist
167
168 .PHONY: $(FS_DRIVERS) $(FS_DRIVERS:%=%_clean) $(FS_DRIVERS:%=%_install) \
169 $(FS_DRIVERS:%=%_dist)
170
171 $(NET_DRIVERS): %:
172 make -C services/net/$*
173
174 $(NET_DRIVERS:%=%_clean): %_clean:
175 make -C services/net/$* clean
176
177 $(NET_DRIVERS:%=%_install): %_install:
178 make -C services/net/$* install
179
180 $(NET_DRIVERS:%=%_dist): %_dist:
181 make -C services/net/$* dist
182
183 .PHONY: $(NET_DRIVERS) $(NET_DRIVERS:%=%_clean) $(NET_DRIVERS:%=%_install) \
184 $(NET_DRIVERS:%=%_dist)
185
186 #
187 # Kernel loaders
188 #
189
190 $(LOADERS): %:
191 make -C loaders/$*
192
193 $(LOADERS:%=%_clean): %_clean:
194 make -C loaders/$* clean
195
196 $(LOADERS:%=%_install): %_install:
197 make -C loaders/$* install
198
199 $(LOADERS:%=%_dist): %_dist:
200 make -C loaders/$* dist
201
202 .PHONY: $(LOADERS) $(LOADERS:%=%_clean) $(LOADERS:%=%_install) \
203 $(LOADERS:%=%_dist)
204
205 #
206 # Required system components
207 #
208
209 ntoskrnl:
210 make -C ntoskrnl
211
212 ntoskrnl_clean:
213 make -C ntoskrnl clean
214
215 ntoskrnl_install:
216 make -C ntoskrnl install
217
218 ntoskrnl_dist:
219 make -C ntoskrnl dist
220
221 .PHONY: ntoskrnl ntoskrnl_clean ntoskrnl_install ntoskrnl_dist
222
223 #
224 # Required DLLs
225 #
226
227 $(DLLS): %:
228 make -C lib/$*
229
230 $(DLLS:%=%_clean): %_clean:
231 make -C lib/$* clean
232
233 $(DLLS:%=%_install): %_install:
234 make -C lib/$* install
235
236 $(DLLS:%=%_dist): %_dist:
237 make -C lib/$* dist
238
239 .PHONY: $(DLLS) $(DLLS:%=%_clean) $(DLLS:%=%_install) $(DLLS:%=%_dist)
240
241 #
242 # Kernel Subsystems
243 #
244
245 $(SUBSYS): %:
246 make -C subsys/$*
247
248 $(SUBSYS:%=%_clean): %_clean:
249 make -C subsys/$* clean
250
251 $(SUBSYS:%=%_install): %_install:
252 make -C subsys/$* install
253
254 $(SUBSYS:%=%_dist): %_dist:
255 make -C subsys/$* dist
256
257 .PHONY: $(SUBSYS) $(SUBSYS:%=%_clean) $(SUBSYS:%=%_install) \
258 $(SUBSYS:%=%_dist)
259
260 #
261 # Make an install floppy
262 #
263
264 install: all
265 ./install.sh /mnt/hda1
266 ./install.sh /mnt/hda4
267 ./install.bochs
268
269 make_install_dirs:
270 ifeq ($(DOSCLI),yes)
271 mkdir $(FLOPPY_DIR)\dlls
272 mkdir $(FLOPPY_DIR)\apps
273 mkdir $(FLOPPY_DIR)\drivers
274 mkdir $(FLOPPY_DIR)\subsys
275 else
276 mkdir $(FLOPPY_DIR)/dlls $(FLOPPY_DIR)/apps $(FLOPPY_DIR)/drivers
277 mkdir $(FLOPPY_DIR)/subsys
278 endif
279
280 .PHONY: make_install_dirs
281
282 autoexec_install: $(FLOPPY_DIR)/autoexec.bat
283
284 $(FLOPPY_DIR)/autoexec.bat: bootflop.bat
285 ifeq ($(DOSCLI),yes)
286 $(CP) bootflop.bat $(FLOPPY_DIR)\autoexec.bat
287 else
288 $(CP) bootflop.bat $(FLOPPY_DIR)/autoexec.bat
289 endif
290
291 #
292 # Make a distribution saveset
293 #
294
295 clean_dist_dir:
296 ifeq ($(DOSCLI),yes)
297 - $(RM) $(DIST_DIR)\dlls\*.dll
298 - $(RM) $(DIST_DIR)\apps\*.exe
299 - $(RM) $(DIST_DIR)\drivers\*.sys
300 - $(RM) $(DIST_DIR)\subsys\*.exe
301 - $(RMDIR) $(DIST_DIR)\dlls
302 - $(RMDIR) $(DIST_DIR)\apps
303 - $(RMDIR) $(DIST_DIR)\drivers
304 - $(RMDIR) $(DIST_DIR)\subsys
305 - $(RMDIR) $(DIST_DIR)
306 else
307 $(RM) -r $(DIST_DIR)
308 endif
309
310 make_dist_dirs:
311 ifeq ($(DOSCLI),yes)
312 mkdir $(DIST_DIR)
313 mkdir $(DIST_DIR)\dlls
314 mkdir $(DIST_DIR)\apps
315 mkdir $(DIST_DIR)\drivers
316 mkdir $(DIST_DIR)\dlls
317 mkdir $(DIST_DIR)\subsys
318 else
319 mkdir $(DIST_DIR) $(DIST_DIR)/dlls $(DIST_DIR)/apps $(DIST_DIR)/drivers
320 mkdir $(DIST_DIR)/subsys
321 endif
322
323 .PHONY: clean_dist_dir make_dist_dirs
324
325 #
326 #
327 #
328 etags:
329 find . -name "*.[ch]" -print | etags --language=c -
330
331 # EOF