xref: /netbsd/sys/lib/libsa/Makefile.inc (revision bf9ec67e)
1#	$NetBSD: Makefile.inc,v 1.16 2001/11/21 22:10:55 jmc 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
24SADIR=		${S:S@^.@${SADOTDIR}@:Q}/lib/libsa
25.if (${SA_AS} == "obj")
26SALIB=		${SADST}/libsa.o
27SALIB_PROF=	${SADST}/libsa.po
28.else
29SALIB=		${SADST}/libsa.a
30SALIB_PROF=	${SADST}/libsa_p.a
31.endif
32
33SAMAKE= \
34	cd ${SADST} && ${MAKE} -f ${SADIR:Q}/Makefile \
35	    SADIR=${SADIR:Q} \
36	    CC=${CC:Q} CFLAGS=${CFLAGS:Q} \
37	    AS=${AS:Q} AFLAGS=${AFLAGS:Q} \
38	    LORDER=${LORDER:Q} \
39	    TSORT=${TSORT:Q} \
40	    LD=${LD:Q} STRIP=${STRIP:Q} \
41	    AR=${AR:Q} NM=${NM:Q} \
42	    RANLIB=${RANLIB:Q} SIZE=${SIZE:Q} \
43	    MACHINE=${MACHINE} MACHINE_ARCH=${MACHINE_ARCH:Q} \
44	    SACPPFLAGS=${CPPFLAGS:S@^-I.@-I${SADOTDIR}@g:Q} \
45	    SAMISCCPPFLAGS=${SAMISCCPPFLAGS:Q} \
46	    ${SAMISCMAKEFLAGS}
47
48${SALIB}:		.NOTMAIN .MAKE __always_make_salib
49	@echo making sure the sa library is up to date...
50.if (${SA_AS} == "library")
51	@${SAMAKE} libsa.a
52.else
53	@${SAMAKE} libsa.o
54.endif
55
56${SALIB_PROF}:		.NOTMAIN .MAKE __always_make_salib
57	@echo making sure the profiled sa library is up to date...
58.if (${SA_AS} == "library")
59	@${SAMAKE} libsa_p.a
60.else
61	@${SAMAKE} libsa.po
62.endif
63
64clean:			.NOTMAIN cleansalib
65cleansalib:		.NOTMAIN
66	@echo cleaning the sa library objects
67	@if [ -d "${SADST}" ]; then ${SAMAKE} clean; fi
68
69cleandir distclean:	.NOTMAIN cleandirsalib
70cleandirsalib:		.NOTMAIN
71	@echo cleandiring the sa library objects
72	@if [ -d "${SADST}" ]; then ${SAMAKE} cleandir; fi
73
74depend:			.NOTMAIN dependsalib
75dependsalib:		.NOTMAIN .MAKE __always_make_salib
76	@echo depending the sa library objects
77	@${SAMAKE} depend
78
79__always_make_salib:	.NOTMAIN
80	@mkdir -p ${SADST}
81
82.PHONY: __always_make_salib
83.PHONY: cleansalib cleandirsalib dependsalib
84