echo [WMC] commands
[reactos.git] / reactos / Makefile
1 # Accepted environment variables:
2 #
3 # ROS_INTERMEDIATE
4 # This variable controls where to put intermediate files. Intermediate
5 # files are generated files that are needed to generate the final
6 # output files. Examples of intermediate files include *.o, *.a, and
7 # *.coff. N.B. Don't put a path separator at the end. The variable
8 # defaults to .\obj-i386.
9 #
10 # ROS_OUTPUT
11 # This variable controls where to put output files. Output files are
12 # generated files that makes up the result of the build process.
13 # Examples of output files include *.exe, *.dll, and *.sys. N.B. Don't
14 # put a path separator at the end. The variable defaults to .\output-i386.
15 #
16
17 .PHONY: all
18 .PHONY: clean
19 all: makefile.auto
20
21 ifeq ($(HOST),)
22 ifeq ($(word 1,$(shell gcc -dumpmachine)),mingw32)
23 HOST=mingw32-windows
24 else
25 HOST=mingw32-linux
26 endif
27 endif
28
29 # Default to half-verbose mode
30 ifeq ($(VERBOSE),no)
31 Q = @
32 HALFVERBOSEECHO = no
33 else
34 ifeq ($(VERBOSE),yes)
35 Q =
36 HALFVERBOSEECHO = no
37 else
38 Q = @
39 HALFVERBOSEECHO = yes
40 endif
41 endif
42 ifeq ($(HALFVERBOSEECHO),yes)
43 ECHO_INVOKE =@echo [INVOKE] $<
44 ECHO_PCH =@echo [PCH] $@
45 ECHO_CC =@echo [CC] $<
46 ECHO_GAS =@echo [GAS] $<
47 ECHO_NASM =@echo [NASM] $<
48 ECHO_AR =@echo [AR] $@
49 ECHO_WINEBLD=@echo [WINEBLD] $@
50 ECHO_WRC =@echo [WRC] $@
51 ECHO_BIN2RES=@echo [BIN2RES] $<
52 ECHO_DLLTOOL=@echo [DLLTOOL] $@
53 ECHO_LD =@echo [LD] $@
54 ECHO_RBUILD =@echo [RBUILD] $@
55 ECHO_RSYM =@echo [RSYM] $@
56 ECHO_WMC =@echo [WMC] $@
57 ECHO_NCI =@echo [NCI] $@
58 ECHO_CABMAN =@echo [CABMAN] $<
59 ECHO_CDMAKE =@echo [CDMAKE] $@
60 ECHO_TEST =@echo [TEST] $@
61 else
62 ECHO_INVOKE =
63 ECHO_PCH =
64 ECHO_CC =
65 ECHO_GAS =
66 ECHO_NASM =
67 ECHO_AR =
68 ECHO_WINEBLD=
69 ECHO_WRC =
70 ECHO_BIN2RES=
71 ECHO_DLLTOOL=
72 ECHO_LD =
73 ECHO_RBUILD =
74 ECHO_RSYM =
75 ECHO_WMC =
76 ECHO_NCI =
77 ECHO_CABMAN =
78 ECHO_CDMAKE =
79 ECHO_TEST =
80 endif
81
82
83 host_gcc = $(Q)gcc
84 host_gpp = $(Q)g++
85 host_ld = $(Q)ld
86 host_ar = $(Q)ar
87 host_objcopy = $(Q)objcopy
88 ifeq ($(HOST),mingw32-linux)
89 EXEPREFIX = ./
90 EXEPOSTFIX =
91 SEP = /
92 nmkdir = $(Q)mkdir -p
93 gcc = $(Q)mingw32-gcc
94 gpp = $(Q)mingw32-g++
95 ld = $(Q)mingw32-ld
96 ar = $(Q)mingw32-ar
97 objcopy = $(Q)mingw32-objcopy
98 dlltool = $(Q)mingw32-dlltool
99 windres = $(Q)mingw32-windres
100 rm = rm -f
101 cp = $(Q)cp
102 NUL = /dev/null
103 else # mingw32-windows
104 EXEPREFIX =
105 EXEPOSTFIX = .exe
106 ROS_EMPTY =
107 SEP = \$(ROS_EMPTY)
108 nmkdir = $(Q)mkdir
109 gcc = $(Q)gcc
110 gpp = $(Q)g++
111 ld = $(Q)ld
112 ar = $(Q)ar
113 objcopy = $(Q)objcopy
114 dlltool = $(Q)dlltool
115 windres = $(Q)windres
116 rm = del /f /q
117 cp = $(Q)copy /y
118 NUL = NUL
119 endif
120
121 ifneq ($(ROS_INTERMEDIATE),)
122 INTERMEDIATE = .$(SEP)$(ROS_INTERMEDIATE)$(SEP)
123 INTERMEDIATE_NO_SLASH := $(ROS_INTERMEDIATE)
124 else
125 INTERMEDIATE = obj-i386$(SEP)
126 INTERMEDIATE_NO_SLASH = obj-i386
127 endif
128
129 ifneq ($(ROS_OUTPUT),)
130 OUTPUT = $(ROS_OUTPUT)$(SEP)
131 OUTPUT_NO_SLASH = $(ROS_OUTPUT)
132 else
133 OUTPUT = obj-i386$(SEP)
134 OUTPUT_NO_SLASH = obj-i386
135 endif
136
137 mkdir = $(Q)$(INTERMEDIATE)rmkdir
138
139 $(INTERMEDIATE_NO_SLASH):
140 ${nmkdir} $(INTERMEDIATE_NO_SLASH)
141
142 NTOSKRNL_MC = .$(SEP)ntoskrnl$(SEP)ntoskrnl.mc
143 KERNEL32_MC = .$(SEP)lib$(SEP)kernel32$(SEP)kernel32.mc
144 BUILDNO_H = .$(SEP)include$(SEP)reactos$(SEP)buildno.h
145 BUGCODES_H = .$(SEP)include$(SEP)reactos$(SEP)bugcodes.h
146 BUGCODES_RC = .$(SEP)ntoskrnl$(SEP)bugcodes.rc
147 ERRCODES_H = .$(SEP)include$(SEP)reactos$(SEP)errcodes.h
148 ERRCODES_RC = .$(SEP)lib$(SEP)kernel32$(SEP)errcodes.rc
149
150 include tools/tools.mak
151 -include makefile.auto
152
153 PREAUTO := \
154 $(BUILDNO_H) \
155 $(BUGCODES_H) \
156 $(BUGCODES_RC) \
157 $(ERRCODES_H) \
158 $(ERRCODES_RC) \
159 $(NCI_SERVICE_FILES)
160
161 makefile.auto: $(RBUILD_TARGET) $(PREAUTO) $(XMLBUILDFILES)
162 $(ECHO_RBUILD)
163 $(Q)tools$(SEP)rbuild$(SEP)rbuild$(EXEPOSTFIX) mingw
164
165
166 $(BUGCODES_H) $(BUGCODES_RC): $(WMC_TARGET) $(NTOSKRNL_MC)
167 $(ECHO_WMC)
168 $(Q)$(WMC_TARGET) -i -H $(BUGCODES_H) -o $(BUGCODES_RC) $(NTOSKRNL_MC)
169
170 $(ERRCODES_H) $(ERRCODES_RC): $(WMC_TARGET) $(KERNEL32_MC)
171 $(ECHO_WMC)
172 $(Q)$(WMC_TARGET) -i -H $(ERRCODES_H) -o $(ERRCODES_RC) $(KERNEL32_MC)
173
174 .PHONY: makefile_auto_clean
175 makefile_auto_clean:
176 -@$(rm) makefile.auto $(PREAUTO) 2>$(NUL)
177
178 .PHONY: clean
179 clean: makefile_auto_clean