1 # 2 # CDDL HEADER START 3 # 4 # The contents of this file are subject to the terms of the 5 # Common Development and Distribution License (the "License"). 6 # You may not use this file except in compliance with the License. 7 # 8 # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 9 # or http://www.opensolaris.org/os/licensing. 10 # See the License for the specific language governing permissions 11 # and limitations under the License. 12 # 13 # When distributing Covered Code, include this CDDL HEADER in each 14 # file and include the License file at usr/src/OPENSOLARIS.LICENSE. 15 # If applicable, add the following below this CDDL HEADER, with the 16 # fields enclosed by brackets "[]" replaced with your own identifying 17 # information: Portions Copyright [yyyy] [name of copyright owner] 18 # 19 # CDDL HEADER END 20 # 21 22 # 23 # Copyright 2009 Sun Microsystems, Inc. All rights reserved. 24 # Use is subject to license terms. 25 # 26 27 MYPROG = svccfg 28 PROG = $(MYPROG) 29 30 SRCS = svccfg_main.c \ 31 svccfg_engine.c \ 32 svccfg_internal.c \ 33 svccfg_libscf.c \ 34 svccfg_tmpl.c \ 35 svccfg_xml.c \ 36 svccfg_help.c 37 38 LNTS = $(SRCS:%.c=%.ln) \ 39 manifest_hash.ln 40 41 MYOBJS = $(SRCS:%.c=%.o) \ 42 svccfg_grammar.o \ 43 svccfg_lex.o \ 44 manifest_hash.o 45 OBJS = $(MYOBJS) 46 47 POFILES = $(SRCS:%.c=%.po) \ 48 svccfg_grammar.po \ 49 svccfg_lex.po \ 50 ../common/manifest_hash.po 51 52 include ../../Makefile.cmd 53 include ../../Makefile.ctf 54 55 POFILE = $(PROG)_all.po 56 57 NATIVE_BUILD=$(POUND_SIGN) 58 $(NATIVE_BUILD)NOT_NATIVE=$(POUND_SIGN) 59 60 $(NATIVE_BUILD)PROG = $(MYPROG:%=%-native) 61 $(NATIVE_BUILD)OBJS = $(MYOBJS:%.o=%-native.o) 62 63 # svccfg has a name clash with main() and libl.so.1. However, svccfg must 64 # still export a number of "yy*" (libl) interfaces. Reduce all other symbols 65 # to local scope. 66 MAPFILES += $(MAPFILE.LEX) $(MAPFILE.NGB) 67 MAPOPTS = $(MAPFILES:%=-M%) 68 69 MYCPPFLAGS = -I ../common -I/usr/include/libxml2 70 CPPFLAGS += $(MYCPPFLAGS) 71 LDFLAGS += $(MAPOPTS) 72 73 LFLAGS = -t 74 YFLAGS = -d 75 76 CLOBBERFILES += svccfg_lex.c svccfg_grammar.c svccfg_grammar.h \ 77 $(MYPROG:%=%-native) 78 79 SVCCFG_EXTRA_LIBS = -lxml2 -lscf -ll -luutil -lumem -lmd5 80 $(NOT_NATIVE)SVCCFG_EXTRA_LIBS += -ltecla 81 82 LIBSCF = $(SRC)/lib/libscf 83 LIBTECLA = $(SRC)/lib/libtecla # just for the header 84 LIBUUTIL = $(SRC)/lib/libuutil 85 86 debug := COPTFLAG = -g 87 88 lint := LINTFLAGS = -mux 89 lint := SVCCFG_EXTRA_LIBS = -lscf -ll -luutil -lumem -lmd5 90 91 LDLIBS += $(SVCCFG_EXTRA_LIBS) 92 93 $(NATIVE_BUILD)CC = $(NATIVECC) 94 $(NATIVE_BUILD)LD = $(NATIVELD) 95 $(NATIVE_BUILD)CFLAGS = $(NATIVE_CFLAGS) 96 $(NATIVE_BUILD)CPPFLAGS = \ 97 -DNATIVE_BUILD \ 98 $(MYCPPFLAGS) \ 99 -I$(LIBSCF)/inc \ 100 -I$(LIBTECLA) \ 101 -I$(LIBUUTIL)/common 102 $(NATIVE_BUILD)LDFLAGS = 103 $(NATIVE_BUILD)LDLIBS = \ 104 -L$(LIBUUTIL)/native -R $(LIBUUTIL)/native \ 105 -L$(LIBSCF)/native -R $(LIBSCF)/native \ 106 $(SVCCFG_EXTRA_LIBS) 107 108 svccfg_lex.o svccfg_grammar.o := CCVERBOSE = 109 110 svccfg_help.po := XGETFLAGS = -a 111 112 .KEEP_STATE: 113 .PARALLEL: $(OBJS) $(LNTS) 114 115 all debug: $(PROG) 116 117 native: FRC 118 @cd $(LIBUUTIL)/native; pwd; $(MAKE) $(MFLAGS) install 119 @cd $(LIBSCF)/native; pwd; $(MAKE) $(MFLAGS) install 120 @NATIVE_BUILD= $(MAKE) $(MFLAGS) all 121 122 $(PROG): $(OBJS) $(MAPFILES) 123 $(LINK.c) -o $@ $(OBJS) $(LDLIBS) 124 $(POST_PROCESS) 125 126 $(POFILE): $(POFILES) 127 cat $(POFILES) > $(POFILE) 128 129 install: all $(ROOTUSRSBINPROG) 130 131 svccfg_lex.c: svccfg.l svccfg_grammar.h 132 $(LEX) $(LFLAGS) svccfg.l > $@ 133 134 svccfg_help.o: svccfg_grammar.h 135 svccfg_help-native.o: svccfg_grammar.h 136 137 svccfg_grammar.h svccfg_grammar.c: svccfg.y 138 $(YACC) $(YFLAGS) svccfg.y 139 @$(MV) y.tab.h svccfg_grammar.h 140 @$(MV) y.tab.c svccfg_grammar.c 141 142 clean: FRC 143 $(RM) $(MYOBJS) $(MYOBJS:%.o=%-native.o) $(LNTS) 144 145 lint: $(LNTS) 146 $(LINT.c) $(LINTFLAGS) $(LNTS) $(LDLIBS) 147 148 %-native.o: %.c 149 $(COMPILE.c) -o $@ $< 150 $(POST_PROCESS_O) 151 152 %-native.o: ../common/%.c 153 $(COMPILE.c) -o $@ $< 154 $(POST_PROCESS_O) 155 156 %.o: ../common/%.c 157 $(COMPILE.c) $(OUTPUT_OPTION) $< 158 $(POST_PROCESS_O) 159 160 %.ln: ../common/%.c 161 $(LINT.c) $(OUTPUT_OPTION) -c $< 162 163 include ../../Makefile.targ 164 165 FRC: 166