xref: /titanic_50/usr/src/cmd/svc/svccfg/Makefile (revision 3db86aab554edbb4244c8d1a1c90f152eee768af)
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, Version 1.0 only
6# (the "License").  You may not use this file except in compliance
7# with the License.
8#
9# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10# or http://www.opensolaris.org/os/licensing.
11# See the License for the specific language governing permissions
12# and limitations under the License.
13#
14# When distributing Covered Code, include this CDDL HEADER in each
15# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16# If applicable, add the following below this CDDL HEADER, with the
17# fields enclosed by brackets "[]" replaced with your own identifying
18# information: Portions Copyright [yyyy] [name of copyright owner]
19#
20# CDDL HEADER END
21#
22#
23# Copyright 2005 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)
65
66LFLAGS = -t
67YFLAGS = -d
68
69CLOBBERFILES += svccfg_lex.c svccfg_grammar.c svccfg_grammar.h \
70    $(MYPROG:%=%-native)
71
72LAZYLIBS = -z lazyload -lxml2 -z nolazyload
73SVCCFG_EXTRA_LIBS = $(LAZYLIBS) -lscf -ll -luutil -lumem -lmd5
74$(NOT_NATIVE)SVCCFG_EXTRA_LIBS += -ltecla
75
76LIBSCF		= $(SRC)/lib/libscf
77LIBTECLA	= $(SRC)/lib/libtecla		# just for the header
78LIBUUTIL	= $(SRC)/lib/libuutil
79
80debug := COPTFLAG = -g
81
82lint := LINTFLAGS = -mux
83lint := SVCCFG_EXTRA_LIBS = -lscf -ll -luutil -lumem -lmd5
84
85LDLIBS += $(SVCCFG_EXTRA_LIBS)
86
87$(NATIVE_BUILD)CC =	$(NATIVECC)
88$(NATIVE_BUILD)LD =	$(NATIVELD)
89$(NATIVE_BUILD)CFLAGS =	$(NATIVE_CFLAGS)
90$(NATIVE_BUILD)CPPFLAGS = \
91	-DNATIVE_BUILD \
92	$(MYCPPFLAGS) \
93	-I$(LIBSCF)/inc \
94	-I$(LIBTECLA) \
95	-I$(LIBUUTIL)/common
96$(NATIVE_BUILD)LDFLAGS =
97$(NATIVE_BUILD)LDLIBS = \
98	-L$(LIBUUTIL)/native -R $(LIBUUTIL)/native \
99	-L$(LIBSCF)/native -R $(LIBSCF)/native \
100	$(SVCCFG_EXTRA_LIBS) -ldoor
101
102svccfg_lex.o svccfg_grammar.o := CCVERBOSE =
103
104svccfg_help.po := XGETFLAGS =	-a
105
106.KEEP_STATE:
107.PARALLEL: $(OBJS) $(LNTS)
108
109all debug: $(PROG)
110
111native: FRC
112	@cd $(LIBUUTIL)/native; pwd; $(MAKE) $(MFLAGS) install
113	@cd $(LIBSCF)/native; pwd; $(MAKE) $(MFLAGS) install
114	@NATIVE_BUILD= $(MAKE) $(MFLAGS) all
115
116$(PROG): $(OBJS)
117	$(LINK.c) -o $@ $(OBJS) $(LDLIBS) $(CTFMERGE_HOOK)
118	$(POST_PROCESS)
119
120$(POFILE): $(POFILES)
121	cat $(POFILES) > $(POFILE)
122
123install: all $(ROOTUSRSBINPROG)
124
125svccfg_lex.c: svccfg.l svccfg_grammar.h
126	$(LEX) $(LFLAGS) svccfg.l > $@
127
128svccfg_help.o: svccfg_grammar.h
129svccfg_help-native.o: svccfg_grammar.h
130
131svccfg_grammar.h svccfg_grammar.c: svccfg.y
132	$(YACC) $(YFLAGS) svccfg.y
133	@$(MV) y.tab.h svccfg_grammar.h
134	@$(MV) y.tab.c svccfg_grammar.c
135
136clean: FRC
137	$(RM) $(MYOBJS) $(MYOBJS:%.o=%-native.o) $(LNTS)
138
139lint: $(LNTS)
140	$(LINT.c) $(LINTFLAGS) $(LNTS) $(LDLIBS)
141
142%-native.o: %.c
143	$(COMPILE.c) -o $@ $< $(CTFCONVERT_HOOK)
144	$(POST_PROCESS_O)
145
146%-native.o: ../common/%.c
147	$(COMPILE.c) -o $@ $< $(CTFCONVERT_HOOK)
148	$(POST_PROCESS_O)
149
150%.o: ../common/%.c
151	$(COMPILE.c) $(OUTPUT_OPTION) $< $(CTFCONVERT_HOOK)
152	$(POST_PROCESS_O)
153
154%.ln: ../common/%.c
155	$(LINT.c) $(OUTPUT_OPTION) -c $<
156
157include ../../Makefile.targ
158
159FRC:
160