6df015fc31ec4d53ab91556ebdff39c8f057c0cc
[reactos.git] / reactos / lib / ntdll / makefile
1
2 IMAGE_BASE = 0x77f60000
3
4 ifneq ($(HOST),mingw32-windows)
5 ifneq ($(HOST),mingw32-linux)
6 DLLTARGET=ntdll.a
7 DLLMAIN=
8 else
9 DLLTARGET=ntdll.dll
10 DLLMAIN=main/dllmain.o
11 endif
12 else
13 DLLTARGET=ntdll.dll
14 DLLMAIN=main/dllmain.o
15 endif
16
17 all: $(DLLTARGET)
18
19 STDLIB_OBJECTS = stdlib/atoi.o stdlib/atol.o stdlib/splitp.o \
20 stdlib/strtol.o stdlib/strtoul.o
21
22 STRING_OBJECTS = string/ctype.o string/memcpy.o string/memmove.o \
23 string/memset.o string/strcat.o string/strchr.o \
24 string/strcmp.o string/strcspn.o \
25 string/strcpy.o string/stricmp.o string/strlen.o string/strlwr.o \
26 string/strncat.o string/strncmp.o string/strncpy.o \
27 string/strnicmp.o string/strnlen.o string/strrchr.o \
28 string/strstr.o string/strupr.o string/wstring.o
29
30 OBJECTS = napi.o ldr/startup.o rtl/largeint.o rtl/namespc.o rtl/unicode.o \
31 stdio/vsprintf.o $(STDLIB_OBJECTS) $(STRING_OBJECTS) \
32 stubs/stubs.o rtl/heap.o rtl/critical.o rtl/mem.o \
33 ldr/utils.o ntdll.coff
34
35 ifeq ($(DOSCLI),yes)
36 CLEAN_FILES = napi.o ldr\*.o rtl\*.o stdio\*.o stdlib\*.o string\*.o stubs\*.o \
37 ntdll.a main\dllmain.o ntdll.o ntdll.dll junk.tmp base.tmp temp.exp ntdll.sym
38 else
39 CLEAN_FILES = napi.o ldr/*.o rtl/*.o stdio/*.o stdlib/*.o string/*.o stubs/*.o \
40 ntall.a main/dllmain.o ntdll.o ntdll.dll junk.tmp base.tmp temp.exp ntdll.sym
41 endif
42
43 ntdll.coff: ntdll.rc ../../include/reactos/resource.h
44 $(RC) ntdll.rc ntdll.coff
45
46 ntdll.a: $(OBJECTS)
47 $(AR) csr ntdll.a $(OBJECTS)
48
49 ntdll.dll: $(DLLMAIN) $(OBJECTS) def/ntdll.def
50 $(LD) -r $(DLLMAIN) $(OBJECTS) -o ntdll.o
51 $(DLLTOOL) --dllname ntdll.dll --def def/ntdll.def \
52 --output-lib ntdll.a --add-stdcall-alias \
53 --kill-at
54 $(CC) -specs=ntdll_specs -mdll -o junk.tmp \
55 -Wl,--base-file,base.tmp ntdll.o
56 - $(RM) junk.tmp
57 $(DLLTOOL) --dllname ntdll.dll --base-file base.tmp \
58 --output-exp temp.exp --def def/ntdll.def \
59 --add-stdcall-alias --kill-at
60 - $(RM) base.tmp
61 $(CC) -specs=ntdll_specs -mdll -o ntdll.dll ntdll.o \
62 -Wl,--entry=_LdrStartup \
63 -Wl,--image-base,$(IMAGE_BASE) \
64 -Wl,--file-alignment,0x1000 \
65 -Wl,--section-alignment,0x1000 \
66 -Wl,temp.exp
67 - $(RM) temp.exp
68 $(NM) --numeric-sort ntdll.dll > ntdll.sym
69
70 clean: $(CLEAN_FILES:%=%_clean)
71
72 $(CLEAN_FILES:%=%_clean): %_clean:
73 - $(RM) $*
74
75 .PHONY: clean $(CLEAN_FILES:%=%_clean)
76
77 #WARNINGS_ARE_ERRORS = yes
78 include ../../rules.mak
79