Makefile.inc revision 1.21
1#	$NetBSD: Makefile.inc,v 1.21 2012/12/12 15:12:11 matt 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
60${SALIB_PROF}:		.NOTMAIN .MAKE __always_make_salib
61	@echo making sure the profiled sa library is up to date...
62.if (${SA_AS} == "library")
63	@${SAMAKE} libsa_p.a
64.else
65	@${SAMAKE} libsa.po
66.endif
67
68clean:			.NOTMAIN cleansalib
69cleansalib:		.NOTMAIN
70	@echo cleaning the sa library objects
71	@if [ -d "${SADST}" ]; then ${SAMAKE} clean; fi
72
73cleandir distclean:	.NOTMAIN cleandirsalib
74cleandirsalib:		.NOTMAIN
75	@echo cleandiring the sa library objects
76	@if [ -d "${SADST}" ]; then ${SAMAKE} cleandir; fi
77
78dependall depend:	.NOTMAIN dependsalib
79dependsalib:		.NOTMAIN .MAKE __always_make_salib
80	@echo depending the sa library objects
81	@${SAMAKE} depend
82
83__always_make_salib:	.NOTMAIN
84	@mkdir -p ${SADST}
85
86.PHONY: __always_make_salib
87.PHONY: cleansalib cleandirsalib dependsalib
88