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