xref: /illumos-gate/usr/src/cmd/svc/svccfg/Makefile (revision df4628cb)
17c478bd9Sstevel@tonic-gate#
27c478bd9Sstevel@tonic-gate# CDDL HEADER START
37c478bd9Sstevel@tonic-gate#
47c478bd9Sstevel@tonic-gate# The contents of this file are subject to the terms of the
524da5b34Srie# Common Development and Distribution License (the "License").
624da5b34Srie# You may not use this file except in compliance with the License.
77c478bd9Sstevel@tonic-gate#
87c478bd9Sstevel@tonic-gate# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
97c478bd9Sstevel@tonic-gate# or http://www.opensolaris.org/os/licensing.
107c478bd9Sstevel@tonic-gate# See the License for the specific language governing permissions
117c478bd9Sstevel@tonic-gate# and limitations under the License.
127c478bd9Sstevel@tonic-gate#
137c478bd9Sstevel@tonic-gate# When distributing Covered Code, include this CDDL HEADER in each
147c478bd9Sstevel@tonic-gate# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
157c478bd9Sstevel@tonic-gate# If applicable, add the following below this CDDL HEADER, with the
167c478bd9Sstevel@tonic-gate# fields enclosed by brackets "[]" replaced with your own identifying
177c478bd9Sstevel@tonic-gate# information: Portions Copyright [yyyy] [name of copyright owner]
187c478bd9Sstevel@tonic-gate#
197c478bd9Sstevel@tonic-gate# CDDL HEADER END
207c478bd9Sstevel@tonic-gate#
2124da5b34Srie
227c478bd9Sstevel@tonic-gate#
2324da5b34Srie# Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
247c478bd9Sstevel@tonic-gate# Use is subject to license terms.
257c478bd9Sstevel@tonic-gate#
267c478bd9Sstevel@tonic-gate# ident	"%Z%%M%	%I%	%E% SMI"
277c478bd9Sstevel@tonic-gate
287c478bd9Sstevel@tonic-gateMYPROG =	svccfg
297c478bd9Sstevel@tonic-gatePROG =		$(MYPROG)
307c478bd9Sstevel@tonic-gate
317c478bd9Sstevel@tonic-gateSRCS  =		svccfg_main.c \
327c478bd9Sstevel@tonic-gate		svccfg_engine.c \
337c478bd9Sstevel@tonic-gate		svccfg_internal.c \
347c478bd9Sstevel@tonic-gate		svccfg_libscf.c \
357c478bd9Sstevel@tonic-gate		svccfg_xml.c \
367c478bd9Sstevel@tonic-gate		svccfg_help.c
377c478bd9Sstevel@tonic-gate
387c478bd9Sstevel@tonic-gateLNTS =		$(SRCS:%.c=%.ln) \
397c478bd9Sstevel@tonic-gate		manifest_hash.ln
407c478bd9Sstevel@tonic-gate
417c478bd9Sstevel@tonic-gateMYOBJS =	$(SRCS:%.c=%.o) \
427c478bd9Sstevel@tonic-gate		svccfg_grammar.o \
437c478bd9Sstevel@tonic-gate		svccfg_lex.o \
447c478bd9Sstevel@tonic-gate		manifest_hash.o
457c478bd9Sstevel@tonic-gateOBJS =		$(MYOBJS)
467c478bd9Sstevel@tonic-gate
477c478bd9Sstevel@tonic-gatePOFILES = 	$(SRCS:%.c=%.po) \
487c478bd9Sstevel@tonic-gate		svccfg_grammar.po \
497c478bd9Sstevel@tonic-gate		svccfg_lex.po \
507c478bd9Sstevel@tonic-gate		../common/manifest_hash.po
517c478bd9Sstevel@tonic-gate
527c478bd9Sstevel@tonic-gateinclude ../../Makefile.cmd
537c478bd9Sstevel@tonic-gateinclude ../Makefile.ctf
547c478bd9Sstevel@tonic-gate
557c478bd9Sstevel@tonic-gatePOFILE =	$(PROG)_all.po
567c478bd9Sstevel@tonic-gate
577c478bd9Sstevel@tonic-gateNATIVE_BUILD=$(POUND_SIGN)
587c478bd9Sstevel@tonic-gate$(NATIVE_BUILD)NOT_NATIVE=$(POUND_SIGN)
597c478bd9Sstevel@tonic-gate
607c478bd9Sstevel@tonic-gate$(NATIVE_BUILD)PROG = $(MYPROG:%=%-native)
617c478bd9Sstevel@tonic-gate$(NATIVE_BUILD)OBJS = $(MYOBJS:%.o=%-native.o)
627c478bd9Sstevel@tonic-gate
63*df4628cbSrie# svccfg has a name clash with main() and libl.so.1.  However, svccfg must
64*df4628cbSrie# still export a number of "yy*" (libl) interfaces.  Reduce all other symbols
65*df4628cbSrie# to local scope.
66*df4628cbSrieMAPFILES +=	$(MAPFILE.LEX) $(MAPFILE.NGB)
67*df4628cbSrieMAPOPTS =	$(MAPFILES:%=-M%)
68*df4628cbSrie
697c478bd9Sstevel@tonic-gateMYCPPFLAGS =	-I ../common -I/usr/include/libxml2
707c478bd9Sstevel@tonic-gateCPPFLAGS +=	$(MYCPPFLAGS)
71*df4628cbSrieLDFLAGS +=	$(MAPOPTS)
727c478bd9Sstevel@tonic-gate
737c478bd9Sstevel@tonic-gateLFLAGS = -t
747c478bd9Sstevel@tonic-gateYFLAGS = -d
757c478bd9Sstevel@tonic-gate
767c478bd9Sstevel@tonic-gateCLOBBERFILES += svccfg_lex.c svccfg_grammar.c svccfg_grammar.h \
777c478bd9Sstevel@tonic-gate    $(MYPROG:%=%-native)
787c478bd9Sstevel@tonic-gate
7924da5b34SrieLAZYLIBS = $(ZLAZYLOAD) -lxml2 $(ZNOLAZYLOAD)
807c478bd9Sstevel@tonic-gateSVCCFG_EXTRA_LIBS = $(LAZYLIBS) -lscf -ll -luutil -lumem -lmd5
817c478bd9Sstevel@tonic-gate$(NOT_NATIVE)SVCCFG_EXTRA_LIBS += -ltecla
827c478bd9Sstevel@tonic-gate
837c478bd9Sstevel@tonic-gateLIBSCF		= $(SRC)/lib/libscf
847c478bd9Sstevel@tonic-gateLIBTECLA	= $(SRC)/lib/libtecla		# just for the header
857c478bd9Sstevel@tonic-gateLIBUUTIL	= $(SRC)/lib/libuutil
867c478bd9Sstevel@tonic-gate
877c478bd9Sstevel@tonic-gatedebug := COPTFLAG = -g
887c478bd9Sstevel@tonic-gate
897c478bd9Sstevel@tonic-gatelint := LINTFLAGS = -mux
907c478bd9Sstevel@tonic-gatelint := SVCCFG_EXTRA_LIBS = -lscf -ll -luutil -lumem -lmd5
917c478bd9Sstevel@tonic-gate
927c478bd9Sstevel@tonic-gateLDLIBS += $(SVCCFG_EXTRA_LIBS)
937c478bd9Sstevel@tonic-gate
947c478bd9Sstevel@tonic-gate$(NATIVE_BUILD)CC =	$(NATIVECC)
957c478bd9Sstevel@tonic-gate$(NATIVE_BUILD)LD =	$(NATIVELD)
967c478bd9Sstevel@tonic-gate$(NATIVE_BUILD)CFLAGS =	$(NATIVE_CFLAGS)
977c478bd9Sstevel@tonic-gate$(NATIVE_BUILD)CPPFLAGS = \
987c478bd9Sstevel@tonic-gate	-DNATIVE_BUILD \
997c478bd9Sstevel@tonic-gate	$(MYCPPFLAGS) \
1007c478bd9Sstevel@tonic-gate	-I$(LIBSCF)/inc \
1017c478bd9Sstevel@tonic-gate	-I$(LIBTECLA) \
1027c478bd9Sstevel@tonic-gate	-I$(LIBUUTIL)/common
1037c478bd9Sstevel@tonic-gate$(NATIVE_BUILD)LDFLAGS =
1047c478bd9Sstevel@tonic-gate$(NATIVE_BUILD)LDLIBS = \
1057c478bd9Sstevel@tonic-gate	-L$(LIBUUTIL)/native -R $(LIBUUTIL)/native \
1067c478bd9Sstevel@tonic-gate	-L$(LIBSCF)/native -R $(LIBSCF)/native \
1077c478bd9Sstevel@tonic-gate	$(SVCCFG_EXTRA_LIBS) -ldoor
1087c478bd9Sstevel@tonic-gate
1097c478bd9Sstevel@tonic-gatesvccfg_lex.o svccfg_grammar.o := CCVERBOSE =
1107c478bd9Sstevel@tonic-gate
1117c478bd9Sstevel@tonic-gatesvccfg_help.po := XGETFLAGS =	-a
1127c478bd9Sstevel@tonic-gate
1137c478bd9Sstevel@tonic-gate.KEEP_STATE:
1147c478bd9Sstevel@tonic-gate.PARALLEL: $(OBJS) $(LNTS)
1157c478bd9Sstevel@tonic-gate
1167c478bd9Sstevel@tonic-gateall debug: $(PROG)
1177c478bd9Sstevel@tonic-gate
1187c478bd9Sstevel@tonic-gatenative: FRC
1197c478bd9Sstevel@tonic-gate	@cd $(LIBUUTIL)/native; pwd; $(MAKE) $(MFLAGS) install
1207c478bd9Sstevel@tonic-gate	@cd $(LIBSCF)/native; pwd; $(MAKE) $(MFLAGS) install
1217c478bd9Sstevel@tonic-gate	@NATIVE_BUILD= $(MAKE) $(MFLAGS) all
1227c478bd9Sstevel@tonic-gate
123*df4628cbSrie$(PROG): $(OBJS) $(MAPFILES)
1247c478bd9Sstevel@tonic-gate	$(LINK.c) -o $@ $(OBJS) $(LDLIBS) $(CTFMERGE_HOOK)
1257c478bd9Sstevel@tonic-gate	$(POST_PROCESS)
1267c478bd9Sstevel@tonic-gate
1277c478bd9Sstevel@tonic-gate$(POFILE): $(POFILES)
1287c478bd9Sstevel@tonic-gate	cat $(POFILES) > $(POFILE)
1297c478bd9Sstevel@tonic-gate
1307c478bd9Sstevel@tonic-gateinstall: all $(ROOTUSRSBINPROG)
1317c478bd9Sstevel@tonic-gate
1327c478bd9Sstevel@tonic-gatesvccfg_lex.c: svccfg.l svccfg_grammar.h
1337c478bd9Sstevel@tonic-gate	$(LEX) $(LFLAGS) svccfg.l > $@
1347c478bd9Sstevel@tonic-gate
1357c478bd9Sstevel@tonic-gatesvccfg_help.o: svccfg_grammar.h
1367c478bd9Sstevel@tonic-gatesvccfg_help-native.o: svccfg_grammar.h
1377c478bd9Sstevel@tonic-gate
1387c478bd9Sstevel@tonic-gatesvccfg_grammar.h svccfg_grammar.c: svccfg.y
1397c478bd9Sstevel@tonic-gate	$(YACC) $(YFLAGS) svccfg.y
1407c478bd9Sstevel@tonic-gate	@$(MV) y.tab.h svccfg_grammar.h
1417c478bd9Sstevel@tonic-gate	@$(MV) y.tab.c svccfg_grammar.c
1427c478bd9Sstevel@tonic-gate
1437c478bd9Sstevel@tonic-gateclean: FRC
1447c478bd9Sstevel@tonic-gate	$(RM) $(MYOBJS) $(MYOBJS:%.o=%-native.o) $(LNTS)
1457c478bd9Sstevel@tonic-gate
1467c478bd9Sstevel@tonic-gatelint: $(LNTS)
1477c478bd9Sstevel@tonic-gate	$(LINT.c) $(LINTFLAGS) $(LNTS) $(LDLIBS)
1487c478bd9Sstevel@tonic-gate
1497c478bd9Sstevel@tonic-gate%-native.o: %.c
1507c478bd9Sstevel@tonic-gate	$(COMPILE.c) -o $@ $< $(CTFCONVERT_HOOK)
1517c478bd9Sstevel@tonic-gate	$(POST_PROCESS_O)
1527c478bd9Sstevel@tonic-gate
1537c478bd9Sstevel@tonic-gate%-native.o: ../common/%.c
1547c478bd9Sstevel@tonic-gate	$(COMPILE.c) -o $@ $< $(CTFCONVERT_HOOK)
1557c478bd9Sstevel@tonic-gate	$(POST_PROCESS_O)
1567c478bd9Sstevel@tonic-gate
1577c478bd9Sstevel@tonic-gate%.o: ../common/%.c
1587c478bd9Sstevel@tonic-gate	$(COMPILE.c) $(OUTPUT_OPTION) $< $(CTFCONVERT_HOOK)
1597c478bd9Sstevel@tonic-gate	$(POST_PROCESS_O)
1607c478bd9Sstevel@tonic-gate
1617c478bd9Sstevel@tonic-gate%.ln: ../common/%.c
1627c478bd9Sstevel@tonic-gate	$(LINT.c) $(OUTPUT_OPTION) -c $<
1637c478bd9Sstevel@tonic-gate
1647c478bd9Sstevel@tonic-gateinclude ../../Makefile.targ
1657c478bd9Sstevel@tonic-gate
1667c478bd9Sstevel@tonic-gateFRC:
167