xref: /xnu-12377.41.6/libsa/conf/Makefile.template (revision bbb1b6f9e71b8cdde6e5cd6f4841f207dee3d828)
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# CFLAGS
18#
19CFLAGS+= -include meta_features.h -DLIBSA_KERNEL_PRIVATE
20SFLAGS+= -include meta_features.h
21
22#
23# Directories for mig generated files
24#
25COMP_SUBDIRS =
26
27#
28#  Make sure we don't remove this by accident if interrupted at the wrong
29#  time.
30#
31.PRECIOUS: Makefile
32
33#
34#  Theses macros are filled in by the config program depending on the
35#  current configuration.  The MACHDEP macro is replaced by the
36#  contents of the machine dependent makefile template and the others
37#  are replaced by the corresponding symbol definitions for the
38#  configuration.
39#
40
41%OBJS
42
43%LIBOBJS
44
45%CFILES
46
47%CXXFILES
48
49%SFILES
50
51%MACHDEP
52
53# Rebuild if per-file overrides change
54${OBJS}: $(firstword $(MAKEFILE_LIST))
55
56# Rebuild if global compile flags change
57$(COBJS): .CFLAGS
58.CFLAGS: ALWAYS
59	$(_v)$(REPLACECONTENTS) $@ $(KCC) $(CFLAGS) $(INCFLAGS)
60$(CXXOBJS): .CXXFLAGS
61.CXXFLAGS: ALWAYS
62	$(_v)$(REPLACECONTENTS) $@ $(KC++) $(CXXFLAGS) $(INCFLAGS)
63$(SOBJS): .SFLAGS
64.SFLAGS: ALWAYS
65	$(_v)$(REPLACECONTENTS) $@ $(S_KCC) $(SFLAGS) $(INCFLAGS)
66
67KLD_FILES = $(OBJS)
68
69$(COMPONENT).filelist: $(OBJS)
70	$(_v)for kld_file in ${KLD_FILES}; do      \
71		$(SEG_HACK) -s __TEXT -n __KLD -o $${kld_file}__ $${kld_file} || exit 1; \
72		mv $${kld_file}__ $${kld_file} || exit 1; \
73		$(SEG_HACK) -i __KLD -n __KLDDATA -o $${kld_file}__ $${kld_file} || exit 1; \
74		mv $${kld_file}__ $${kld_file} || exit 1; \
75	done
76	@$(LOG_LDFILELIST) "$(COMPONENT)"
77	$(_v)for obj in ${OBJS}; do	\
78		 $(ECHO) $(TARGET)/$(CURRENT_KERNEL_CONFIG)/$${obj}; \
79	done > $(COMPONENT).filelist
80
81ifeq ($(XNU_LibAllFiles),1)
82LIBOBJS := $(OBJS)
83endif
84
85$(COMPONENT).libfilelist: $(LIBOBJS)
86	@$(LOG_LDFILELIST) "lib$(COMPONENT)"
87	$(_v)for obj in ${LIBOBJS}; do	\
88		 $(ECHO) $(TARGET)/$(CURRENT_KERNEL_CONFIG)/$${obj}; \
89	done > $(COMPONENT).libfilelist
90
91
92ifeq ($(RC_ProjectName),xnu_libraries)
93do_all: $(COMPONENT).libfilelist
94else
95do_all: $(COMPONENT).filelist
96endif
97
98do_build_all:: do_all
99
100%RULES
101
102include $(MakeInc_rule)
103include $(MakeInc_dir)
104
105# the KLD segment is mapped read-only on arm, so if we include llvm profiling
106# here it will segfault the kernel.  (see arm_vm_init.c) We don't currently have
107# a way of retrieving these counters from KLD anyway, so there's no harm in just
108# disabling them.
109CXXFLAGS_GEN:=$(filter-out -fprofile-instr-generate,$(CXXFLAGS_GEN))
110CXXFLAGS_GEN:=$(filter-out -fcoverage-mapping,$(CXXFLAGS_GEN))
111CFLAGS_GEN:=$(filter-out -fprofile-instr-generate,$(CFLAGS_GEN))
112CFLAGS_GEN:=$(filter-out -fcoverage-mapping,$(CFLAGS_GEN))
113