e0d3f8bf773366a65b014619bd7e4d9a2f3c3360
[reactos.git] / reactos / Makefile
1 .PHONY: all
2 .PHONY: clean
3 all: makefile.auto
4
5 ifeq ($(HOST),)
6 ifeq ($(word 1,$(shell gcc -dumpmachine)),mingw32)
7 HOST=mingw32-windows
8 else
9 HOST=mingw32-linux
10 endif
11 endif
12
13 # Default to half-verbose mode
14 ifeq ($(VERBOSE),no)
15 Q = @
16 HALFVERBOSEECHO = no
17 else
18 ifeq ($(VERBOSE),yes)
19 Q =
20 HALFVERBOSEECHO = no
21 else
22 Q = @
23 HALFVERBOSEECHO = yes
24 endif
25 endif
26 ifeq ($(HALFVERBOSEECHO),yes)
27 ECHO_INVOKE =@echo [INVOKE] $<
28 ECHO_PCH =@echo [PCH] $@
29 ECHO_CC =@echo [CC] $<
30 ECHO_GAS =@echo [GAS] $<
31 ECHO_NASM =@echo [NASM] $<
32 ECHO_AR =@echo [AR] $@
33 ECHO_WINEBLD=@echo [WINEBLD] $@
34 ECHO_WRC =@echo [WRC] $@
35 ECHO_BIN2RES=@echo [BIN2RES] $<
36 ECHO_DLLTOOL=@echo [DLLTOOL] $@
37 ECHO_LD =@echo [LD] $@
38 ECHO_RBUILD =@echo [RBUILD] $@
39 ECHO_RSYM =@echo [RSYM] $@
40 ECHO_NCI =@echo [NCI] $@
41 ECHO_CABMAN =@echo [CABMAN] $<
42 ECHO_CDMAKE =@echo [CDMAKE] $@
43 ECHO_TEST =@echo [TEST] $@
44 else
45 ECHO_INVOKE =
46 ECHO_PCH =
47 ECHO_CC =
48 ECHO_GAS =
49 ECHO_NASM =
50 ECHO_AR =
51 ECHO_WINEBLD=
52 ECHO_WRC =
53 ECHO_BIN2RES=
54 ECHO_DLLTOOL=
55 ECHO_LD =
56 ECHO_RBUILD =
57 ECHO_RSYM =
58 ECHO_NCI =
59 ECHO_CABMAN =
60 ECHO_CDMAKE =
61 ECHO_TEST =
62 endif
63
64
65 host_gcc = $(Q)gcc
66 host_gpp = $(Q)g++
67 host_ld = $(Q)ld
68 host_ar = $(Q)ar
69 host_objcopy = $(Q)objcopy
70 ifeq ($(HOST),mingw32-linux)
71 EXEPREFIX = ./
72 EXEPOSTFIX =
73 SEP = /
74 nmkdir = $(Q)mkdir -p
75 gcc = $(Q)mingw32-gcc
76 gpp = $(Q)mingw32-g++
77 ld = $(Q)mingw32-ld
78 ar = $(Q)mingw32-ar
79 objcopy = $(Q)mingw32-objcopy
80 dlltool = $(Q)mingw32-dlltool
81 windres = $(Q)mingw32-windres
82 rm = rm -f
83 cp = $(Q)cp
84 NUL = /dev/null
85 else # mingw32-windows
86 EXEPREFIX =
87 EXEPOSTFIX = .exe
88 SEP = \$(EMPTY_VAR)
89 nmkdir = $(Q)mkdir
90 gcc = $(Q)gcc
91 gpp = $(Q)g++
92 ld = $(Q)ld
93 ar = $(Q)ar
94 objcopy = $(Q)objcopy
95 dlltool = $(Q)dlltool
96 windres = $(Q)windres
97 rm = del /f /q
98 cp = $(Q)copy /y
99 NUL = NUL
100 endif
101
102 ifneq ($(ROS_INTERMEDIATE),)
103 $(ROS_INTERMEDIATE)tools: $(ROS_INTERMEDIATE)
104 ${nmkdir} $(ROS_INTERMEDIATE)tools
105 endif
106
107 ifneq ($(ROS_INTERMEDIATE),)
108 $(ROS_INTERMEDIATE):
109 ${nmkdir} $(ROS_INTERMEDIATE)
110 endif
111
112 NTOSKRNL_MC = .$(SEP)ntoskrnl$(SEP)ntoskrnl.mc
113 KERNEL32_MC = .$(SEP)lib$(SEP)kernel32$(SEP)kernel32.mc
114 BUILDNO_H = .$(SEP)include$(SEP)reactos$(SEP)buildno.h
115 BUGCODES_H = .$(SEP)include$(SEP)reactos$(SEP)bugcodes.h
116 BUGCODES_RC = .$(SEP)ntoskrnl$(SEP)bugcodes.rc
117 ERRCODES_H = .$(SEP)include$(SEP)reactos$(SEP)errcodes.h
118 ERRCODES_RC = .$(SEP)lib$(SEP)kernel32$(SEP)errcodes.rc
119
120 include tools/tools.mak
121 -include makefile.auto
122
123 PREAUTO := \
124 $(BUILDNO_H) \
125 $(BUGCODES_H) \
126 $(BUGCODES_RC) \
127 $(ERRCODES_H) \
128 $(ERRCODES_RC) \
129 $(NCI_SERVICE_FILES)
130
131 makefile.auto: $(RMKDIR_TARGET) $(RBUILD_TARGET) $(PREAUTO) $(XMLBUILDFILES)
132 $(ECHO_RBUILD)
133 $(Q)tools$(SEP)rbuild$(SEP)rbuild$(EXEPOSTFIX) mingw
134
135
136 $(BUGCODES_H) $(BUGCODES_RC): $(WMC_TARGET) $(NTOSKRNL_MC)
137 $(WMC_TARGET) -i -H $(BUGCODES_H) -o $(BUGCODES_RC) $(NTOSKRNL_MC)
138
139 $(ERRCODES_H) $(ERRCODES_RC): $(WMC_TARGET) $(KERNEL32_MC)
140 $(WMC_TARGET) -i -H $(ERRCODES_H) -o $(ERRCODES_RC) $(KERNEL32_MC)
141
142 .PHONY: makefile_auto_clean
143 makefile_auto_clean:
144 -@$(rm) makefile.auto $(PREAUTO) 2>$(NUL)
145 clean: makefile_auto_clean