xref: /illumos-gate/usr/src/cmd/svc/configd/Makefile (revision 241c90a0)
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# Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
23# Use is subject to license terms.
24#
25# Copyright 2015 RackTop Systems.
26#
27# Copyright 2020 Joyent, Inc.
28#
29
30MYPROG = svc.configd
31MYOBJS = \
32	backend.o \
33	configd.o \
34	client.o \
35	file_object.o \
36	maindoor.o \
37	object.o \
38	rc_node.o \
39	snapshot.o
40
41PROG = $(MYPROG)
42OBJS = $(MYOBJS)
43
44SRCS = $(MYOBJS:%.o=%.c)
45
46include ../../Makefile.cmd
47include ../../Makefile.ctf
48
49NATIVE_BUILD=$(POUND_SIGN)
50$(NATIVE_BUILD)PROG = $(MYPROG:%=%-native)
51$(NATIVE_BUILD)OBJS = $(MYOBJS:%.o=%-native.o)
52
53ROOTCMDDIR=	$(ROOT)/lib/svc/bin
54
55MYCPPFLAGS = -I. -I../common -I../../../common/svc \
56	-I$(ROOT)/usr/include/sqlite-sys -D_REENTRANT
57CPPFLAGS += $(MYCPPFLAGS)
58CFLAGS	+= $(CCVERBOSE)
59CERRWARN += -_gcc=-Wno-parentheses
60CERRWARN += -_gcc=-Wno-type-limits
61CERRWARN += -_gcc=-Wno-unused-label
62CERRWARN += -_gcc=-Wno-unused-variable
63CERRWARN += -_gcc=-Wno-unused-function
64CERRWARN += $(CNOWARN_UNINIT)
65
66# strange false positive
67SMOFF += free
68
69MYLDLIBS = -lumem -luutil
70LDLIBS	+= -lsecdb -lbsm $(MYLDLIBS)
71
72CLOBBERFILES +=	$(MYPROG:%=%-native)
73
74LIBUUTIL	= $(SRC)/lib/libuutil
75LIBSCF		= $(SRC)/lib/libscf
76
77SCRIPTFILE	= restore_repository
78ROOTSCRIPTFILE	= $(ROOTCMDDIR)/$(SCRIPTFILE)
79
80#
81# Native variant (used in ../seed).
82#
83$(NATIVE_BUILD)NATIVE_LIBS += libumem.so libc.so
84$(NATIVE_BUILD)CC =	$(NATIVECC)
85$(NATIVE_BUILD)LD =	$(NATIVELD)
86$(NATIVE_BUILD)CFLAGS =	$(NATIVE_CFLAGS)
87$(NATIVE_BUILD)CPPFLAGS = $(MYCPPFLAGS) -I$(LIBUUTIL)/common -I$(LIBSCF)/inc
88$(NATIVE_BUILD)CPPFLAGS += -DNATIVE_BUILD
89$(NATIVE_BUILD)LDFLAGS = $(BDIRECT)
90$(NATIVE_BUILD)LDLIBS = -L$(ADJUNCT_PROTO)/usr/lib -R$(ADJUNCT_PROTO)/usr/lib \
91			-L$(LIBUUTIL)/native -R $(LIBUUTIL)/native $(MYLDLIBS)
92
93DIRMODE = 0755
94FILEMODE = 0555
95
96OBJSQLITE =
97LIBSQLITE = -lsqlite-sys
98$(NATIVE_BUILD)OBJSQLITE = $(ROOT)/lib/libsqlite-native.o
99$(NATIVE_BUILD)LIBSQLITE =
100
101OBJS += $(OBJSQLITE)
102LDLIBS += $(LIBSQLITE)
103
104install := TARGET = install
105clobber := TARGET = clobber
106
107.KEEP_STATE:
108.PARALLEL: $(MYOBJS) $(MYOBJS:%.o=%-native.o)
109
110all: $(PROG)
111
112native: FRC
113	@cd $(LIBUUTIL)/native; pwd; $(MAKE) $(MFLAGS) install
114	@NATIVE_BUILD= $(MAKE) $(MFLAGS) all
115
116$(PROG): $(OBJS)
117	$(LINK.c) -o $@ $(OBJS) $(LDLIBS)
118	$(POST_PROCESS)
119
120%-native.o: %.c
121	$(COMPILE.c) -o $@ $<
122	$(POST_PROCESS_O)
123
124$(ROOTCMDDIR)/%: %.sh
125	$(INS.rename)
126
127install: all $(ROOTCMD) $(ROOTVARSADMFILE) $(ROOTSCRIPTFILE)
128
129clean: FRC
130	$(RM) $(MYOBJS) $(MYOBJS:%.o=%-native.o)
131
132clobber:
133
134include ../../Makefile.targ
135
136FRC:
137