dmake: do not set MAKEFLAGS=k
[unleashed/tickless.git] / usr / src / cmd / svc / svccfg / Makefile
blob4d170b6666f1975316b74a474d4116f37a923c9e
2 # CDDL HEADER START
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.
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.
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]
19 # CDDL HEADER END
23 # Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved.
24 # Copyright 2017 Joyent, Inc.
27 MYPROG = svccfg
28 PROG = $(MYPROG)
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
38 LNTS = $(SRCS:%.c=%.ln) \
39 manifest_find.ln \
40 manifest_hash.ln
42 MYOBJS = $(SRCS:%.c=%.o) \
43 svccfg_grammar.o \
44 svccfg_lex.o \
45 manifest_find.o \
46 manifest_hash.o \
47 notify_params.o
48 OBJS = $(MYOBJS)
50 POFILES = $(SRCS:%.c=%.po) \
51 svccfg_grammar.po \
52 svccfg_lex.po \
53 ../common/manifest_find.po \
54 ../common/manifest_hash.po
56 include ../../Makefile.cmd
57 include ../../Makefile.ctf
59 POFILE = $(PROG)_all.po
61 NATIVE_BUILD=$(POUND_SIGN)
62 $(NATIVE_BUILD)NOT_NATIVE=$(POUND_SIGN)
64 $(NATIVE_BUILD)PROG = $(MYPROG:%=%-native)
65 $(NATIVE_BUILD)OBJS = $(MYOBJS:%.o=%-native.o)
67 # svccfg has a name clash with main() and libl.so.1. However, svccfg must
68 # still export a number of "yy*" (libl) interfaces. Reduce all other symbols
69 # to local scope.
70 MAPFILES += $(MAPFILE.LEX) $(MAPFILE.NGB)
71 MAPOPTS = $(MAPFILES:%=-Wl,-M%)
73 MYCPPFLAGS = -I ../common -I$(ADJUNCT_PROTO)/usr/include/libxml2
74 CPPFLAGS += $(MYCPPFLAGS)
75 LDFLAGS += $(MAPOPTS)
77 CERRWARN += -Wno-unused-label
78 CERRWARN += -Wno-implicit-function-declaration
79 CERRWARN += -Wno-switch
80 CERRWARN += -Wno-uninitialized
81 CERRWARN += -Wno-unused-variable
82 CERRWARN += -Wno-parentheses
84 LFLAGS += -t
85 YFLAGS = -d
87 CLOBBERFILES += svccfg_lex.c svccfg_grammar.c svccfg_grammar.h \
88 $(MYPROG:%=%-native)
90 SVCCFG_EXTRA_LIBS = -lxml2 -lscf -ll -luutil -lumem -lmd5 -lnvpair
91 $(NOT_NATIVE)SVCCFG_EXTRA_LIBS += -ltecla
93 LIBSCF = $(SRC)/lib/libscf
94 LIBTECLA = $(SRC)/lib/libtecla # just for the header
95 LIBUUTIL = $(SRC)/lib/libuutil
97 debug := COPTFLAG = -g
100 LDLIBS += $(SVCCFG_EXTRA_LIBS)
102 $(NATIVE_BUILD)CC = $(NATIVECC)
103 $(NATIVE_BUILD)LD = $(NATIVELD)
104 $(NATIVE_BUILD)CFLAGS = $(NATIVE_CFLAGS)
105 $(NATIVE_BUILD)CPPFLAGS = \
106 -DNATIVE_BUILD \
107 $(MYCPPFLAGS) \
108 -I$(LIBSCF)/inc \
109 -I$(LIBTECLA) \
110 -I$(LIBUUTIL)/common
111 $(NATIVE_BUILD)LDFLAGS =
112 $(NATIVE_BUILD)LDLIBS = \
113 -L$(LIBUUTIL)/native -R $(LIBUUTIL)/native \
114 -L$(LIBSCF)/native -R $(LIBSCF)/native \
115 -L$(ADJUNCT_PROTO)/usr/lib -R$(ADJUNCT_PROTO)/usr/lib \
116 $(SVCCFG_EXTRA_LIBS)
118 svccfg_help.po := XGETFLAGS = -a
120 .KEEP_STATE:
121 .PARALLEL: $(OBJS) $(LNTS)
123 all debug: $(PROG)
125 native: FRC
126 @cd $(LIBUUTIL)/native; pwd; $(MAKE) $(MFLAGS) install
127 @cd $(LIBSCF)/native; pwd; $(MAKE) $(MFLAGS) install
128 @NATIVE_BUILD= $(MAKE) $(MFLAGS) all
130 $(PROG): $(OBJS) $(MAPFILES)
131 $(LINK.c) -o $@ $(OBJS) $(LDLIBS)
132 $(POST_PROCESS)
134 $(POFILES): svccfg_grammar.h
136 $(POFILE): $(POFILES)
137 cat $(POFILES) > $(POFILE)
139 install: all $(ROOTUSRSBINPROG)
141 svccfg_lex.c: svccfg.l svccfg_grammar.h
142 $(LEX) $(LFLAGS) svccfg.l > $@
144 svccfg_help.o: svccfg_grammar.h
145 svccfg_help-native.o: svccfg_grammar.h
147 svccfg_grammar.h svccfg_grammar.c: svccfg.y
148 $(YACC) $(YFLAGS) svccfg.y
149 @$(MV) y.tab.h svccfg_grammar.h
150 @$(MV) y.tab.c svccfg_grammar.c
152 clean: FRC
153 $(RM) $(MYOBJS) $(MYOBJS:%.o=%-native.o) $(LNTS)
155 %-native.o: %.c
156 $(COMPILE.c) -o $@ $<
157 $(POST_PROCESS_O)
159 %-native.o: ../common/%.c
160 $(COMPILE.c) -o $@ $<
161 $(POST_PROCESS_O)
163 %.o: ../common/%.c
164 $(COMPILE.c) $(OUTPUT_OPTION) $<
165 $(POST_PROCESS_O)
167 include ../../Makefile.targ
169 FRC: