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