xref: /titanic_51/usr/src/cmd/svc/svccfg/Makefile (revision e07d9cb85217949d497b02d7211de8a197d2f2eb)
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 2007 Sun Microsystems, Inc.  All rights reserved.
24# Use is subject to license terms.
25#
26# ident	"%Z%%M%	%I%	%E% SMI"
27
28MYPROG =	svccfg
29PROG =		$(MYPROG)
30
31SRCS  =		svccfg_main.c \
32		svccfg_engine.c \
33		svccfg_internal.c \
34		svccfg_libscf.c \
35		svccfg_xml.c \
36		svccfg_help.c
37
38LNTS =		$(SRCS:%.c=%.ln) \
39		manifest_hash.ln
40
41MYOBJS =	$(SRCS:%.c=%.o) \
42		svccfg_grammar.o \
43		svccfg_lex.o \
44		manifest_hash.o
45OBJS =		$(MYOBJS)
46
47POFILES = 	$(SRCS:%.c=%.po) \
48		svccfg_grammar.po \
49		svccfg_lex.po \
50		../common/manifest_hash.po
51
52include ../../Makefile.cmd
53include ../Makefile.ctf
54
55POFILE =	$(PROG)_all.po
56
57NATIVE_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
63MYCPPFLAGS =	-I ../common -I/usr/include/libxml2
64CPPFLAGS +=	$(MYCPPFLAGS)
65LDFLAGS +=	$(MAPFILE.NGB:%=-M%)
66
67LFLAGS = -t
68YFLAGS = -d
69
70CLOBBERFILES += svccfg_lex.c svccfg_grammar.c svccfg_grammar.h \
71    $(MYPROG:%=%-native)
72
73LAZYLIBS = $(ZLAZYLOAD) -lxml2 $(ZNOLAZYLOAD)
74SVCCFG_EXTRA_LIBS = $(LAZYLIBS) -lscf -ll -luutil -lumem -lmd5
75$(NOT_NATIVE)SVCCFG_EXTRA_LIBS += -ltecla
76
77LIBSCF		= $(SRC)/lib/libscf
78LIBTECLA	= $(SRC)/lib/libtecla		# just for the header
79LIBUUTIL	= $(SRC)/lib/libuutil
80
81debug := COPTFLAG = -g
82
83lint := LINTFLAGS = -mux
84lint := SVCCFG_EXTRA_LIBS = -lscf -ll -luutil -lumem -lmd5
85
86LDLIBS += $(SVCCFG_EXTRA_LIBS)
87
88$(NATIVE_BUILD)CC =	$(NATIVECC)
89$(NATIVE_BUILD)LD =	$(NATIVELD)
90$(NATIVE_BUILD)CFLAGS =	$(NATIVE_CFLAGS)
91$(NATIVE_BUILD)CPPFLAGS = \
92	-DNATIVE_BUILD \
93	$(MYCPPFLAGS) \
94	-I$(LIBSCF)/inc \
95	-I$(LIBTECLA) \
96	-I$(LIBUUTIL)/common
97$(NATIVE_BUILD)LDFLAGS =
98$(NATIVE_BUILD)LDLIBS = \
99	-L$(LIBUUTIL)/native -R $(LIBUUTIL)/native \
100	-L$(LIBSCF)/native -R $(LIBSCF)/native \
101	$(SVCCFG_EXTRA_LIBS) -ldoor
102
103svccfg_lex.o svccfg_grammar.o := CCVERBOSE =
104
105svccfg_help.po := XGETFLAGS =	-a
106
107.KEEP_STATE:
108.PARALLEL: $(OBJS) $(LNTS)
109
110all debug: $(PROG)
111
112native: FRC
113	@cd $(LIBUUTIL)/native; pwd; $(MAKE) $(MFLAGS) install
114	@cd $(LIBSCF)/native; pwd; $(MAKE) $(MFLAGS) install
115	@NATIVE_BUILD= $(MAKE) $(MFLAGS) all
116
117$(PROG): $(OBJS) $(MAPFILE.NGB)
118	$(LINK.c) -o $@ $(OBJS) $(LDLIBS) $(CTFMERGE_HOOK)
119	$(POST_PROCESS)
120
121$(POFILE): $(POFILES)
122	cat $(POFILES) > $(POFILE)
123
124install: all $(ROOTUSRSBINPROG)
125
126svccfg_lex.c: svccfg.l svccfg_grammar.h
127	$(LEX) $(LFLAGS) svccfg.l > $@
128
129svccfg_help.o: svccfg_grammar.h
130svccfg_help-native.o: svccfg_grammar.h
131
132svccfg_grammar.h svccfg_grammar.c: svccfg.y
133	$(YACC) $(YFLAGS) svccfg.y
134	@$(MV) y.tab.h svccfg_grammar.h
135	@$(MV) y.tab.c svccfg_grammar.c
136
137clean: FRC
138	$(RM) $(MYOBJS) $(MYOBJS:%.o=%-native.o) $(LNTS)
139
140lint: $(LNTS)
141	$(LINT.c) $(LINTFLAGS) $(LNTS) $(LDLIBS)
142
143%-native.o: %.c
144	$(COMPILE.c) -o $@ $< $(CTFCONVERT_HOOK)
145	$(POST_PROCESS_O)
146
147%-native.o: ../common/%.c
148	$(COMPILE.c) -o $@ $< $(CTFCONVERT_HOOK)
149	$(POST_PROCESS_O)
150
151%.o: ../common/%.c
152	$(COMPILE.c) $(OUTPUT_OPTION) $< $(CTFCONVERT_HOOK)
153	$(POST_PROCESS_O)
154
155%.ln: ../common/%.c
156	$(LINT.c) $(OUTPUT_OPTION) -c $<
157
158include ../../Makefile.targ
159
160FRC:
161