Makefile.inc revision 1.22
1#	$NetBSD: Makefile.inc,v 1.22 2015/09/06 15:34:55 uebayasi Exp $
2#
3#	Configuration variables (default values are below):
4#
5#	S	must be set to the top of the 'sys' tree.
6#	SADST	may be set to the location of the directory where library
7#		objects are to be built.  Defaults to ${.OBJDIR}/lib/sa.
8#	SA_AS	may be set to 'obj' to build a object from the library's
9#		object files.  (Otherwise, a library will be built.)
10#		Defaults to 'library'.
11#	SAMISCCPPFLAGS
12#		Miscellaneous cpp flags to be passed to the library's Makefile
13#		when building.
14#	SAMISCMAKEFLAGS
15#		Miscellaneous flags to be passed to the library's Makefile when
16#		building.  See library's Makefile for more details about
17#		supported flags and their default values.
18
19# Default values:
20SADST?=		${.OBJDIR}/lib/sa
21SA_AS?=		library
22SADOTDIR?= ../../.
23
24CWARNFLAGS.clang+=	-Wno-format-extra-args
25
26SADIR=		${S:S@^.@${SADOTDIR}@:Q}/lib/libsa
27.if (${SA_AS} == "obj")
28SALIB=		${SADST}/libsa.o
29SALIB_PROF=	${SADST}/libsa.po
30.else
31SALIB=		${SADST}/libsa.a
32SALIB_PROF=	${SADST}/libsa_p.a
33.endif
34ZLIBSRCDIR:=	${.PARSEDIR}/../../../common/dist/zlib
35SAMISCCPPFLAGS+=-I${ZLIBSRCDIR}
36
37SAMAKE= \
38	cd ${SADST} && ${MAKE} -f ${SADIR:Q}/Makefile \
39	    SADIR=${SADIR:Q} \
40	    CC=${CC:Q} CFLAGS=${CFLAGS:Q} CPUFLAGS= \
41	    AS=${AS:Q} AFLAGS=${AFLAGS:Q} \
42	    LORDER=${LORDER:Q} \
43	    TSORT=${TSORT:Q} \
44	    LD=${LD:Q} STRIP=${STRIP:Q} \
45	    AR=${AR:Q} NM=${NM:Q} \
46	    RANLIB=${RANLIB:Q} SIZE=${SIZE:Q} \
47	    MACHINE=${MACHINE} MACHINE_ARCH=${MACHINE_ARCH:Q} \
48	    SACPPFLAGS=${CPPFLAGS:S@^-I.@-I${SADOTDIR}@g:Q} \
49	    SAMISCCPPFLAGS=${SAMISCCPPFLAGS:Q} \
50	    ${SAMISCMAKEFLAGS}
51
52${SALIB}:		.NOTMAIN .MAKE __always_make_salib
53	@echo making sure the sa library is up to date...
54.if (${SA_AS} == "library")
55	@${SAMAKE} libsa.a
56.else
57	@${SAMAKE} libsa.o
58.endif
59	@echo done
60
61${SALIB_PROF}:		.NOTMAIN .MAKE __always_make_salib
62	@echo making sure the profiled sa library is up to date...
63.if (${SA_AS} == "library")
64	@${SAMAKE} libsa_p.a
65.else
66	@${SAMAKE} libsa.po
67.endif
68	@echo done
69
70clean:			.NOTMAIN cleansalib
71cleansalib:		.NOTMAIN
72	@echo cleaning the sa library objects
73	@if [ -d "${SADST}" ]; then ${SAMAKE} clean; fi
74	@echo done
75
76cleandir distclean:	.NOTMAIN cleandirsalib
77cleandirsalib:		.NOTMAIN
78	@echo cleandiring the sa library objects
79	@if [ -d "${SADST}" ]; then ${SAMAKE} cleandir; fi
80	@echo done
81
82dependall depend:	.NOTMAIN dependsalib
83dependsalib:		.NOTMAIN .MAKE __always_make_salib
84	@echo depending the sa library objects
85	@${SAMAKE} depend
86	@echo done
87
88__always_make_salib:	.NOTMAIN
89	@mkdir -p ${SADST}
90
91.PHONY: __always_make_salib
92.PHONY: cleansalib cleandirsalib dependsalib
93