xref: /illumos-gate/usr/src/cmd/svc/configd/Makefile (revision 1e8d79d21400b4e47d64ce367181e7e5ce992649)
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
53MYCPPFLAGS = -I. -I../common -I../../../common/svc \
54	-I$(ROOT)/usr/include/sqlite-sys -D_REENTRANT
55CPPFLAGS += $(MYCPPFLAGS)
56CFLAGS	+= $(CCVERBOSE)
57CERRWARN += -_gcc=-Wno-parentheses
58CERRWARN += -_gcc=-Wno-type-limits
59CERRWARN += -_gcc=-Wno-unused-label
60CERRWARN += -_gcc=-Wno-unused-variable
61CERRWARN += -_gcc=-Wno-unused-function
62CERRWARN += $(CNOWARN_UNINIT)
63
64# strange false positive
65SMOFF += free
66
67MYLDLIBS = -lumem -luutil
68LDLIBS	+= -lsecdb -lbsm $(MYLDLIBS)
69
70CLOBBERFILES +=	$(MYPROG:%=%-native)
71
72LIBUUTIL	= $(SRC)/lib/libuutil
73LIBSCF		= $(SRC)/lib/libscf
74
75SCRIPTFILE	= restore_repository
76ROOTSCRIPTFILE	= $(ROOTLIBSVCBIN)/$(SCRIPTFILE)
77
78#
79# Native variant (used in ../seed).
80#
81$(NATIVE_BUILD)NATIVE_LIBS += libumem.so libc.so
82$(NATIVE_BUILD)CC =	$(NATIVECC)
83$(NATIVE_BUILD)LD =	$(NATIVELD)
84$(NATIVE_BUILD)CFLAGS =	$(NATIVE_CFLAGS)
85$(NATIVE_BUILD)CPPFLAGS = $(MYCPPFLAGS) -I$(LIBUUTIL)/common -I$(LIBSCF)/inc
86$(NATIVE_BUILD)CPPFLAGS += -DNATIVE_BUILD
87$(NATIVE_BUILD)LDFLAGS = $(BDIRECT)
88$(NATIVE_BUILD)LDLIBS = -L$(ADJUNCT_PROTO)/usr/lib -R$(ADJUNCT_PROTO)/usr/lib \
89			-L$(LIBUUTIL)/native -R $(LIBUUTIL)/native $(MYLDLIBS)
90
91DIRMODE = 0755
92FILEMODE = 0555
93
94OBJSQLITE =
95LIBSQLITE = -lsqlite-sys
96$(NATIVE_BUILD)OBJSQLITE = $(ROOT)/lib/libsqlite-native.o
97$(NATIVE_BUILD)LIBSQLITE =
98
99OBJS += $(OBJSQLITE)
100LDLIBS += $(LIBSQLITE)
101
102install := TARGET = install
103clobber := TARGET = clobber
104
105.KEEP_STATE:
106.PARALLEL: $(MYOBJS) $(MYOBJS:%.o=%-native.o)
107
108all: $(PROG)
109
110native: FRC
111	@cd $(LIBUUTIL)/native; pwd; $(MAKE) install
112	@NATIVE_BUILD= $(MAKE) all
113
114$(PROG): $(OBJS)
115	$(LINK.c) -o $@ $(OBJS) $(LDLIBS)
116	$(POST_PROCESS)
117
118%-native.o: %.c
119	$(COMPILE.c) -o $@ $<
120	$(POST_PROCESS_O)
121
122$(ROOTLIBSVCBIN)/%: %.sh
123	$(INS.rename)
124
125install: all $(ROOTLIBSVCBINPROG) $(ROOTVARSADMFILE) $(ROOTSCRIPTFILE)
126
127clean: FRC
128	$(RM) $(MYOBJS) $(MYOBJS:%.o=%-native.o)
129
130clobber:
131
132include ../../Makefile.targ
133
134FRC:
135