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# 23f6e214c7SGavin Maltby# Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved. 247c478bd9Sstevel@tonic-gate# 257c478bd9Sstevel@tonic-gate 267c478bd9Sstevel@tonic-gateMYPROG = svccfg 277c478bd9Sstevel@tonic-gatePROG = $(MYPROG) 287c478bd9Sstevel@tonic-gate 297c478bd9Sstevel@tonic-gateSRCS = svccfg_main.c \ 307c478bd9Sstevel@tonic-gate svccfg_engine.c \ 317c478bd9Sstevel@tonic-gate svccfg_internal.c \ 327c478bd9Sstevel@tonic-gate svccfg_libscf.c \ 331f6eb021SLiane Praza svccfg_tmpl.c \ 347c478bd9Sstevel@tonic-gate svccfg_xml.c \ 357c478bd9Sstevel@tonic-gate svccfg_help.c 367c478bd9Sstevel@tonic-gate 377c478bd9Sstevel@tonic-gateLNTS = $(SRCS:%.c=%.ln) \ 389444c26fSTom Whitten manifest_find.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 \ 449444c26fSTom Whitten manifest_find.o \ 45f6e214c7SGavin Maltby manifest_hash.o \ 46f6e214c7SGavin Maltby notify_params.o 477c478bd9Sstevel@tonic-gateOBJS = $(MYOBJS) 487c478bd9Sstevel@tonic-gate 497c478bd9Sstevel@tonic-gatePOFILES = $(SRCS:%.c=%.po) \ 507c478bd9Sstevel@tonic-gate svccfg_grammar.po \ 517c478bd9Sstevel@tonic-gate svccfg_lex.po \ 529444c26fSTom Whitten ../common/manifest_find.po \ 537c478bd9Sstevel@tonic-gate ../common/manifest_hash.po 547c478bd9Sstevel@tonic-gate 557c478bd9Sstevel@tonic-gateinclude ../../Makefile.cmd 56e0ad97e3SJonathan Adamsinclude ../../Makefile.ctf 577c478bd9Sstevel@tonic-gate 587c478bd9Sstevel@tonic-gatePOFILE = $(PROG)_all.po 597c478bd9Sstevel@tonic-gate 607c478bd9Sstevel@tonic-gateNATIVE_BUILD=$(POUND_SIGN) 617c478bd9Sstevel@tonic-gate$(NATIVE_BUILD)NOT_NATIVE=$(POUND_SIGN) 627c478bd9Sstevel@tonic-gate 637c478bd9Sstevel@tonic-gate$(NATIVE_BUILD)PROG = $(MYPROG:%=%-native) 647c478bd9Sstevel@tonic-gate$(NATIVE_BUILD)OBJS = $(MYOBJS:%.o=%-native.o) 657c478bd9Sstevel@tonic-gate 66df4628cbSrie# svccfg has a name clash with main() and libl.so.1. However, svccfg must 67df4628cbSrie# still export a number of "yy*" (libl) interfaces. Reduce all other symbols 68df4628cbSrie# to local scope. 69df4628cbSrieMAPFILES += $(MAPFILE.LEX) $(MAPFILE.NGB) 70df4628cbSrieMAPOPTS = $(MAPFILES:%=-M%) 71df4628cbSrie 72*494f7e12SKeith M WesolowskiMYCPPFLAGS = -I ../common -I$(ADJUNCT_PROTO)/usr/include/libxml2 737c478bd9Sstevel@tonic-gateCPPFLAGS += $(MYCPPFLAGS) 74df4628cbSrieLDFLAGS += $(MAPOPTS) 757c478bd9Sstevel@tonic-gate 767014882cSRichard LoweCERRWARN += -_gcc=-Wno-unused-label 777014882cSRichard LoweCERRWARN += -_gcc=-Wno-implicit-function-declaration 787014882cSRichard LoweCERRWARN += -_gcc=-Wno-switch 797014882cSRichard LoweCERRWARN += -_gcc=-Wno-uninitialized 807014882cSRichard LoweCERRWARN += -_gcc=-Wno-unused-variable 817014882cSRichard LoweCERRWARN += -_gcc=-Wno-parentheses 827014882cSRichard Lowe 837c478bd9Sstevel@tonic-gateLFLAGS = -t 847c478bd9Sstevel@tonic-gateYFLAGS = -d 857c478bd9Sstevel@tonic-gate 867c478bd9Sstevel@tonic-gateCLOBBERFILES += svccfg_lex.c svccfg_grammar.c svccfg_grammar.h \ 877c478bd9Sstevel@tonic-gate $(MYPROG:%=%-native) 887c478bd9Sstevel@tonic-gate 89f6e214c7SGavin MaltbySVCCFG_EXTRA_LIBS = -lxml2 -lscf -ll -luutil -lumem -lmd5 -lnvpair 907c478bd9Sstevel@tonic-gate$(NOT_NATIVE)SVCCFG_EXTRA_LIBS += -ltecla 917c478bd9Sstevel@tonic-gate 927c478bd9Sstevel@tonic-gateLIBSCF = $(SRC)/lib/libscf 937c478bd9Sstevel@tonic-gateLIBTECLA = $(SRC)/lib/libtecla # just for the header 947c478bd9Sstevel@tonic-gateLIBUUTIL = $(SRC)/lib/libuutil 957c478bd9Sstevel@tonic-gate 967c478bd9Sstevel@tonic-gatedebug := COPTFLAG = -g 977c478bd9Sstevel@tonic-gate 987c478bd9Sstevel@tonic-gatelint := LINTFLAGS = -mux 99f6e214c7SGavin Maltbylint := SVCCFG_EXTRA_LIBS = -lscf -ll -luutil -lumem -lmd5 -lnvpair 1007c478bd9Sstevel@tonic-gate 1017c478bd9Sstevel@tonic-gateLDLIBS += $(SVCCFG_EXTRA_LIBS) 1027c478bd9Sstevel@tonic-gate 1037c478bd9Sstevel@tonic-gate$(NATIVE_BUILD)CC = $(NATIVECC) 1047c478bd9Sstevel@tonic-gate$(NATIVE_BUILD)LD = $(NATIVELD) 1057c478bd9Sstevel@tonic-gate$(NATIVE_BUILD)CFLAGS = $(NATIVE_CFLAGS) 1067c478bd9Sstevel@tonic-gate$(NATIVE_BUILD)CPPFLAGS = \ 1077c478bd9Sstevel@tonic-gate -DNATIVE_BUILD \ 1087c478bd9Sstevel@tonic-gate $(MYCPPFLAGS) \ 1097c478bd9Sstevel@tonic-gate -I$(LIBSCF)/inc \ 1107c478bd9Sstevel@tonic-gate -I$(LIBTECLA) \ 1117c478bd9Sstevel@tonic-gate -I$(LIBUUTIL)/common 1127c478bd9Sstevel@tonic-gate$(NATIVE_BUILD)LDFLAGS = 1137c478bd9Sstevel@tonic-gate$(NATIVE_BUILD)LDLIBS = \ 1147c478bd9Sstevel@tonic-gate -L$(LIBUUTIL)/native -R $(LIBUUTIL)/native \ 1157c478bd9Sstevel@tonic-gate -L$(LIBSCF)/native -R $(LIBSCF)/native \ 116*494f7e12SKeith M Wesolowski -L$(ADJUNCT_PROTO)/usr/lib -R$(ADJUNCT_PROTO)/usr/lib \ 1178afbae07SRod Evans $(SVCCFG_EXTRA_LIBS) 1187c478bd9Sstevel@tonic-gate 1197c478bd9Sstevel@tonic-gatesvccfg_lex.o svccfg_grammar.o := CCVERBOSE = 1207c478bd9Sstevel@tonic-gate 1217c478bd9Sstevel@tonic-gatesvccfg_help.po := XGETFLAGS = -a 1227c478bd9Sstevel@tonic-gate 1237c478bd9Sstevel@tonic-gate.KEEP_STATE: 1247c478bd9Sstevel@tonic-gate.PARALLEL: $(OBJS) $(LNTS) 1257c478bd9Sstevel@tonic-gate 1267c478bd9Sstevel@tonic-gateall debug: $(PROG) 1277c478bd9Sstevel@tonic-gate 1287c478bd9Sstevel@tonic-gatenative: FRC 1297c478bd9Sstevel@tonic-gate @cd $(LIBUUTIL)/native; pwd; $(MAKE) $(MFLAGS) install 1307c478bd9Sstevel@tonic-gate @cd $(LIBSCF)/native; pwd; $(MAKE) $(MFLAGS) install 1317c478bd9Sstevel@tonic-gate @NATIVE_BUILD= $(MAKE) $(MFLAGS) all 1327c478bd9Sstevel@tonic-gate 133df4628cbSrie$(PROG): $(OBJS) $(MAPFILES) 134e0ad97e3SJonathan Adams $(LINK.c) -o $@ $(OBJS) $(LDLIBS) 1357c478bd9Sstevel@tonic-gate $(POST_PROCESS) 1367c478bd9Sstevel@tonic-gate 1377c478bd9Sstevel@tonic-gate$(POFILE): $(POFILES) 1387c478bd9Sstevel@tonic-gate cat $(POFILES) > $(POFILE) 1397c478bd9Sstevel@tonic-gate 1407c478bd9Sstevel@tonic-gateinstall: all $(ROOTUSRSBINPROG) 1417c478bd9Sstevel@tonic-gate 1427c478bd9Sstevel@tonic-gatesvccfg_lex.c: svccfg.l svccfg_grammar.h 1437c478bd9Sstevel@tonic-gate $(LEX) $(LFLAGS) svccfg.l > $@ 1447c478bd9Sstevel@tonic-gate 1457c478bd9Sstevel@tonic-gatesvccfg_help.o: svccfg_grammar.h 1467c478bd9Sstevel@tonic-gatesvccfg_help-native.o: svccfg_grammar.h 1477c478bd9Sstevel@tonic-gate 1487c478bd9Sstevel@tonic-gatesvccfg_grammar.h svccfg_grammar.c: svccfg.y 1497c478bd9Sstevel@tonic-gate $(YACC) $(YFLAGS) svccfg.y 1507c478bd9Sstevel@tonic-gate @$(MV) y.tab.h svccfg_grammar.h 1517c478bd9Sstevel@tonic-gate @$(MV) y.tab.c svccfg_grammar.c 1527c478bd9Sstevel@tonic-gate 1537c478bd9Sstevel@tonic-gateclean: FRC 1547c478bd9Sstevel@tonic-gate $(RM) $(MYOBJS) $(MYOBJS:%.o=%-native.o) $(LNTS) 1557c478bd9Sstevel@tonic-gate 1567c478bd9Sstevel@tonic-gatelint: $(LNTS) 1577c478bd9Sstevel@tonic-gate $(LINT.c) $(LINTFLAGS) $(LNTS) $(LDLIBS) 1587c478bd9Sstevel@tonic-gate 1597c478bd9Sstevel@tonic-gate%-native.o: %.c 160e0ad97e3SJonathan Adams $(COMPILE.c) -o $@ $< 1617c478bd9Sstevel@tonic-gate $(POST_PROCESS_O) 1627c478bd9Sstevel@tonic-gate 1637c478bd9Sstevel@tonic-gate%-native.o: ../common/%.c 164e0ad97e3SJonathan Adams $(COMPILE.c) -o $@ $< 1657c478bd9Sstevel@tonic-gate $(POST_PROCESS_O) 1667c478bd9Sstevel@tonic-gate 1677c478bd9Sstevel@tonic-gate%.o: ../common/%.c 168e0ad97e3SJonathan Adams $(COMPILE.c) $(OUTPUT_OPTION) $< 1697c478bd9Sstevel@tonic-gate $(POST_PROCESS_O) 1707c478bd9Sstevel@tonic-gate 1717c478bd9Sstevel@tonic-gate%.ln: ../common/%.c 1727c478bd9Sstevel@tonic-gate $(LINT.c) $(OUTPUT_OPTION) -c $< 1737c478bd9Sstevel@tonic-gate 1747c478bd9Sstevel@tonic-gateinclude ../../Makefile.targ 1757c478bd9Sstevel@tonic-gate 1767c478bd9Sstevel@tonic-gateFRC: 177