9dc41bf8ef90ba49e339ffa668d4d84948da8ab3
[reactos.git] / reactos / ntoskrnl / Makefile
1 preall: all
2
3 PATH_TO_TOP := ..
4
5 include $(PATH_TO_TOP)/config
6
7 TARGET_REGTESTS = yes
8
9 TARGET_TYPE = kernel
10
11 TARGET_NAME = ntoskrnl
12
13 TARGET_BOOTSTRAP = yes
14
15 CONFIG :=
16
17 ifeq ($(DBG), 1)
18 DBG_OR_KDBG := 1
19 endif
20 ifeq ($(KDBG), 1)
21 DBG_OR_KDBG := 1
22 endif
23
24 LINKER_SCRIPT := ntoskrnl.lnk
25 STRIP_FLAGS := -Wl,-s
26
27 ifeq ($(KDBG), 1)
28 OBJECTS_KDBG := dbg/kdb.o dbg/kdb_serial.o dbg/kdb_keyboard.o dbg/rdebug.o \
29 dbg/i386/kdb_help.o \
30 ../dk/w32/lib/libkjs.a dbg/i386/i386-dis.o
31 CFLAGS_KDBG := -I../lib/kjs/include
32 preall: all
33
34 ../dk/w32/lib/libkjs.a:
35 $(MAKE) -C ../lib/kjs
36 else
37 OBJECTS_KDBG :=
38 endif
39 ifeq ($(DBG_OR_KDBG), 1)
40 OBJECTS_KDBG := $(OBJECTS_KDBG) dbg/kdb_symbols.o dbg/profile.o
41 endif
42
43 TARGET_ASFLAGS = -I./include
44 TARGET_CFLAGS = -I./include $(CFLAGS_KDBG) -Wall -Werror $(CFLAGS_OPT)
45
46 # require os code to explicitly request A/W version of structs/functions
47 TARGET_CFLAGS += -D_DISABLE_TIDENTS
48
49 # 3GB User Mode Memory Space support
50 ifeq ($(3GB), 1)
51 TARGET_CFLAGS += -D__3GB__
52 TARGET_BASE = 0xC0000000
53 else
54 TARGET_BASE = 0x80000000
55 endif
56
57 ifneq ($(DBG), 0)
58 TARGET_CFLAGS += -DDBG
59 endif
60
61 # enable thread event pair features (NT4 only!)
62 # TARGET_CFLAGS += -D_ENABLE_THRDEVTPAIR
63
64 #
65 # Javascript extension for kdb
66 #
67
68 OBJECTS_PATH = objects
69
70 #
71 # Architecture specific Makefile
72 # Defines $(OBJECTS_ARCH)
73 #
74 include Makefile.$(ARCH)
75
76 # Run-Time Library (Rtl)
77 OBJECTS_RTL = \
78 rtl/atom.o \
79 rtl/capture.o \
80 rtl/ctype.o \
81 rtl/handle.o \
82 rtl/message.o \
83 rtl/misc.o \
84 rtl/purecall.o \
85 rtl/regio.o \
86 rtl/sprintf.o \
87 rtl/stdlib.o \
88 rtl/string.o \
89 rtl/swprintf.o \
90 rtl/wstring.o \
91 rtl/nls.o \
92 rtl/rangelist.o \
93 rtl/libsupp.o
94
95 OBJECTS_RTL := $(filter-out $(RTL_EXCLUDE_FILTER), $(OBJECTS_RTL))
96
97
98 # Kernel (Ke)
99 OBJECTS_KE = \
100 ke/apc.o \
101 ke/bug.o \
102 ke/catch.o \
103 ke/clock.o \
104 ke/critical.o \
105 ke/dpc.o \
106 ke/device.o \
107 ke/error.o \
108 ke/event.o \
109 ke/kqueue.o \
110 ke/kthread.o \
111 ke/ipi.o \
112 ke/main.o \
113 ke/mutex.o \
114 ke/process.o \
115 ke/profile.o \
116 ke/queue.o \
117 ke/sem.o \
118 ke/spinlock.o \
119 ke/timer.o \
120 ke/wait.o \
121 ke/alert.o
122
123 # Memory Manager (Mm)
124 OBJECTS_MM = \
125 mm/anonmem.o \
126 mm/aspace.o \
127 mm/balance.o \
128 mm/cont.o \
129 mm/drvlck.o \
130 mm/elf32.o \
131 mm/elf64.o \
132 mm/freelist.o \
133 mm/iospace.o \
134 mm/kmap.o \
135 mm/marea.o \
136 mm/mdl.o \
137 mm/mm.o \
138 mm/mminit.o \
139 mm/mpw.o \
140 mm/ncache.o \
141 mm/npool.o \
142 mm/pagfault.o \
143 mm/pagefile.o \
144 mm/pageop.o \
145 mm/pager.o \
146 mm/paging.o \
147 mm/pe.o \
148 mm/pool.o \
149 mm/ppool.o \
150 mm/physical.o \
151 mm/region.o \
152 mm/rmap.o \
153 mm/section.o \
154 mm/verifier.o \
155 mm/virtual.o \
156 mm/wset.o
157
158 # I/O Subsystem (Io)
159 OBJECTS_IO = \
160 io/adapter.o \
161 io/arcname.o \
162 io/bootlog.o \
163 io/buildirp.o \
164 io/cancel.o \
165 io/cleanup.o \
166 io/cntrller.o \
167 io/create.o \
168 io/device.o \
169 io/deviface.o \
170 io/dir.o \
171 io/driver.o \
172 io/efi.o \
173 io/errlog.o \
174 io/error.o \
175 io/event.o \
176 io/file.o \
177 io/flush.o \
178 io/fs.o \
179 io/iocomp.o \
180 io/ioctrl.o \
181 io/iomgr.o \
182 io/iowork.o \
183 io/irp.o \
184 io/irq.o \
185 io/lock.o \
186 io/mailslot.o \
187 io/mdl.o \
188 io/npipe.o \
189 io/page.o \
190 io/parttab.o \
191 io/plugplay.o \
192 io/process.o \
193 io/pnpdma.o \
194 io/pnpmgr.o \
195 io/pnpnotify.o \
196 io/pnpreport.o \
197 io/pnproot.o \
198 io/queue.o \
199 io/rawfs.o \
200 io/remlock.o \
201 io/resource.o \
202 io/rw.o \
203 io/share.o \
204 io/shutdown.o \
205 io/symlink.o \
206 io/timer.o \
207 io/vpb.o \
208 io/wdm.o \
209 io/wmi.o \
210 io/xhaldisp.o \
211 io/xhaldrv.o
212
213 # Object Manager (Ob)
214 OBJECTS_OB = \
215 ob/dirobj.o \
216 ob/handle.o \
217 ob/namespc.o \
218 ob/ntobj.o \
219 ob/object.o \
220 ob/sdcache.o \
221 ob/security.o \
222 ob/symlink.o
223
224 # Process Manager (Ps)
225 OBJECTS_PS = \
226 ps/cid.o \
227 ps/create.o \
228 ps/debug.o \
229 ps/idle.o \
230 ps/job.o \
231 ps/kill.o \
232 ps/locale.o \
233 ps/process.o \
234 ps/psmgr.o \
235 ps/suspend.o \
236 ps/thread.o \
237 ps/tinfo.o \
238 ps/win32.o \
239 ps/w32call.o
240
241 # Executive Subsystem (Ex)
242 OBJECTS_EX = \
243 ex/btree.o \
244 ex/callback.o \
245 ex/event.o \
246 ex/evtpair.o \
247 ex/fmutex.o \
248 ex/hashtab.o \
249 ex/init.o \
250 ex/interlck.o \
251 ex/list.o \
252 ex/lookas.o \
253 ex/mutant.o \
254 ex/napi.o \
255 ex/power.o \
256 ex/profile.o \
257 ex/resource.o \
258 ex/rundown.o \
259 ex/stree.o \
260 ex/sem.o \
261 ex/synch.o \
262 ex/sysinfo.o \
263 ex/time.o \
264 ex/timer.o \
265 ex/util.o \
266 ex/uuid.o \
267 ex/win32k.o \
268 ex/work.o \
269 ex/zone.o \
270 ex/zw.o
271
272 # Installable File System Run-Time Library (FsRtl)
273 OBJECTS_FS = \
274 fs/dbcsname.o \
275 fs/filelock.o \
276 fs/mcb.o \
277 fs/mdl.o \
278 fs/name.o \
279 fs/notify.o \
280 fs/oplock.o \
281 fs/pool.o \
282 fs/tunnel.o \
283 fs/unc.o \
284 fs/util.o
285
286 # Security Subsystem
287 OBJECTS_SE = \
288 se/access.o \
289 se/acl.o \
290 se/audit.o \
291 se/lsa.o \
292 se/luid.o \
293 se/priv.o \
294 se/sd.o \
295 se/semgr.o \
296 se/sid.o \
297 se/token.o
298
299 # Configuration Manager (Registry)
300 OBJECTS_CM = \
301 cm/import.o \
302 cm/ntfunc.o \
303 cm/regfile.o \
304 cm/registry.o \
305 cm/regobj.o \
306
307 # Debugger Support (Dbg)
308 OBJECTS_DBG = \
309 dbg/dbgctrl.o \
310 dbg/errinfo.o \
311 dbg/print.o \
312 dbg/user.o \
313 $(OBJECTS_KDBG)
314
315 # Loader
316 OBJECTS_LDR = \
317 ldr/init.o \
318 ldr/loader.o \
319 ldr/resource.o \
320 ldr/rtl.o \
321 ldr/sysdll.o \
322 ldr/userldr.o
323
324 # Local Procedure Call (Lpc)
325 OBJECTS_LPC = \
326 lpc/close.o \
327 lpc/complete.o \
328 lpc/connect.o \
329 lpc/create.o \
330 lpc/listen.o \
331 lpc/port.o \
332 lpc/query.o \
333 lpc/queue.o \
334 lpc/receive.o \
335 lpc/reply.o \
336 lpc/send.o
337
338 # Power Management (Po)
339 OBJECTS_PO = \
340 po/power.o
341
342 # Cache Manager (Cc)
343 OBJECTS_CC = \
344 cc/cacheman.o \
345 cc/copy.o \
346 cc/fs.o \
347 cc/pin.o \
348 cc/mdl.o \
349 cc/view.o
350
351 # Kernel Debugger Support (Kd)
352 OBJECTS_KD = \
353 kd/dlog.o \
354 kd/gdbstub.o \
355 kd/kdebug.o \
356 kd/mda.o \
357 kd/service.o
358
359 # Boot video (Inbv)
360 OBJECTS_INBV = \
361 inbv/inbv.o
362
363 DEP_OBJECTS := $(OBJECTS_MM) $(OBJECTS_ARCH) \
364 $(OBJECTS_IO) $(OBJECTS_KE) $(OBJECTS_OB) \
365 $(OBJECTS_PS) $(OBJECTS_EX) $(OBJECTS_CC) $(OBJECTS_FS) $(OBJECTS_SE) \
366 $(OBJECTS_DBG) $(OBJECTS_CM) $(OBJECTS_LDR) $(OBJECTS_LPC) \
367 $(OBJECTS_PO) $(OBJECTS_KD) $(OBJECTS_RTL) $(OBJECTS_INBV)
368
369 TAG_OBJECTS := $(join $(dir $(DEP_OBJECTS)),$(patsubst %.o, .%.TAG, $(notdir $(DEP_OBJECTS))))
370
371 TARGET_PCH = include/ntoskrnl.h
372
373
374 # Resources
375 OBJECTS_RESOURCE = \
376 $(TARGET_NAME).coff
377
378 $(OBJECTS_PATH):
379 mkdir $(OBJECTS_PATH)
380
381 $(OBJECTS_RESOURCE): $(TARGET_NAME).rc bugcodes.rc $(PATH_TO_TOP)/include/reactos/resource.h
382
383 #
384 # Build subsystem intermediate objects
385 #
386 $(OBJECTS_PATH)/arch.o: $(OBJECTS_ARCH)
387 $(LD) -r -o $(OBJECTS_PATH)/arch.o $(OBJECTS_ARCH)
388
389 $(OBJECTS_PATH)/io.o: $(OBJECTS_IO)
390 $(LD) \
391 -r \
392 -o $(OBJECTS_PATH)/io.o \
393 $(OBJECTS_IO)
394
395 $(OBJECTS_PATH)/ke.o: $(OBJECTS_KE)
396 $(LD) \
397 -r \
398 -o $(OBJECTS_PATH)/ke.o \
399 $(OBJECTS_KE)
400
401 $(OBJECTS_PATH)/rtl.o: $(OBJECTS_RTL)
402 $(LD) \
403 -r \
404 -o $(OBJECTS_PATH)/rtl.o \
405 $(OBJECTS_RTL)
406
407 $(OBJECTS_PATH)/mm.o: $(OBJECTS_MM)
408 $(LD) \
409 -r \
410 -o $(OBJECTS_PATH)/mm.o \
411 $(OBJECTS_MM)
412
413 $(OBJECTS_PATH)/ob.o: $(OBJECTS_OB)
414 $(LD) \
415 -r \
416 -o $(OBJECTS_PATH)/ob.o \
417 $(OBJECTS_OB)
418
419 $(OBJECTS_PATH)/ps.o: $(OBJECTS_PS)
420 $(LD) \
421 -r \
422 -o $(OBJECTS_PATH)/ps.o \
423 $(OBJECTS_PS)
424
425 $(OBJECTS_PATH)/ex.o: $(OBJECTS_EX)
426 $(LD) \
427 -r \
428 -o $(OBJECTS_PATH)/ex.o \
429 $(OBJECTS_EX)
430
431 $(OBJECTS_PATH)/fs.o: $(OBJECTS_FS)
432 $(LD) \
433 -r \
434 -o $(OBJECTS_PATH)/fs.o \
435 $(OBJECTS_FS)
436
437 $(OBJECTS_PATH)/se.o: $(OBJECTS_SE)
438 $(LD) \
439 -r \
440 -o $(OBJECTS_PATH)/se.o \
441 $(OBJECTS_SE)
442
443 $(OBJECTS_PATH)/cm.o: $(OBJECTS_CM)
444 $(LD) \
445 -r \
446 -o $(OBJECTS_PATH)/cm.o \
447 $(OBJECTS_CM)
448
449 $(OBJECTS_PATH)/dbg.o: $(OBJECTS_DBG)
450 $(LD) \
451 -r \
452 -o $(OBJECTS_PATH)/dbg.o \
453 $(OBJECTS_DBG)
454
455 $(OBJECTS_PATH)/ldr.o: $(OBJECTS_LDR)
456 $(LD) \
457 -r \
458 -o $(OBJECTS_PATH)/ldr.o \
459 $(OBJECTS_LDR)
460
461 $(OBJECTS_PATH)/lpc.o: $(OBJECTS_LPC)
462 $(LD) \
463 -r \
464 -o $(OBJECTS_PATH)/lpc.o \
465 $(OBJECTS_LPC)
466
467 $(OBJECTS_PATH)/po.o: $(OBJECTS_PO)
468 $(LD) \
469 -r \
470 -o $(OBJECTS_PATH)/po.o \
471 $(OBJECTS_PO)
472
473 $(OBJECTS_PATH)/cc.o: $(OBJECTS_CC)
474 $(LD) \
475 -r \
476 -o $(OBJECTS_PATH)/cc.o \
477 $(OBJECTS_CC)
478
479 $(OBJECTS_PATH)/kd.o: $(OBJECTS_KD)
480 $(LD) \
481 -r \
482 -o $(OBJECTS_PATH)/kd.o \
483 $(OBJECTS_KD)
484
485 $(OBJECTS_PATH)/inbv.o: $(OBJECTS_INBV)
486 $(LD) \
487 -r \
488 -o $(OBJECTS_PATH)/inbv.o \
489 $(OBJECTS_INBV)
490
491 # Note: arch.o MUST be the first file!!!
492 OBJECTS := \
493 $(OBJECTS_PATH)/arch.o \
494 $(OBJECTS_PATH)/ke.o \
495 $(OBJECTS_PATH)/cc.o \
496 $(OBJECTS_PATH)/cm.o \
497 $(OBJECTS_PATH)/dbg.o \
498 $(OBJECTS_PATH)/ex.o \
499 $(OBJECTS_PATH)/lpc.o \
500 $(OBJECTS_PATH)/fs.o \
501 $(OBJECTS_PATH)/io.o \
502 $(OBJECTS_PATH)/kd.o \
503 $(OBJECTS_PATH)/ldr.o \
504 $(OBJECTS_PATH)/mm.o \
505 $(OBJECTS_PATH)/ob.o \
506 $(OBJECTS_PATH)/po.o \
507 $(OBJECTS_PATH)/ps.o \
508 $(OBJECTS_PATH)/rtl.o \
509 $(OBJECTS_PATH)/se.o \
510 $(OBJECTS_PATH)/inbv.o \
511 $(OBJECTS_RESOURCE)
512
513 EXTRA_OBJECTS = $(PATH_TO_TOP)/include/reactos/bugcodes.h
514
515 TARGET_OBJECTS = $(EXTRA_OBJECTS) $(OBJECTS)
516
517 TARGET_LIBS = \
518 $(DDK_PATH_LIB)/libhal.a \
519 $(SDK_PATH_LIB)/librtl.a \
520 $(SDK_PATH_LIB)/librossym.a \
521 $(SDK_PATH_LIB)/libstring.a \
522 $(SDK_PATH_LIB)/librosrtl.a \
523 $(SDK_PATH_LIB)/libpseh.a \
524 $(SDK_PATH_LIB)/libwdmguid.a \
525 $(PATH_TO_TOP)/drivers/lib/csq/csq.o
526
527 TARGET_LFLAGS = \
528 -Wl,-T,ntoskrnl.lnk \
529 -Wl,--subsystem,native \
530 -Wl,--image-base,$(TARGET_BASE) \
531 -Wl,--file-alignment,0x1000 \
532 -Wl,--section-alignment,0x1000 \
533 -Wl,--entry,_NtProcessStartup \
534 -nostdlib
535
536 TARGET_GCCLIBS = gcc
537
538 TAGS: $(TAG_OBJECTS)
539 etags $(addprefix -i , $(TAG_OBJECTS))
540
541 GENERATED_HEADER_FILES := $(PATH_TO_TOP)/include/reactos/bugcodes.h
542
543 $(PATH_TO_TOP)/include/reactos/bugcodes.h bugcodes.rc: ntoskrnl.mc
544 $(MC) \
545 -H $(PATH_TO_TOP)/include/reactos/bugcodes.h \
546 -o bugcodes.rc \
547 $(TARGET_NAME).mc
548
549 TARGET_CLEAN = \
550 $(PATH_TO_TOP)/include/reactos/bugcodes.h \
551 $(DEP_OBJECTS) $(DEP_FILES) MSG00409.bin bugcodes.rc
552
553 ex/napi.o: ex/zw.S $(PATH_TO_TOP)/include/ntdll/napi.h
554
555 ke/main.o: ke/main.c $(PATH_TO_TOP)/include/reactos/buildno.h
556
557 $(TARGET_PCH): $(PATH_TO_TOP)/include/reactos/bugcodes.h
558
559
560 .%.TAG: %.S
561 etags -o $@ $<
562
563 .%.TAG: %.s
564 etags -o $@ $<
565
566 .%.TAG: %.c
567 etags -o $@ $^
568
569
570 docu:
571 doxygen Doxyfile
572
573 .PHONY: docu
574
575 include $(PATH_TO_TOP)/rules.mak
576
577 include $(TOOLS_PATH)/helper.mk
578
579 include $(TOOLS_PATH)/depend.mk