1#
2# Mach Operating System
3# Copyright (c) 1986 Carnegie-Mellon University
4# All rights reserved.  The CMU software License Agreement specifies
5# the terms and conditions for use and redistribution.
6#
7
8export MakeInc_cmd=${SRCROOT}/makedefs/MakeInc.cmd
9export MakeInc_def=${SRCROOT}/makedefs/MakeInc.def
10export MakeInc_rule=${SRCROOT}/makedefs/MakeInc.rule
11export MakeInc_dir=${SRCROOT}/makedefs/MakeInc.dir
12
13include $(MakeInc_cmd)
14include $(MakeInc_def)
15
16#
17# XXX: CFLAGS
18#
19CFLAGS+= -include meta_features.h -DMACH_KERNEL_PRIVATE -DMACH_KERNEL
20
21# Objects that don't want -Wcast-align warning (8474835)
22OBJS_NO_CAST_ALIGN =			\
23		atm_notification_user.o \
24		model_dep.o		\
25		chud_thread.o		\
26		chud_thread_arm.o   \
27		video_console.o		\
28		kern_stackshot.o			\
29		kdp_udp.o		\
30		kdp_machdep.o		\
31		host.o			\
32		processor.o		\
33		sched_prim.o		\
34		task.o			\
35		thread.o		\
36		threadinfo.o		\
37		gssd_mach.o		\
38		UNDRequest.o		\
39		panic_dialog.o		\
40		bsd_i386.o		\
41		commpage.o		\
42		cpu_threads.o		\
43		cpuid.o			\
44		locks_i386.o		\
45		machine_task.o		\
46		mp_desc.o		\
47		pcb.o			\
48		pcb_native.o		\
49		kdp_x86_common.o	\
50		memory_object.o		\
51		vm_apple_protect.o	\
52		vm_map.o		\
53		startup64.o		\
54		affinity.o		\
55		sched_grrr.o		\
56		sched_proto.o		\
57		stack.o			\
58		task_policy.o		\
59		wait_queue.o		\
60		bsd_kern.o		\
61		pmc.o			\
62		default_freezer.o	\
63		status.o		\
64		machine_routines.o	\
65		loose_ends.o		\
66		fips_sha1.o		\
67		prng_yarrow.o		\
68		sha1mod.o		\
69		sleh.o			\
70		ccdigest_final_64be.o	\
71		ccdigest_init.o		\
72		ccdigest_update.o	\
73		cchmac_final.o		\
74		cchmac_init.o		\
75		ccsha1.o		\
76
77
78# Objects that don't want -Wsign-compare warning (15294427)
79OBJS_NO_SIGN_COMPARE = 		\
80		atm_notification_user.o
81
82$(foreach file,$(OBJS_NO_CAST_ALIGN),$(eval $(call add_perfile_cflags,$(file),-Wno-cast-align)))
83$(foreach file,$(OBJS_NO_SIGN_COMPARE),$(eval $(call add_perfile_cflags,$(file),-Wno-sign-compare)))
84
85#
86# Do not provide CTF symbolic these files
87#
88chud_glue.o_SKIP_CTFCONVERT = 1
89
90#
91# XXX: INCFLAGS to include libsa prototypes
92#
93INCFLAGS_MAKEFILE= -I$(SOURCE)libsa
94
95#
96# Directories for mig generated files
97#
98COMP_SUBDIRS = \
99	atm \
100	default_pager \
101	device \
102	mach \
103	UserNotification \
104	gssd \
105	kextd \
106	lockd
107
108#
109#  Make sure we don't remove this by accident if interrupted at the wrong
110#  time.
111#
112.PRECIOUS: Makefile
113
114#
115#  Theses macros are filled in by the config program depending on the
116#  current configuration.  The MACHDEP macro is replaced by the
117#  contents of the machine dependent makefile template and the others
118#  are replaced by the corresponding symbol definitions for the
119#  configuration.
120#
121
122%OBJS
123
124%CFILES
125
126%CXXFILES
127
128%SFILES
129
130%MACHDEP
131
132# Rebuild if per-file overrides change
133${OBJS}: $(firstword $(MAKEFILE_LIST))
134
135# Rebuild if global compile flags change
136$(COBJS): .CFLAGS
137.CFLAGS: ALWAYS
138	$(_v)$(REPLACECONTENTS) $@ $(KCC) $(CFLAGS) $(INCFLAGS)
139$(CXXOBJS): .CXXFLAGS
140.CXXFLAGS: ALWAYS
141	$(_v)$(REPLACECONTENTS) $@ $(KC++) $(CXXFLAGS) $(INCFLAGS)
142$(SOBJS): .SFLAGS
143.SFLAGS: ALWAYS
144	$(_v)$(REPLACECONTENTS) $@ $(S_KCC) $(SFLAGS) $(INCFLAGS)
145
146$(COMPONENT).filelist: $(OBJS)
147	$(_v)for hib_file in ${HIB_FILES};		\
148	do	\
149                $(SEG_HACK) -n __HIB -o $${hib_file}__ $${hib_file} ; \
150                mv $${hib_file}__ $${hib_file} ; \
151	done
152	@echo LDFILELIST $(COMPONENT)
153	$(_v)( for obj in ${OBJS}; do	\
154		 echo $(TARGET)/$(CURRENT_KERNEL_CONFIG)/$${obj}; \
155	done; ) > $(COMPONENT).filelist
156
157do_all: $(COMPONENT).filelist
158
159do_build_all:: do_all
160
161# genassym.o actually is an assembly file,
162# we name it genassym.o to help with the automatic
163# dependency generation
164
165GENASSYM_LOCATION = $(CURRENT_ARCH_CONFIG_LC)
166
167ifeq ($(CURRENT_ARCH_CONFIG_LC),x86_64)
168GENASSYM_LOCATION = i386
169else ifeq ($(CURRENT_ARCH_CONFIG_LC),x86_64h)
170GENASSYM_LOCATION = i386
171endif
172
173-include genassym.d
174genassym.o: .CFLAGS $(firstword $(MAKEFILE_LIST))
175genassym.o: $(SOURCE_DIR)/$(COMPONENT)/$(GENASSYM_LOCATION)/genassym.c
176	@echo GENASSYM $<
177	$(_v)${KCC} ${CFLAGS} ${CFLAGS_NOLTO_FLAG} -MD -S -o ${@} ${INCFLAGS} $<
178
179assym.s: genassym.o
180	$(_v)sed -e '/#DEFINITION#/!d' -e 's/^.*#DEFINITION#//' -e 's/\$$//' -e 'p' -e 's/#//2' -e 's/[^A-Za-z0-9_]*\([A-Za-z0-9_]*\)/ \1_NUM/2' genassym.o > $@
181
182${SOBJS}: assym.s
183
184%RULES
185
186include $(MakeInc_rule)
187include $(MakeInc_dir)
188