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
8#
9# Export IDENT for sub-makefiles
10#
11export IDENT
12
13#
14# XXX: INCFLAGS to include libsa prototypes
15#
16INCFLAGS_MAKEFILE= -I$(SOURCE)libsa
17
18export MakeInc_cmd=${SRCROOT}/makedefs/MakeInc.cmd
19export MakeInc_def=${SRCROOT}/makedefs/MakeInc.def
20export MakeInc_rule=${SRCROOT}/makedefs/MakeInc.rule
21export MakeInc_dir=${SRCROOT}/makedefs/MakeInc.dir
22
23include $(MakeInc_cmd)
24include $(MakeInc_def)
25
26#
27# XXX: CFLAGS
28#
29CFLAGS+= -include meta_features.h -DMACH_KERNEL_PRIVATE $(CFLAGS_INLINE_CONFIG)
30
31#
32# Directories for mig generated files
33#
34COMP_SUBDIRS = \
35	default_pager \
36	device \
37	mach_debug \
38	mach \
39	UserNotification \
40	gssd \
41	kextd \
42	lockd
43
44COMP_SUBDIRS_I386 = \
45	mach
46
47COMP_SUBDIRS_X86_64 = \
48	mach
49
50#
51#  Make sure we don't remove this by accident if interrupted at the wrong
52#  time.
53#
54.PRECIOUS: Makefile
55
56#
57#  Theses macros are filled in by the config program depending on the
58#  current configuration.  The MACHDEP macro is replaced by the
59#  contents of the machine dependent makefile template and the others
60#  are replaced by the corresponding symbol definitions for the
61#  configuration.
62#
63
64%OBJS
65
66%CFILES
67
68%MFILES
69
70%SFILES
71
72%BFILES
73
74%ORDERED
75%MACHDEP
76
77#
78#  OBJSDEPS is the set of files (defined in the machine dependent
79#  template if necessary) which all objects depend on (such as an
80#  in-line assembler expansion filter)
81#
82${OBJS}: ${OBJSDEPS}
83
84
85%LOAD
86
87LDOBJS = $(OBJS)
88
89$(COMPONENT).filelist: $(LDOBJS) assym.s
90	$(_v)if [ $(BUILD_MACHO_OBJ) -eq 1 ]; then \
91	for hib_file in ${HIB_FILES};		\
92	do	\
93                $(SEG_HACK) __HIB $${hib_file} -o $${hib_file}__; \
94                mv $${hib_file}__ $${hib_file} ; \
95	done; \
96	fi
97	@echo LDFILELIST $(COMPONENT)
98	$(_v)( for obj in ${LDOBJS}; do	\
99		 echo $(TARGET)$(COMP_OBJ_DIR)/$(KERNEL_CONFIG)/$${obj}; \
100	done; ) > $(COMPONENT).filelist
101
102do_all: $(COMPONENT).filelist
103
104do_depend: do_all
105	$(_v)${MD} -u Makedep -f -d `ls *.d`;
106	
107do_build_all: do_depend
108
109# genassym.o actually is an assembly file,
110# we name it genassym.o to help with the automatic
111# dependency generation
112
113GENASSYM_LOCATION = $(ARCH_CONFIG_LC)
114
115ifeq ($(ARCH_CONFIG_LC),x86_64)
116GENASSYM_LOCATION = i386
117endif
118
119genassym.o: $(SOURCE_DIR)/$(COMPONENT)/$(GENASSYM_LOCATION)/genassym.c
120	$(_v)${KCC} $(subst -flto,,${CFLAGS}) -MD ${_HOST_EXTRA_CFLAGS} -S -o ${@} -c ${INCFLAGS} $<
121
122assym.s: genassym.o
123	$(_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 > ${@}
124
125${SOBJS}: assym.s
126
127
128%RULES
129
130include $(MakeInc_rule)
131include $(MakeInc_dir)
132