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