-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathMake.rules
174 lines (140 loc) · 5.23 KB
/
Make.rules
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
-include $(SRCROOT)/auto.conf
export USE_APPLE_PB_SUPPORT = all
ifneq "" "$(wildcard /bin/mkdirs)"
MKDIRS = /bin/mkdirs
else
MKDIRS = /bin/mkdir -p
endif
AS = as
LD = ld
CC = cc
CPP = c++
PAX = /bin/pax
NASM = $(shell which nasm) -p $(SRCROOT)/autoconf.inc
CFLAGS = $(CONFIG_OPTIMIZATION_LEVEL) -g -Wmost -Werror
CPPFLAGS = $(MORECPP) -g -Wmost -Werror -fno-exceptions -fno-rtti
DEFINES=
DIST_SUBDIRS += $(SUBDIRS)
#
# Common makefile targets.
#
# Define these variables (if desired) in directory makefiles:
# DIRS_NEEDED
# INSTALLDIR
# SRCROOT
#
# Toggle this as to whether you want a frame pointer (%ebp) to be used. It is
# invaluable for debugging the booter. For example using GDB attached to VMware.
# In fact, it's so invaluable that it's now the default. Not only that but the
# compiler seems to generate slightly smaller code and the real<->prot code
# clearly handles it appropriately so I have no idea why Apple omitted it.
#OMIT_FRAME_POINTER_CFLAG=-fomit-frame-pointer
OMIT_FRAME_POINTER_CFLAG=
-include $(OBJROOT)/*.Makedep
$(OBJROOT)/%.o32: %.c
@echo "\t[CC32] $<"
@$(CC) $(CFLAGS) $(DEFINES) -c $(INC) -arch i386 $< -MM -M -o $@.Makedep
@$(CC) $(CFLAGS) $(DEFINES) -c $(INC) -arch i386 $< -o $@
$(OBJROOT)/%.o64: %.c
@echo "\t[CC64] $<"
@$(CC) $(CFLAGS) $(DEFINES) -c $(INC) -arch x86_64 $< -MM -M -o $@.Makedep
@$(CC) $(CFLAGS) $(DEFINES) -c $(INC) -arch x86_64 $< -o $@
$(OBJROOT)/%.o: %.c
@echo "\t[CC] $<"
@$(CC) $(CFLAGS) $(DEFINES) -c $(INC) $< -MM -M -o $@.Makedep
@$(CC) $(CFLAGS) $(DEFINES) -c $(INC) $< -o $@
$(OBJROOT)/%.o: %.m
@echo "\t[M] $<"
@$(CC) $(CFLAGS) $(DEFINES) -c $(INC) $< -MM -M -o $@.Makedep
@$(CC) $(CFLAGS) $(DEFINES) -c $(INC) $< -o $@
$(OBJROOT)/%.o: %.cpp
@echo "\t[CPP] $<"
@$(CPP) $(CPPFLAGS) $(CFLAGS) -c "$<" $(INC) -MM -M -o $@.Makedep
@$(CPP) $(CPPFLAGS) $(CFLAGS) -c "$<" $(INC) -o $@
$(OBJROOT)/%.o: %.s
@echo "\t[AS] $<"
@$(CC) $(CPPFLAGS) -c $(INC) -arch i386 $< -MM -M -o $@.Makedep
@$(CC) $(CPPFLAGS) -c $(INC) -arch i386 $< -o $@
CONFIG_FILES=$(SRCROOT)/auto.conf $(SRCROOT)/autoconf.h $(SRCROOT)/autoconf.inc $(SRCROOT)/.config
$(CONFIG_FILES): $(SRCROOT)/.config
@echo "\t[MAKE] config"
@make -C $(SRCROOT)/i386/config rebuild_config
HEADER_VERSION=$(SRCROOT)/vers.h
$(HEADER_VERSION): $(SRCROOT)/version
@echo "#define I386BOOT_VERSION \"5.0.132\"" > $@
@echo "#define I386BOOT_BUILDDATE \"`date \"+%Y-%m-%d %H:%M:%S\"`\"" >> $@
@echo "#define I386BOOT_CHAMELEONVERSION \"`cat $(SRCROOT)/version`\"" >> $@
@echo "#define I386BOOT_CHAMELEONREVISION \"`cat $(SRCROOT)/revision`\"" >> $@
# @echo "#define I386BOOT_CHAMELEONREVISION \"`svnversion -n | tr -d [:alpha:]`\"" >> $@
CONFIG_HEADERS=$(CONFIG_FILES) $(HEADER_VERSION)
# This breaks make, must use make all (FIXME)
$(DIRS_NEEDED) $(INSTALLDIR) $(OBJROOT) $(SYMROOT):
@echo "\t[MKDIR] $@"
@$(MKDIRS) $@
# Recursive rules
RECURSIVE_TARGETS = all-recursive
RECURSIVE_CLEAN_TARGETS = distclean-recursive clean-recursive
.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS)
$(RECURSIVE_TARGETS):
@failcom='exit 1'; \
target=`echo $@ | sed s/-recursive//`; \
list='$(SUBDIRS)'; for subdir in $$list; do \
echo ================= Making $$target in $$subdir =================; \
(cd $$subdir && $(MAKE) $$target) \
|| eval $$failcom; \
done;
$(RECURSIVE_CLEAN_TARGETS):
@failcom='exit 1'; \
dot_seen=no; \
case "$@" in \
distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
*) list='$(SUBDIRS)' ;; \
esac; \
rev=''; for subdir in $$list; do \
if test "$$subdir" = "."; then :; else \
rev="$$subdir $$rev"; \
fi; \
done; \
rev="$$rev ."; \
target=`echo $@ | sed s/-recursive//`; \
for subdir in $$rev; do \
echo "Making $$target in $$subdir"; \
if test "$$subdir" = "."; then \
local_target="$$target-local"; \
else \
local_target="$$target"; \
fi; \
(cd $$subdir && $(MAKE) $$local_target) \
|| eval $$failcom; \
done
clean-dep:
@if [ -f "$(OBJROOT)/Makedep" ];then echo "\t[RM] $(OBJROOT)/Makedep"; fi
@rm -f $(OBJROOT)/Makedep
FIND_IGNORE := \( -name .git -o -name .svn \) -prune -o -name Cconfig -o
# clean: remove almost everything (execpt auto.conf, autoconf.h, autoconf.inc)
clean: clean-recursive clean-dep
@if [ -d "$(OBJROOT)" ];then echo "\t[RMDIR] $(OBJROOT)"; fi
@if [ -d "$(SYMROOT)" ];then echo "\t[RMDIR] $(SYMROOT)"; fi
@if [ -d "$(DSTROOT)" ];then echo "\t[RMDIR] $(DSTROOT)"; fi
@if [ -d "$(SRCROOT)/i386/modules/module_includes" ];then \
echo "\t[RMDIR] $(SRCROOT)/i386/modules/module_includes"; \
fi
@rm -rf $(OBJROOT) $(SYMROOT) $(DSTROOT) \
$(SRCROOT)/i386/modules/module_includes
distclean: distclean-recursive clean-local clean-dep
@find . $(FIND_IGNORE) \
\( -name '*.orig' -o -name '*.rej' -o -name '*~' \
-o -name '*.bak' -o -name '#*#' -o -name '.*.orig' \
-o -name '.*.rej' -o -size 0 \
-o -name '*%' -o -name '.*.cmd' -o -name 'core' \) \
-type f -print | xargs rm -f
clean-local:
distclean-local:
.DEFAULT_GOAL := all
# Local Variables: #
# mode: Makefile #
# tab-width: 2 #
# indent-tabs-mode: t #
# End: #
#
# vi: set noexpandtab ts=2 sw=2 sts=2: #