7d02ac7aa2109f4b8df08c4376b45ab26db2671f
[reactos.git] / reactos / drivers / net / ndis / Makefile
1 # NDIS.SYS - NDIS library
2
3 TARGETNAME=ndis
4
5 BASE_CFLAGS = -I./include -I../../../include -DNDIS_WRAPPER -DBINARY_COMPATIBLE=1
6
7 RESOURCE_OBJECT = $(TARGETNAME).coff
8 NDIS_OBJECTS = ndis/main.o ndis/40gone.o ndis/50gone.o ndis/buffer.o ndis/cl.o \
9 ndis/cm.o ndis/co.o ndis/control.o ndis/hardware.o \
10 ndis/io.o ndis/memory.o ndis/miniport.o \
11 ndis/protocol.o ndis/string.o ndis/stubs.o ndis/time.o
12
13 all: objects $(TARGETNAME).sys
14
15 objects:
16 mkdir objects
17
18 $(TARGETNAME).coff: $(TARGETNAME).rc ../../../include/reactos/resource.h
19
20 OBJECTS = $(NDIS_OBJECTS) $(RESOURCE_OBJECT) ../../../ntoskrnl/ntoskrnl.a
21
22
23 ifeq ($(DOSCLI),yes)
24 CLEAN_FILES = *.o objects\*.o ndis\*.o $(TARGETNAME).coff $(TARGETNAME).o $(TARGETNAME).a \
25 junk.tmp base.tmp temp.exp $(TARGETNAME).sys $(TARGETNAME).sym
26 else
27 CLEAN_FILES = *.o objects/*.o ndis/*.o $(TARGETNAME).coff $(TARGETNAME).o $(TARGETNAME).a \
28 junk.tmp base.tmp temp.exp $(TARGETNAME).sys $(TARGETNAME).sym
29 endif
30
31 $(TARGETNAME).sys: $(OBJECTS)
32 $(DLLTOOL) \
33 --dllname $(TARGETNAME).sys \
34 --def $(TARGETNAME).def \
35 --kill-at \
36 --output-lib $(TARGETNAME).a
37 $(CC) \
38 -mdll \
39 -specs=../../svc_specs \
40 -Wl,-e,_DriverEntry@8 \
41 -Wl,--base-file,base.tmp \
42 -Wl,--defsym,_end=end \
43 -Wl,--defsym,_edata=__data_end__ \
44 -Wl,--defsym,_etext=etext \
45 $(OBJECTS) \
46 -o junk.tmp
47 - $(RM) junk.tmp
48 $(DLLTOOL) \
49 --dllname $(TARGETNAME).sys \
50 --base-file base.tmp \
51 --output-exp temp.exp \
52 --def $(TARGETNAME).edf
53 - $(RM) base.tmp
54 $(CC) \
55 -mdll \
56 -specs=../../svc_specs \
57 -Wl,--image-base,0x10000 \
58 -Wl,-e,_DriverEntry@8 \
59 -Wl,temp.exp \
60 $(OBJECTS) \
61 -o $(TARGETNAME).sys
62 - $(RM) temp.exp
63 $(NM) --numeric-sort $(TARGETNAME).sys > $(TARGETNAME).sym
64
65 clean: $(CLEAN_FILES:%=%_clean)
66
67 $(CLEAN_FILES:%=%_clean): %_clean:
68 - $(RM) $*
69
70 .PHONY: clean $(CLEAN_FILES:%=%_clean)
71
72 install: $(FLOPPY_DIR)/drivers/$(TARGETNAME).sys
73
74 $(FLOPPY_DIR)/drivers/$(TARGETNAME).sys: $(TARGETNAME).sys
75 ifeq ($(DOSCLI),yes)
76 $(CP) $(TARGETNAME).sys $(FLOPPY_DIR)\drivers\$(TARGETNAME).sys
77 else
78 $(CP) $(TARGETNAME).sys $(FLOPPY_DIR)/drivers/$(TARGETNAME).sys
79 endif
80
81 dist: $(DIST_DIR)/drivers/$(TARGETNAME).sys
82
83 $(DIST_DIR)/drivers/$(TARGETNAME).sys: $(TARGETNAME).sys
84 ifeq ($(DOSCLI),yes)
85 $(CP) $(TARGETNAME).sys ..\..\..\$(DIST_DIR)\drivers\$(TARGETNAME).sys
86 else
87 $(CP) $(TARGETNAME).sys ../../../$(DIST_DIR)/drivers/$(TARGETNAME).sys
88 endif
89
90 #WITH_DEBUGGING = yes
91 #WIN32_LEAN_AND_MEAN = yes
92 #WARNINGS_ARE_ERRORS = yes
93 include ../../../rules.mak