Correct problem with keyboard input not being accepted
[reactos.git] / reactos / ntoskrnl / Makefile
1 # $Id: Makefile,v 1.31 2001/04/10 17:48:16 dwelch Exp $
2 #
3 # ReactOS Operating System
4 #
5
6 #
7 # Path to the directory containing the root makefile
8 #
9 PATH_TO_TOP := ..
10
11 #
12 # Architecture to build for
13 #
14 ARCH := i386
15
16 #
17 # Whether to compile in the kernel debugger
18 #
19 KDBG := 1
20
21 #
22 # Whether to compile for debugging
23 #
24 DBG := 1
25
26 #
27 # Whether to compile a multiprocessor or single processor version
28 #
29 MP := 0
30
31 #
32 #
33 #
34 CONFIG :=
35
36 ifeq ($(DBG), 1)
37 CFLAGS_DBG := -g
38 CONFIG += DBG
39 else
40 CFLAGS_DBG :=
41 endif
42
43 ifeq ($(KDBG), 1)
44 OBJECTS_KDBG := dbg/kdb.o dbg/kdb_keyboard.o dbg/i386/kdb_help.o
45 CONFIG += KDBG
46 else
47 OBJECTS_KDBG :=
48 endif
49
50 ifeq ($(MP), 1)
51 CONFIG += MP
52 else
53 CONFIG += UP
54 endif
55
56 TARGETNAME := ntoskrnl
57
58 OBJECTS_PATH = objects
59
60 ASFLAGS = -Iinclude
61 CFLAGS = -Iinclude -D__NTOSKRNL__ $(CFLAGS_DBG) -Wall -Werror
62
63 include $(PATH_TO_TOP)/rules.mak
64
65 all: config $(EXE_PREFIX)depends$(EXE_POSTFIX) \
66 $(OBJECTS_PATH) \
67 $(TARGETNAME).nostrip.exe \
68 $(TARGETNAME).exe \
69 $(TARGETNAME).sym
70
71 $(EXE_PREFIX)depends$(EXE_POSTFIX): depends.c
72 $(HOST_CC) -o depends$(EXE_POSTFIX) depends.c
73
74 #
75 # Hardware Abstraction Layer (Hal)
76 # Defines $(OBJECTS_HAL)
77 #
78 include hal/x86/sources
79
80 #
81 # Architecture specific Makefile
82 # Defines $(OBJECTS_ARCH)
83 #
84 include Makefile.$(ARCH)
85
86 # System API (Nt/Zw)
87 OBJECTS_NT = \
88 nt/atom.o \
89 nt/channel.o \
90 nt/evtpair.o \
91 nt/mutant.o \
92 nt/misc.o \
93 nt/nt.o \
94 nt/ntevent.o \
95 nt/ntsem.o \
96 nt/nttimer.o \
97 nt/plugplay.o \
98 nt/profile.o \
99 nt/zw.o \
100 nt/vdm.o
101
102 # Run-Time Library (Rtl)
103 OBJECTS_RTL = \
104 rtl/bitmap.o \
105 rtl/ctype.o \
106 rtl/error.o \
107 rtl/interlck.o \
108 rtl/largeint.o \
109 rtl/mem.o \
110 rtl/memchr.o \
111 rtl/memcpy.o \
112 rtl/memmove.o \
113 rtl/memset.o \
114 rtl/nls.o \
115 rtl/qsort.o \
116 rtl/regio.o \
117 rtl/sprintf.o \
118 rtl/stdlib.o \
119 rtl/string.o \
120 rtl/swprintf.o \
121 rtl/time.o \
122 rtl/unicode.o \
123 rtl/wstring.o \
124 rtl/bitops.o \
125 rtl/memcmp.o
126
127 # Kernel (Ke)
128 # Note: head.o MUST be the first file!!!
129 OBJECTS_KE = \
130 ke/apc.o \
131 ke/bug.o \
132 ke/catch.o \
133 ke/critical.o \
134 ke/dpc.o \
135 ke/error.o \
136 ke/event.o \
137 ke/kqueue.o \
138 ke/main.o \
139 ke/mutex.o \
140 ke/process.o \
141 ke/sem.o \
142 ke/spinlock.o \
143 ke/timer.o \
144 ke/wait.o \
145 ke/kthread.o
146
147 # Memory Manager (Mm)
148 OBJECTS_MM = \
149 mm/aspace.o \
150 mm/cont.o \
151 mm/freelist.o \
152 mm/iospace.o \
153 mm/marea.o \
154 mm/mdl.o \
155 mm/mm.o \
156 mm/ncache.o \
157 mm/npool.o \
158 mm/pagfault.o \
159 mm/pagefile.o \
160 mm/paging.o \
161 mm/pool.o \
162 mm/ppool.o \
163 mm/section.o \
164 mm/virtual.o \
165 mm/pager.o \
166 mm/wset.o \
167 mm/mminit.o \
168 mm/kmap.o \
169 mm/mpw.o \
170 mm/pageop.o
171
172 # I/O Subsystem (Io)
173 OBJECTS_IO = \
174 io/adapter.o \
175 io/buildirp.o \
176 io/cancel.o \
177 io/cleanup.o \
178 io/cntrller.o \
179 io/create.o \
180 io/device.o \
181 io/dir.o \
182 io/drvlck.o \
183 io/errlog.o \
184 io/error.o \
185 io/event.o \
186 io/file.o \
187 io/flush.o \
188 io/fs.o \
189 io/iocomp.o \
190 io/ioctrl.o \
191 io/iomgr.o \
192 io/irp.o \
193 io/lock.o \
194 io/mailslot.o \
195 io/mdl.o \
196 io/npipe.o \
197 io/page.o \
198 io/process.o \
199 io/queue.o \
200 io/resource.o \
201 io/rw.o \
202 io/share.o \
203 io/shutdown.o \
204 io/symlink.o \
205 io/timer.o \
206 io/vpb.o \
207 io/xhaldisp.o \
208 io/xhaldrv.o
209
210 # Object Manager (Ob)
211 OBJECTS_OB = \
212 ob/dirobj.o \
213 ob/handle.o \
214 ob/namespc.o \
215 ob/ntobj.o \
216 ob/object.o \
217 ob/security.o
218
219 # Process Manager (Ps)
220 OBJECTS_PS = \
221 ps/create.o \
222 ps/idle.o \
223 ps/kill.o \
224 ps/process.o \
225 ps/psmgr.o \
226 ps/thread.o \
227 ps/tinfo.o \
228 ps/debug.o \
229 ps/suspend.o
230
231 # Executive Subsystem (Ex)
232 OBJECTS_EX = \
233 ex/callback.o \
234 ex/fmutex.o \
235 ex/init.o \
236 ex/interlck.o \
237 ex/list.o \
238 ex/locale.o \
239 ex/lookas.o \
240 ex/napi.o \
241 ex/power.o \
242 ex/resource.o \
243 ex/time.o \
244 ex/sysinfo.o \
245 ex/work.o \
246 ex/zone.o
247
248 # Installable File System Run-Time Library (FsRtl)
249 OBJECTS_FS = \
250 fs/dbcsname.o \
251 fs/filelock.o \
252 fs/mcb.o \
253 fs/mdl.o \
254 fs/name.o \
255 fs/notify.o \
256 fs/oplock.o \
257 fs/pool.o \
258 fs/tunnel.o \
259 fs/unc.o \
260 fs/util.o
261
262 # Security Subsystem
263 OBJECTS_SE = \
264 se/access.o \
265 se/acl.o \
266 se/luid.o \
267 se/priv.o \
268 se/sd.o \
269 se/semgr.o \
270 se/sid.o \
271 se/token.o
272
273 # Configuration Manager (Registry)
274 OBJECTS_CM = \
275 cm/registry.o
276
277 # Debugger Support (Dbg)
278 OBJECTS_DBG = \
279 dbg/dbgctrl.o \
280 dbg/errinfo.o \
281 dbg/print.o \
282 dbg/user.o \
283 $(OBJECTS_KDBG)
284
285 # Loader
286 OBJECTS_LDR = \
287 ldr/init.o \
288 ldr/loader.o \
289 ldr/resource.o \
290 ldr/rtl.o \
291 ldr/sysdll.o \
292 ldr/userldr.o
293
294 # Local Procedure Call (Lpc)
295 OBJECTS_LPC = \
296 lpc/close.o \
297 lpc/complete.o \
298 lpc/connect.o \
299 lpc/create.o \
300 lpc/listen.o \
301 lpc/port.o \
302 lpc/query.o \
303 lpc/queue.o \
304 lpc/receive.o \
305 lpc/reply.o \
306 lpc/send.o
307
308 # Nation Language Support Library (Nls)
309 OBJECTS_NLS = nls/nls.o
310
311 # Power Management (Po)
312 OBJECTS_PO = po/power.o
313
314 # Cache Manager (Cc)
315 OBJECTS_CC = \
316 cc/cacheman.o \
317 cc/view.o
318
319 # Kernel Debugger Support (Kd)
320 OBJECTS_KD = \
321 kd/kdebug.o \
322 kd/service.o \
323 kd/dlog.o
324
325 C_OBJECTS := $(OBJECTS_NT) $(OBJECTS_HAL) $(OBJECTS_MM) $(OBJECTS_ARCH) \
326 $(OBJECTS_IO) $(OBJECTS_KE) $(OBJECTS_OB) \
327 $(OBJECTS_PS) $(OBJECTS_EX) $(OBJECTS_CC) $(OBJECTS_FS) $(OBJECTS_SE) \
328 $(OBJECTS_DBG) $(OBJECTS_CM) $(OBJECTS_LDR) $(OBJECTS_LPC) \
329 $(OBJECTS_PO) $(OBJECTS_KD) $(OBJECTS_RTL)
330
331 D_FILES := $(filter-out ex/napi.%, $(filter-out nt/zw.%, $(C_OBJECTS:.o=.d)))
332 D1_FILES := $(join $(dir $(D_FILES)), $(addprefix ., $(notdir $(D_FILES))))
333
334 # Resources
335 OBJECTS_RESOURCE = \
336 $(TARGETNAME).coff
337
338 # IMPORTS/EXPORTS
339 IE_DATA = \
340 $(TARGETNAME).def \
341 $(TARGETNAME).edf
342
343 $(OBJECTS_PATH):
344 mkdir $(OBJECTS_PATH)
345
346 #
347 # Build subsystem intermediate objects
348 #
349 $(OBJECTS_PATH)/hal.o: $(OBJECTS_HAL)
350 $(LD) \
351 -r \
352 -o $(OBJECTS_PATH)/hal.o \
353 $(OBJECTS_HAL)
354
355 $(OBJECTS_PATH)/arch.o: $(OBJECTS_ARCH)
356 $(LD) -r -o $(OBJECTS_PATH)/arch.o $(OBJECTS_ARCH)
357
358 $(OBJECTS_PATH)/io.o: $(OBJECTS_IO)
359 $(LD) \
360 -r \
361 -o $(OBJECTS_PATH)/io.o \
362 $(OBJECTS_IO)
363
364 $(OBJECTS_PATH)/ke.o: $(OBJECTS_KE)
365 $(LD) \
366 -r \
367 -o $(OBJECTS_PATH)/ke.o \
368 $(OBJECTS_KE)
369
370 $(OBJECTS_PATH)/rtl.o: $(OBJECTS_RTL)
371 $(LD) \
372 -r \
373 -o $(OBJECTS_PATH)/rtl.o \
374 $(OBJECTS_RTL)
375
376 $(OBJECTS_PATH)/mm.o: $(OBJECTS_MM)
377 $(LD) \
378 -r \
379 -o $(OBJECTS_PATH)/mm.o \
380 $(OBJECTS_MM)
381
382 $(OBJECTS_PATH)/ob.o: $(OBJECTS_OB)
383 $(LD) \
384 -r \
385 -o $(OBJECTS_PATH)/ob.o \
386 $(OBJECTS_OB)
387
388 $(OBJECTS_PATH)/ps.o: $(OBJECTS_PS)
389 $(LD) \
390 -r \
391 -o $(OBJECTS_PATH)/ps.o \
392 $(OBJECTS_PS)
393
394 $(OBJECTS_PATH)/ex.o: $(OBJECTS_EX)
395 $(LD) \
396 -r \
397 -o $(OBJECTS_PATH)/ex.o \
398 $(OBJECTS_EX)
399
400 $(OBJECTS_PATH)/fs.o: $(OBJECTS_FS)
401 $(LD) \
402 -r \
403 -o $(OBJECTS_PATH)/fs.o \
404 $(OBJECTS_FS)
405
406 $(OBJECTS_PATH)/se.o: $(OBJECTS_SE)
407 $(LD) \
408 -r \
409 -o $(OBJECTS_PATH)/se.o \
410 $(OBJECTS_SE)
411
412 $(OBJECTS_PATH)/cm.o: $(OBJECTS_CM)
413 $(LD) \
414 -r \
415 -o $(OBJECTS_PATH)/cm.o \
416 $(OBJECTS_CM)
417
418 $(OBJECTS_PATH)/dbg.o: $(OBJECTS_DBG)
419 $(LD) \
420 -r \
421 -o $(OBJECTS_PATH)/dbg.o \
422 $(OBJECTS_DBG)
423
424 $(OBJECTS_PATH)/ldr.o: $(OBJECTS_LDR)
425 $(LD) \
426 -r \
427 -o $(OBJECTS_PATH)/ldr.o \
428 $(OBJECTS_LDR)
429
430 $(OBJECTS_PATH)/lpc.o: $(OBJECTS_LPC)
431 $(LD) \
432 -r \
433 -o $(OBJECTS_PATH)/lpc.o \
434 $(OBJECTS_LPC)
435
436 $(OBJECTS_PATH)/nls.o: $(OBJECTS_NLS)
437 $(LD) \
438 -r \
439 -o $(OBJECTS_PATH)/nls.o \
440 $(OBJECTS_NLS)
441
442 $(OBJECTS_PATH)/nt.o: $(OBJECTS_NT)
443 $(LD) \
444 -r \
445 -o $(OBJECTS_PATH)/nt.o \
446 $(OBJECTS_NT)
447
448 $(OBJECTS_PATH)/po.o: $(OBJECTS_PO)
449 $(LD) \
450 -r \
451 -o $(OBJECTS_PATH)/po.o \
452 $(OBJECTS_PO)
453
454 $(OBJECTS_PATH)/cc.o: $(OBJECTS_CC)
455 $(LD) \
456 -r \
457 -o $(OBJECTS_PATH)/cc.o \
458 $(OBJECTS_CC)
459
460 $(OBJECTS_PATH)/kd.o: $(OBJECTS_KD)
461 $(LD) \
462 -r \
463 -o $(OBJECTS_PATH)/kd.o \
464 $(OBJECTS_KD)
465
466 $(TARGETNAME).coff: $(TARGETNAME).rc ../include/reactos/resource.h
467
468
469 # Note: ke.o MUST be the first file!!!
470 OBJECTS := \
471 $(OBJECTS_PATH)/arch.o \
472 $(OBJECTS_PATH)/ke.o \
473 $(OBJECTS_PATH)/hal.o \
474 $(OBJECTS_PATH)/cc.o \
475 $(OBJECTS_PATH)/cm.o \
476 $(OBJECTS_PATH)/dbg.o \
477 $(OBJECTS_PATH)/ex.o \
478 $(OBJECTS_PATH)/lpc.o \
479 $(OBJECTS_PATH)/fs.o \
480 $(OBJECTS_PATH)/io.o \
481 $(OBJECTS_PATH)/kd.o \
482 $(OBJECTS_PATH)/ldr.o \
483 $(OBJECTS_PATH)/mm.o \
484 $(OBJECTS_PATH)/nls.o \
485 $(OBJECTS_PATH)/nt.o \
486 $(OBJECTS_PATH)/ob.o \
487 $(OBJECTS_PATH)/po.o \
488 $(OBJECTS_PATH)/ps.o \
489 $(OBJECTS_PATH)/rtl.o \
490 $(OBJECTS_PATH)/se.o \
491 $(OBJECTS_RESOURCE)
492
493
494 ifeq ($(DOSCLI),yes)
495 CLEAN_FILES = $(OBJECTS_PATH)\*.o cc\*.o cm\*.o dbg\*.o ex\*.o hal\x86\*.o io\*.o \
496 ke\*.o ldr\*.o mm\*.o nt\*.o ob\*.o ps\*.o rtl\*.o se\*.o \
497 ke\i386\*.o mm\i386\*.o fs\*.o po\*.o nls\*.o lpc\*.o \
498 kd\*.o $(TARGETNAME).o $(TARGETNAME).a junk.tmp base.tmp temp.exp \
499 $(TARGETNAME).exe $(TARGETNAME).nostrip.exe $(TARGETNAME).sym $(TARGETNAME).coff $(D1_FILES)
500 else
501 CLEAN_FILES = $(OBJECTS_PATH)/*.o cc/*.o cm/*.o dbg/*.o ex/*.o hal/x86/*.o io/*.o \
502 ke/*.o ldr/*.o mm/*.o nt/*.o ob/*.o ps/*.o rtl/*.o se/*.o \
503 ke/i386/*.o mm/i386/*.o fs/*.o po/*.o nls/*.o lpc/*.o \
504 kd/*.o $(TARGETNAME).o $(TARGETNAME).a junk.tmp base.tmp temp.exp \
505 $(TARGETNAME).exe $(TARGETNAME).nostrip.exe $(TARGETNAME).sym $(TARGETNAME).coff $(D1_FILES)
506 endif
507
508
509 $(TARGETNAME).nostrip.exe: $(TARGETNAME).o $(TARGETNAME).a $(IE_DATA)
510 $(CC) \
511 -Wl,-T,ntoskrnl.lnk \
512 -nostartfiles -nostdlib \
513 -mdll \
514 -o junk.tmp \
515 -Wl,--subsystem,native \
516 -Wl,--image-base,0xc0000000 \
517 -Wl,--file-alignment,0x1000 \
518 -Wl,--section-alignment,0x1000 \
519 -Wl,--base-file,base.tmp \
520 $(TARGETNAME).o -lgcc
521 - $(RM) junk.tmp
522 $(DLLTOOL) \
523 --dllname $(TARGETNAME).exe \
524 --base-file base.tmp \
525 --output-exp temp.exp \
526 --def $(TARGETNAME).edf \
527 --kill-at
528 - $(RM) base.tmp
529 $(CC) \
530 -nostartfiles -nostdlib \
531 -Wl,-T,ntoskrnl.lnk \
532 -mdll \
533 -o $(TARGETNAME).nostrip.exe \
534 -Wl,--subsystem,native \
535 -Wl,--image-base,0xc0000000 \
536 -Wl,--file-alignment,0x1000 \
537 -Wl,--section-alignment,0x1000 \
538 -Wl,temp.exp \
539 $(TARGETNAME).o -lgcc
540 - $(RM) temp.exp
541
542 $(TARGETNAME).exe: $(TARGETNAME).o $(TARGETNAME).a
543 $(CC) \
544 -Wl,-T,ntoskrnl.lnk \
545 -nostartfiles -nostdlib \
546 -mdll \
547 -o junk.tmp \
548 -Wl,--subsystem,native \
549 -Wl,--image-base,0xc0000000 \
550 -Wl,--file-alignment,0x1000 \
551 -Wl,--section-alignment,0x1000 \
552 -Wl,--base-file,base.tmp \
553 $(TARGETNAME).o -lgcc
554 - $(RM) junk.tmp
555 $(DLLTOOL) \
556 --dllname $(TARGETNAME).exe \
557 --base-file base.tmp \
558 --output-exp temp.exp \
559 --def $(TARGETNAME).edf \
560 --kill-at
561 - $(RM) base.tmp
562 $(CC) \
563 -Wl,-T,ntoskrnl.lnk -Wl,-s\
564 -nostartfiles -nostdlib \
565 -mdll \
566 -o $(TARGETNAME).exe \
567 -Wl,--subsystem,native \
568 -Wl,--image-base,0xc0000000 \
569 -Wl,--file-alignment,0x1000 \
570 -Wl,--section-alignment,0x1000 \
571 -Wl,temp.exp \
572 $(TARGETNAME).o -lgcc
573 - $(RM) temp.exp
574
575 $(TARGETNAME).sym: $(TARGETNAME).nostrip.exe
576 $(NM) --numeric-sort $(TARGETNAME).nostrip.exe > $(TARGETNAME).sym
577
578 $(TARGETNAME).o: $(OBJECTS)
579 $(LD) \
580 -r \
581 -o $(TARGETNAME).o \
582 $(OBJECTS)
583
584 $(TARGETNAME).a: $(TARGETNAME).def
585 $(DLLTOOL) \
586 --dllname $(TARGETNAME).exe \
587 --def $(TARGETNAME).def \
588 --output-lib $(TARGETNAME).a \
589 --kill-at
590
591 clean: $(CLEAN_FILES:%=%_clean)
592
593 $(CLEAN_FILES:%=%_clean): %_clean:
594 - $(RM) $*
595
596 .PHONY: clean $(CLEAN_FILES:%=%_clean)
597
598 install: $(FLOPPY_DIR)/$(TARGETNAME).exe
599
600 $(FLOPPY_DIR)/$(TARGETNAME).exe: $(TARGETNAME).exe
601 $(CP) $(TARGETNAME).exe $(FLOPPY_DIR)/$(TARGETNAME).exe
602
603 .PHONY: install
604
605 dist: ../$(DIST_DIR)/$(TARGETNAME).exe
606
607 ../$(DIST_DIR)/$(TARGETNAME).exe: $(TARGETNAME).exe
608 $(CP) $(TARGETNAME).exe ../$(DIST_DIR)/$(TARGETNAME).exe
609
610 .PHONY: dist
611
612 ex/napi.o: ex/napi.c ../include/ntdll/napi.h
613
614 ke/main.o: ke/main.c ../include/reactos/buildno.h
615
616 mkconfig$(EXE_SUFFIX): mkconfig.c
617 $(HOST_CC) -g -o mkconfig$(EXE_SUFFIX) mkconfig.c
618
619 config:
620 $(EXE_PREFIX)mkconfig$(EXE_SUFFIX) include/internal/config.h $(CONFIG)
621
622 .PHONY: config
623
624 include $(D1_FILES)
625
626 .%.d: %.c $(EXE_PREFIX)depends$(EXE_POSTFIX)
627 $(CC) $(CFLAGS) -M $< | $(EXE_PREFIX)depends$(EXE_POSTFIX) $(@D) $@
628
629 .%.d: %.s
630 $(CC) $(CFLAGS) -M $< | $(EXE_PREFIX)depends$(EXE_POSTFIX) $(@D) $@
631
632 .%.d: %.S
633 $(CC) $(CFLAGS) -M $< | $(EXE_PREFIX)depends$(EXE_POSTFIX) $(@D) $@
634
635
636
637 # EOF