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. 245661bb76SJohn Levon# Copyright (c) 2018, Joyent, Inc. 257c478bd9Sstevel@tonic-gate# 267c478bd9Sstevel@tonic-gate 277c478bd9Sstevel@tonic-gateMYPROG = svccfg 287c478bd9Sstevel@tonic-gatePROG = $(MYPROG) 297c478bd9Sstevel@tonic-gate 307c478bd9Sstevel@tonic-gateSRCS = svccfg_main.c \ 317c478bd9Sstevel@tonic-gate svccfg_engine.c \ 327c478bd9Sstevel@tonic-gate svccfg_internal.c \ 337c478bd9Sstevel@tonic-gate svccfg_libscf.c \ 341f6eb021SLiane Praza svccfg_tmpl.c \ 357c478bd9Sstevel@tonic-gate svccfg_xml.c \ 367c478bd9Sstevel@tonic-gate svccfg_help.c 377c478bd9Sstevel@tonic-gate 387c478bd9Sstevel@tonic-gateLNTS = $(SRCS:%.c=%.ln) \ 399444c26fSTom Whitten manifest_find.ln \ 407c478bd9Sstevel@tonic-gate manifest_hash.ln 417c478bd9Sstevel@tonic-gate 427c478bd9Sstevel@tonic-gateMYOBJS = $(SRCS:%.c=%.o) \ 437c478bd9Sstevel@tonic-gate svccfg_grammar.o \ 447c478bd9Sstevel@tonic-gate svccfg_lex.o \ 459444c26fSTom Whitten manifest_find.o \ 46f6e214c7SGavin Maltby manifest_hash.o \ 47f6e214c7SGavin Maltby notify_params.o 487c478bd9Sstevel@tonic-gateOBJS = $(MYOBJS) 497c478bd9Sstevel@tonic-gate 50299e09deSRichard LowePOFILES = $(SRCS:%.c=%.po) \ 517c478bd9Sstevel@tonic-gate svccfg_grammar.po \ 527c478bd9Sstevel@tonic-gate svccfg_lex.po \ 539444c26fSTom Whitten ../common/manifest_find.po \ 547c478bd9Sstevel@tonic-gate ../common/manifest_hash.po 557c478bd9Sstevel@tonic-gate 567c478bd9Sstevel@tonic-gateinclude ../../Makefile.cmd 57e0ad97e3SJonathan Adamsinclude ../../Makefile.ctf 587c478bd9Sstevel@tonic-gate 597c478bd9Sstevel@tonic-gatePOFILE = $(PROG)_all.po 607c478bd9Sstevel@tonic-gate 617c478bd9Sstevel@tonic-gateNATIVE_BUILD=$(POUND_SIGN) 627c478bd9Sstevel@tonic-gate$(NATIVE_BUILD)NOT_NATIVE=$(POUND_SIGN) 637c478bd9Sstevel@tonic-gate 647c478bd9Sstevel@tonic-gate$(NATIVE_BUILD)PROG = $(MYPROG:%=%-native) 657c478bd9Sstevel@tonic-gate$(NATIVE_BUILD)OBJS = $(MYOBJS:%.o=%-native.o) 667c478bd9Sstevel@tonic-gate 67df4628cbSrie# svccfg has a name clash with main() and libl.so.1. However, svccfg must 68df4628cbSrie# still export a number of "yy*" (libl) interfaces. Reduce all other symbols 69df4628cbSrie# to local scope. 70df4628cbSrieMAPFILES += $(MAPFILE.LEX) $(MAPFILE.NGB) 71df4628cbSrieMAPOPTS = $(MAPFILES:%=-M%) 72df4628cbSrie 73494f7e12SKeith M WesolowskiMYCPPFLAGS = -I ../common -I$(ADJUNCT_PROTO)/usr/include/libxml2 747c478bd9Sstevel@tonic-gateCPPFLAGS += $(MYCPPFLAGS) 75df4628cbSrieLDFLAGS += $(MAPOPTS) 767c478bd9Sstevel@tonic-gate 777014882cSRichard LoweCERRWARN += -_gcc=-Wno-unused-label 787014882cSRichard LoweCERRWARN += -_gcc=-Wno-implicit-function-declaration 797014882cSRichard LoweCERRWARN += -_gcc=-Wno-switch 80d3b5f563SJohn LevonCERRWARN += $(CNOWARN_UNINIT) 817014882cSRichard LoweCERRWARN += -_gcc=-Wno-unused-variable 827014882cSRichard LoweCERRWARN += -_gcc=-Wno-parentheses 837014882cSRichard Lowe 845661bb76SJohn Levon# not linted 855661bb76SJohn LevonSMATCH=off 865661bb76SJohn Levon 877c478bd9Sstevel@tonic-gateLFLAGS = -t 887c478bd9Sstevel@tonic-gateYFLAGS = -d 897c478bd9Sstevel@tonic-gate 907c478bd9Sstevel@tonic-gateCLOBBERFILES += svccfg_lex.c svccfg_grammar.c svccfg_grammar.h \ 917c478bd9Sstevel@tonic-gate $(MYPROG:%=%-native) 927c478bd9Sstevel@tonic-gate 93f6e214c7SGavin MaltbySVCCFG_EXTRA_LIBS = -lxml2 -lscf -ll -luutil -lumem -lmd5 -lnvpair 947c478bd9Sstevel@tonic-gate$(NOT_NATIVE)SVCCFG_EXTRA_LIBS += -ltecla 95*5801b0f0SToomas SoomeNATIVE_LIBS += libxml2.so 967c478bd9Sstevel@tonic-gate 977c478bd9Sstevel@tonic-gateLIBSCF = $(SRC)/lib/libscf 987c478bd9Sstevel@tonic-gateLIBTECLA = $(SRC)/lib/libtecla # just for the header 997c478bd9Sstevel@tonic-gateLIBUUTIL = $(SRC)/lib/libuutil 1007c478bd9Sstevel@tonic-gate 1017c478bd9Sstevel@tonic-gatelint := LINTFLAGS = -mux 102f6e214c7SGavin Maltbylint := SVCCFG_EXTRA_LIBS = -lscf -ll -luutil -lumem -lmd5 -lnvpair 1037c478bd9Sstevel@tonic-gate 1047c478bd9Sstevel@tonic-gateLDLIBS += $(SVCCFG_EXTRA_LIBS) 1057c478bd9Sstevel@tonic-gate 1067c478bd9Sstevel@tonic-gate$(NATIVE_BUILD)CC = $(NATIVECC) 1077c478bd9Sstevel@tonic-gate$(NATIVE_BUILD)LD = $(NATIVELD) 1087c478bd9Sstevel@tonic-gate$(NATIVE_BUILD)CFLAGS = $(NATIVE_CFLAGS) 1097c478bd9Sstevel@tonic-gate$(NATIVE_BUILD)CPPFLAGS = \ 1107c478bd9Sstevel@tonic-gate -DNATIVE_BUILD \ 1117c478bd9Sstevel@tonic-gate $(MYCPPFLAGS) \ 1127c478bd9Sstevel@tonic-gate -I$(LIBSCF)/inc \ 1137c478bd9Sstevel@tonic-gate -I$(LIBTECLA) \ 1147c478bd9Sstevel@tonic-gate -I$(LIBUUTIL)/common 115*5801b0f0SToomas Soome$(NATIVE_BUILD)LDFLAGS = $(BDIRECT) 1167c478bd9Sstevel@tonic-gate$(NATIVE_BUILD)LDLIBS = \ 1177c478bd9Sstevel@tonic-gate -L$(LIBUUTIL)/native -R $(LIBUUTIL)/native \ 1187c478bd9Sstevel@tonic-gate -L$(LIBSCF)/native -R $(LIBSCF)/native \ 119494f7e12SKeith M Wesolowski -L$(ADJUNCT_PROTO)/usr/lib -R$(ADJUNCT_PROTO)/usr/lib \ 1208afbae07SRod Evans $(SVCCFG_EXTRA_LIBS) 1217c478bd9Sstevel@tonic-gate 1227c478bd9Sstevel@tonic-gatesvccfg_lex.o svccfg_grammar.o := CCVERBOSE = 1237c478bd9Sstevel@tonic-gate 1247c478bd9Sstevel@tonic-gatesvccfg_help.po := XGETFLAGS = -a 1257c478bd9Sstevel@tonic-gate 1267c478bd9Sstevel@tonic-gate.KEEP_STATE: 1277c478bd9Sstevel@tonic-gate.PARALLEL: $(OBJS) $(LNTS) 1287c478bd9Sstevel@tonic-gate 1297c478bd9Sstevel@tonic-gateall debug: $(PROG) 1307c478bd9Sstevel@tonic-gate 1317c478bd9Sstevel@tonic-gatenative: FRC 1327c478bd9Sstevel@tonic-gate @cd $(LIBUUTIL)/native; pwd; $(MAKE) $(MFLAGS) install 1337c478bd9Sstevel@tonic-gate @cd $(LIBSCF)/native; pwd; $(MAKE) $(MFLAGS) install 1347c478bd9Sstevel@tonic-gate @NATIVE_BUILD= $(MAKE) $(MFLAGS) all 1357c478bd9Sstevel@tonic-gate 136df4628cbSrie$(PROG): $(OBJS) $(MAPFILES) 137e0ad97e3SJonathan Adams $(LINK.c) -o $@ $(OBJS) $(LDLIBS) 1387c478bd9Sstevel@tonic-gate $(POST_PROCESS) 1397c478bd9Sstevel@tonic-gate 1409e01f109SJason King$(POFILES): svccfg_grammar.h 1419e01f109SJason King 1427c478bd9Sstevel@tonic-gate$(POFILE): $(POFILES) 1437c478bd9Sstevel@tonic-gate cat $(POFILES) > $(POFILE) 1447c478bd9Sstevel@tonic-gate 1457c478bd9Sstevel@tonic-gateinstall: all $(ROOTUSRSBINPROG) 1467c478bd9Sstevel@tonic-gate 1477c478bd9Sstevel@tonic-gatesvccfg_lex.c: svccfg.l svccfg_grammar.h 1487c478bd9Sstevel@tonic-gate $(LEX) $(LFLAGS) svccfg.l > $@ 1497c478bd9Sstevel@tonic-gate 1507c478bd9Sstevel@tonic-gatesvccfg_help.o: svccfg_grammar.h 1517c478bd9Sstevel@tonic-gatesvccfg_help-native.o: svccfg_grammar.h 1527c478bd9Sstevel@tonic-gate 1537c478bd9Sstevel@tonic-gatesvccfg_grammar.h svccfg_grammar.c: svccfg.y 1547c478bd9Sstevel@tonic-gate $(YACC) $(YFLAGS) svccfg.y 1557c478bd9Sstevel@tonic-gate @$(MV) y.tab.h svccfg_grammar.h 1567c478bd9Sstevel@tonic-gate @$(MV) y.tab.c svccfg_grammar.c 1577c478bd9Sstevel@tonic-gate 1587c478bd9Sstevel@tonic-gateclean: FRC 1597c478bd9Sstevel@tonic-gate $(RM) $(MYOBJS) $(MYOBJS:%.o=%-native.o) $(LNTS) 1607c478bd9Sstevel@tonic-gate 1617c478bd9Sstevel@tonic-gatelint: $(LNTS) 1627c478bd9Sstevel@tonic-gate $(LINT.c) $(LINTFLAGS) $(LNTS) $(LDLIBS) 1637c478bd9Sstevel@tonic-gate 1647c478bd9Sstevel@tonic-gate%-native.o: %.c 165e0ad97e3SJonathan Adams $(COMPILE.c) -o $@ $< 1667c478bd9Sstevel@tonic-gate $(POST_PROCESS_O) 1677c478bd9Sstevel@tonic-gate 1687c478bd9Sstevel@tonic-gate%-native.o: ../common/%.c 169e0ad97e3SJonathan Adams $(COMPILE.c) -o $@ $< 1707c478bd9Sstevel@tonic-gate $(POST_PROCESS_O) 1717c478bd9Sstevel@tonic-gate 1727c478bd9Sstevel@tonic-gate%.o: ../common/%.c 173e0ad97e3SJonathan Adams $(COMPILE.c) $(OUTPUT_OPTION) $< 1747c478bd9Sstevel@tonic-gate $(POST_PROCESS_O) 1757c478bd9Sstevel@tonic-gate 1767c478bd9Sstevel@tonic-gate%.ln: ../common/%.c 1777c478bd9Sstevel@tonic-gate $(LINT.c) $(OUTPUT_OPTION) -c $< 1787c478bd9Sstevel@tonic-gate 1797c478bd9Sstevel@tonic-gateinclude ../../Makefile.targ 1807c478bd9Sstevel@tonic-gate 1817c478bd9Sstevel@tonic-gateFRC: 182