xref: /illumos-gate/usr/src/cmd/svc/startd/Makefile (revision 689b9301078f0c35c7f198fcee8032a0d30eff3a)
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 (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved.
23# Copyright 2012 Milan Jurik. All rights reserved.
24# Copyright 2016 Toomas Soome <tsoome@me.com>
25# Copyright (c) 2018, Joyent, Inc.
26# Copyright 2021 OmniOS Community Edition (OmniOSce) Association.
27#
28
29PROG = svc.startd
30OBJS = \
31	contract.o \
32	deathrow.o \
33	dict.o \
34	env.o \
35	expand.o \
36	file.o \
37	fork.o \
38	graph.o \
39	libscf.o \
40	log.o \
41	method.o \
42	misc.o \
43	protocol.o \
44	restarter.o \
45	specials.o \
46	startd.o \
47	transition.o \
48	wait.o \
49	utmpx.o
50
51ALLOBJS = $(OBJS) \
52	proc.o \
53	definit.o \
54	manifest_hash.o
55
56SRCS = $(OBJS:%.o=%.c) \
57	proc.c \
58	$(SRC)/common/definit/definit.c \
59	../common/manifest_hash.c
60
61POFILES = $(OBJS:%.o=%.po) \
62	proc.po \
63	../common/manifest_hash.po
64
65include ../../Makefile.cmd
66include ../../Makefile.ctf
67
68$(NOT_RELEASE_BUILD)CPPFLAGS += -DDEBUG
69CFLAGS += $(CCVERBOSE)
70CPPFLAGS += -I. -I../common -I$(SRC)/common/definit
71
72CERRWARN += -_gcc=-Wno-parentheses
73CERRWARN += -_gcc=-Wno-unused-label
74CERRWARN += -_gcc=-Wno-switch
75CERRWARN += $(CNOWARN_UNINIT)
76
77# these look like real bugs here, but ...
78SMOFF += impossible_mask,signed_integer_overflow_check
79
80$(OBJS) := CPPFLAGS += -D_FILE_OFFSET_BITS=64 -D_REENTRANT
81
82proc.o := CPPFLAGS += -D_REENTRANT
83
84%.o:	../common/%.c
85	$(COMPILE.c) $(OUTPUT_OPTION) $<
86	$(POST_PROCESS_O)
87
88%.o:	$(SRC)/common/definit/%.c
89	$(COMPILE.c) $(OUTPUT_OPTION) $<
90	$(POST_PROCESS_O)
91
92LDLIBS += \
93	-lcontract \
94	-lkstat \
95	-lmd5 \
96	-lnvpair \
97	-lrestart \
98	-lscf \
99	-lsysevent \
100	-lumem \
101	-luutil
102
103#
104# While svc.startd only searches for libfmevent, which is in
105# $(ROOT)/lib/fm, when resolving dependencies it needs to know to search
106# for those in $(ROOT)/usr/lib/fm. However, we don't need a runpath
107# because libfmevent has that properly set already, but it doesn't help
108# us during the build.
109#
110LDLIBS_i386 +=	-lbe
111LDLIBS +=	$(LDLIBS_$(MACH)) -L$(ROOT)/lib/fm -lfmevent \
112		-L$(ROOT)/usr/lib/fm
113LDFLAGS +=	-R/lib/fm
114
115FILEMODE = 0555
116
117.KEEP_STATE:
118
119.PARALLEL: $(ALLOBJS)
120
121all: $(PROG)
122
123$(PROG): $(ALLOBJS)
124	$(LINK.c) -o $@ $(ALLOBJS) $(LDLIBS) $(LDFLAGS) $(CTFMERGE_HOOK)
125	$(POST_PROCESS)
126
127$(POFILE): $(POFILES)
128	cat $(POFILES) > $(POFILE)
129
130install: all $(ROOTLIBSVCBINPROG)
131
132clean:
133	$(RM) $(ALLOBJS)
134
135include ../../Makefile.targ
136