bfcb320d1b31cd452a8ef6e40bf4887eaabbf6e1
[reactos.git] / reactos / lib / kernel32 / makefile
1 # $Id: makefile,v 1.36 2000/08/11 12:32:04 ekohl Exp $
2 #
3 # ReactOS Operating System
4 #
5 TARGET=kernel32
6
7 KERNEL32_BASE = 0x77f00000
8
9 BASE_CFLAGS = -I../../include
10
11 CFLAGS = $(CFLAGS) -DKERNEL32_BASE=$(KERNEL32_BASE)
12
13 include ../../rules.mak
14 ifneq ($(HOST),mingw32-windows)
15 ifneq ($(HOST),mingw32-linux)
16 DLLTARGET=$(TARGET).a
17 else
18 DLLTARGET=$(TARGET).dll
19 endif
20 else
21 DLLTARGET=$(TARGET).dll
22 endif
23
24 all: $(DLLTARGET)
25
26 SYNCH_OBJECTS = synch/critical.o synch/event.o synch/wait.o synch/intrlck.o synch/timer.o
27
28 MISC_OBJECTS = misc/error.o misc/atom.o misc/handle.o misc/env.o misc/dllmain.o \
29 misc/console.o misc/time.o misc/stubs.o misc/rtl.o misc/ldr.o misc/res.o \
30 misc/debug.o misc/sysinfo.o
31
32 FILE_OBJECTS = file/file.o file/curdir.o file/lfile.o file/dir.o \
33 file/iocompl.o file/volume.o file/deviceio.o file/dosdev.o \
34 file/create.o file/find.o file/copy.o file/pipe.o \
35 file/move.o file/lock.o file/rw.o file/delete.o \
36 file/npipe.o
37
38 MEM_OBJECTS = mem/virtual.o mem/heap.o mem/utils.o mem/section.o mem/isbad.o mem/procmem.o
39
40 NLS_OBJECTS = nls/codepage.o nls/cpmisc.o nls/cptable.o\
41 nls/cp37.o nls/cp437.o nls/cp500.o nls/cp737.o nls/cp775.o nls/cp850.o nls/cp852.o nls/cp855.o nls/cp857.o\
42 nls/cp860.o nls/cp861.o nls/cp863.o nls/cp865.o nls/cp866.o nls/cp869.o nls/cp875.o nls/cp1026.o\
43 nls/cp1250.o nls/cp1251.o nls/cp1252.o nls/cp1253.o nls/cp1254.o nls/cp1255.o nls/cp1256.o nls/cp1257.o\
44 nls/cp10000.o nls/cp10006.o nls/cp10007.o nls/cp10029.o nls/cp10079.o nls/cp10081.o\
45 nls/lctable.o\
46 nls/lcAFK.o nls/lcBEL.o nls/lcBGR.o nls/lcCAT.o nls/lcCSY.o nls/lcDAN.o\
47 nls/lcDEA.o nls/lcDEC.o nls/lcDEL.o nls/lcDES.o nls/lcDEU.o\
48 nls/lcELL.o\
49 nls/lcENA.o nls/lcENB.o nls/lcENC.o nls/lcENG.o nls/lcENI.o nls/lcENJ.o nls/lcENL.o nls/lcENS.o nls/lcENT.o\
50 nls/lcENU.o nls/lcENZ.o\
51 nls/lcESA.o nls/lcESB.o nls/lcESC.o nls/lcESD.o nls/lcESE.o nls/lcESF.o nls/lcESG.o nls/lcESH.o nls/lcESI.o\
52 nls/lcESL.o nls/lcESM.o nls/lcESN.o nls/lcESO.o nls/lcESP.o nls/lcESR.o nls/lcESS.o nls/lcESU.o nls/lcESV.o\
53 nls/lcESY.o nls/lcESZ.o\
54 nls/lcETI.o nls/lcEUQ.o nls/lcFIN.o nls/lcFOS.o\
55 nls/lcFRA.o nls/lcFRB.o nls/lcFRC.o nls/lcFRL.o nls/lcFRS.o\
56 nls/lcHRV.o nls/lcHUN.o nls/lcIND.o nls/lcISL.o nls/lcITA.o nls/lcITS.o nls/lcLTH.o nls/lcLVI.o nls/lcNLB.o\
57 nls/lcNLD.o nls/lcNON.o nls/lcNOR.o nls/lcPLK.o nls/lcPTB.o nls/lcPTG.o nls/lcROM.o nls/lcRUS.o nls/lcSKY.o\
58 nls/lcSLV.o nls/lcSQI.o nls/lcSRB.o nls/lcSRL.o nls/lcSVE.o nls/lcSVF.o nls/lcTRK.o nls/lcUKR.o\
59 nls/locale.o nls/mbtowc.o nls/wctomb.o nls/ole2nls.o
60
61 THREAD_OBJECTS = thread/thread.o thread/tls.o
62
63 PROCESS_OBJECTS = \
64 process/proc.o \
65 process/cmdline.o \
66 process/create.o
67
68 STRING_OBJECTS = string/lstring.o
69
70 EXCEPT_OBJECTS = except/except.o
71
72 RESOURCE_OBJECT = $(TARGET).coff
73
74
75 OBJECTS = $(MISC_OBJECTS) $(FILE_OBJECTS) $(THREAD_OBJECTS) \
76 $(PROCESS_OBJECTS) $(STRING_OBJECTS) $(MEM_OBJECTS) \
77 $(SYNCH_OBJECTS) $(EXCEPT_OBJECTS) $(RESOURCE_OBJECT)
78
79 ifeq ($(DOSCLI),yes)
80 CLEAN_FILES = except\*.o file\*.o mem\*.o misc\*.o nls\*.o \
81 process\*.o string\*.o synch\*.o thread\*.o \
82 $(TARGET).o $(TARGET).a junk.tmp base.tmp temp.exp \
83 $(TARGET).dll $(TARGET).sym $(TARGET).coff
84 else
85 CLEAN_FILES = except/*.o file/*.o mem/*.o misc/*.o nls/*.o \
86 process/*.o string/*.o synch/*.o thread/*.o \
87 $(TARGET).o $(TARGET).a junk.tmp base.tmp temp.exp \
88 $(TARGET).dll $(TARGET).sym $(TARGET).coff
89 endif
90
91 nls/ole2nls.o: nls/ole2nls.c
92 $(CC) $(CFLAGS) -I. nls/ole2nls.c
93
94 $(TARGET).coff: $(TARGET).rc ../../include/reactos/resource.h
95
96 $(TARGET).a: $(OBJECTS)
97 $(AR) csr $(TARGET).a $(OBJECTS)
98
99 $(TARGET).dll: $(DLLMAIN) $(OBJECTS) $(TARGET).def
100 $(LD) \
101 -r $(OBJECTS) \
102 -o $(TARGET).o
103 $(DLLTOOL) \
104 --dllname $(TARGET).dll \
105 --def $(TARGET).def \
106 --kill-at \
107 --output-lib $(TARGET).a
108 $(CC) \
109 -specs=k32_specs \
110 -mdll \
111 -o junk.tmp \
112 -Wl,--base-file,base.tmp \
113 $(TARGET).o \
114 ../ntdll/ntdll.a
115 - $(RM) junk.tmp
116 $(DLLTOOL) \
117 --dllname $(TARGET).dll \
118 --base-file base.tmp \
119 --output-exp temp.exp \
120 --def $(TARGET).edf
121 - $(RM) base.tmp
122 $(CC) \
123 -specs=k32_specs \
124 -mdll \
125 -o $(TARGET).dll \
126 $(TARGET).o \
127 ../ntdll/ntdll.a \
128 -Wl,--image-base,$(KERNEL32_BASE) \
129 -Wl,--file-alignment,0x1000 \
130 -Wl,--section-alignment,0x1000 \
131 -Wl,temp.exp
132 - $(RM) temp.exp
133 $(NM) --numeric-sort $(TARGET).dll > $(TARGET).sym
134
135 clean: $(CLEAN_FILES:%=%_clean)
136
137 $(CLEAN_FILES:%=%_clean): %_clean:
138 - $(RM) $*
139
140 .PHONY: clean $(CLEAN_FILES:%=%_clean)
141
142 install: $(FLOPPY_DIR)/dlls/$(TARGET).dll
143
144 $(FLOPPY_DIR)/dlls/$(TARGET).dll: $(TARGET).dll
145 ifeq ($(DOSCLI),yes)
146 $(CP) $(TARGET).dll $(FLOPPY_DIR)\dlls\$(TARGET).dll
147 else
148 $(CP) $(TARGET).dll $(FLOPPY_DIR)/dlls/$(TARGET).dll
149 endif
150
151 dist: $(DIST_DIR)/dlls/$(TARGET).dll
152
153 $(DIST_DIR)/dlls/$(TARGET).dll: $(TARGET).dll
154 ifeq ($(DOSCLI),yes)
155 $(CP) $(TARGET).dll ..\..\$(DIST_DIR)\dlls\$(TARGET).dll
156 else
157 $(CP) $(TARGET).dll ../../$(DIST_DIR)/dlls/$(TARGET).dll
158 endif
159
160 WARNINGS_ARE_ERRORS = yes
161