have buildno invocation conform to VERBOSE setting
[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 .SUFFIXES:
22
23 ifeq ($(HOST),)
24 ifeq ($(word 1,$(shell gcc -dumpmachine)),mingw32)
25 HOST=mingw32-windows
26 else
27 HOST=mingw32-linux
28 endif
29 endif
30
31 # Default to half-verbose mode
32 ifeq ($(VERBOSE),no)
33 Q = @
34 HALFVERBOSEECHO = no
35 BUILDNO_QUIET = -q
36 else
37 ifeq ($(VERBOSE),yes)
38 Q =
39 HALFVERBOSEECHO = no
40 BUILDNO_QUIET =
41 else
42 Q = @
43 HALFVERBOSEECHO = yes
44 BUILDNO_QUIET = -q
45 endif
46 endif
47 ifeq ($(HALFVERBOSEECHO),yes)
48 ECHO_MKDIR =@echo [MKDIR] $@
49 ECHO_BUILDNO=@echo [BUILDNO] $@
50 ECHO_INVOKE =@echo [INVOKE] $<
51 ECHO_PCH =@echo [PCH] $@
52 ECHO_CC =@echo [CC] $<
53 ECHO_GAS =@echo [GAS] $<
54 ECHO_NASM =@echo [NASM] $<
55 ECHO_AR =@echo [AR] $@
56 ECHO_WINEBLD=@echo [WINEBLD] $@
57 ECHO_WRC =@echo [WRC] $@
58 ECHO_BIN2RES=@echo [BIN2RES] $<
59 ECHO_DLLTOOL=@echo [DLLTOOL] $@
60 ECHO_LD =@echo [LD] $@
61 ECHO_RBUILD =@echo [RBUILD] $@
62 ECHO_RSYM =@echo [RSYM] $@
63 ECHO_WMC =@echo [WMC] $@
64 ECHO_NCI =@echo [NCI] $@
65 ECHO_CABMAN =@echo [CABMAN] $<
66 ECHO_CDMAKE =@echo [CDMAKE] $@
67 ECHO_TEST =@echo [TEST] $@
68 else
69 ECHO_MKDIR =
70 ECHO_BUILDNO=
71 ECHO_INVOKE =
72 ECHO_PCH =
73 ECHO_CC =
74 ECHO_GAS =
75 ECHO_NASM =
76 ECHO_AR =
77 ECHO_WINEBLD=
78 ECHO_WRC =
79 ECHO_BIN2RES=
80 ECHO_DLLTOOL=
81 ECHO_LD =
82 ECHO_RBUILD =
83 ECHO_RSYM =
84 ECHO_WMC =
85 ECHO_NCI =
86 ECHO_CABMAN =
87 ECHO_CDMAKE =
88 ECHO_TEST =
89 endif
90
91
92 host_gcc = $(Q)gcc
93 host_gpp = $(Q)g++
94 host_ld = $(Q)ld
95 host_ar = $(Q)ar
96 host_objcopy = $(Q)objcopy
97 ifeq ($(HOST),mingw32-linux)
98 EXEPREFIX = ./
99 EXEPOSTFIX =
100 SEP = /
101 nmkdir = -$(Q)mkdir -p
102 gcc = $(Q)mingw32-gcc
103 gpp = $(Q)mingw32-g++
104 ld = $(Q)mingw32-ld
105 ar = $(Q)mingw32-ar
106 objcopy = $(Q)mingw32-objcopy
107 dlltool = $(Q)mingw32-dlltool
108 windres = $(Q)mingw32-windres
109 rm = rm -f
110 cp = $(Q)cp
111 NUL = /dev/null
112 else # mingw32-windows
113 EXEPREFIX =
114 EXEPOSTFIX = .exe
115 ROS_EMPTY =
116 SEP = \$(ROS_EMPTY)
117 nmkdir = -$(Q)mkdir
118 gcc = $(Q)gcc
119 gpp = $(Q)g++
120 ld = $(Q)ld
121 ar = $(Q)ar
122 objcopy = $(Q)objcopy
123 dlltool = $(Q)dlltool
124 windres = $(Q)windres
125 rm = del /f /q
126 cp = $(Q)copy /y
127 NUL = NUL
128 endif
129
130 ifneq ($(ROS_INTERMEDIATE),)
131 INTERMEDIATE = .$(SEP)$(ROS_INTERMEDIATE)$(SEP)
132 INTERMEDIATE_NO_SLASH := $(ROS_INTERMEDIATE)
133 else
134 INTERMEDIATE = obj-i386$(SEP)
135 INTERMEDIATE_NO_SLASH = obj-i386
136 endif
137
138 ifneq ($(ROS_OUTPUT),)
139 OUTPUT = $(ROS_OUTPUT)$(SEP)
140 OUTPUT_NO_SLASH = $(ROS_OUTPUT)
141 else
142 OUTPUT = obj-i386$(SEP)
143 OUTPUT_NO_SLASH = obj-i386
144 endif
145
146 mkdir = -$(Q)$(INTERMEDIATE)rmkdir
147 EXISTS = .exists
148 INTERMEDIATE_EXISTS = $(INTERMEDIATE)$(EXISTS)
149
150 $(INTERMEDIATE_EXISTS):
151 -${nmkdir} $(INTERMEDIATE_NO_SLASH) 2>$(NUL) >$(NUL)
152 @echo . > $@
153
154 NTOSKRNL_MC = ntoskrnl$(SEP)ntoskrnl.mc
155 KERNEL32_MC = lib$(SEP)kernel32$(SEP)kernel32.mc
156 BUILDNO_H = include$(SEP)reactos$(SEP)buildno.h
157 BUGCODES_H = include$(SEP)reactos$(SEP)bugcodes.h
158 BUGCODES_RC = ntoskrnl$(SEP)bugcodes.rc
159 ERRCODES_H = include$(SEP)reactos$(SEP)errcodes.h
160 ERRCODES_RC = lib$(SEP)kernel32$(SEP)errcodes.rc
161
162 include tools/tools.mak
163 -include makefile.auto
164
165 PREAUTO := \
166 $(BUILDNO_H) \
167 $(BUGCODES_H) \
168 $(BUGCODES_RC) \
169 $(ERRCODES_H) \
170 $(ERRCODES_RC) \
171 $(NCI_SERVICE_FILES)
172
173 makefile.auto: $(RBUILD_TARGET) $(PREAUTO) $(XMLBUILDFILES)
174 $(ECHO_RBUILD)
175 $(Q)$(RBUILD_TARGET) mingw
176
177
178 $(BUGCODES_H) $(BUGCODES_RC): $(WMC_TARGET) $(NTOSKRNL_MC)
179 $(ECHO_WMC)
180 $(Q)$(WMC_TARGET) -i -H $(BUGCODES_H) -o $(BUGCODES_RC) $(NTOSKRNL_MC)
181
182 $(ERRCODES_H) $(ERRCODES_RC): $(WMC_TARGET) $(KERNEL32_MC)
183 $(ECHO_WMC)
184 $(Q)$(WMC_TARGET) -i -H $(ERRCODES_H) -o $(ERRCODES_RC) $(KERNEL32_MC)
185
186 .PHONY: makefile_auto_clean
187 makefile_auto_clean:
188 -@$(rm) makefile.auto $(PREAUTO) 2>$(NUL)
189
190 .PHONY: clean
191 clean: makefile_auto_clean