xref: /illumos-gate/usr/src/cmd/svc/startd/Makefile (revision 33efde4275d24731ef87927237b0ffb0630b6b2d)
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-switch
74CERRWARN += $(CNOWARN_UNINIT)
75
76# these look like real bugs here, but ...
77SMOFF += impossible_mask,signed_integer_overflow_check
78
79$(OBJS) := CPPFLAGS += -D_FILE_OFFSET_BITS=64 -D_REENTRANT
80
81proc.o := CPPFLAGS += -D_REENTRANT
82
83%.o:	../common/%.c
84	$(COMPILE.c) $(OUTPUT_OPTION) $<
85	$(POST_PROCESS_O)
86
87%.o:	$(SRC)/common/definit/%.c
88	$(COMPILE.c) $(OUTPUT_OPTION) $<
89	$(POST_PROCESS_O)
90
91LDLIBS += \
92	-lcontract \
93	-lkstat \
94	-lmd5 \
95	-lnvpair \
96	-lrestart \
97	-lscf \
98	-lsysevent \
99	-lumem \
100	-luutil
101
102#
103# While svc.startd only searches for libfmevent, which is in
104# $(ROOT)/lib/fm, when resolving dependencies it needs to know to search
105# for those in $(ROOT)/usr/lib/fm. However, we don't need a runpath
106# because libfmevent has that properly set already, but it doesn't help
107# us during the build.
108#
109LDLIBS_i386 +=	-lbe
110LDLIBS +=	$(LDLIBS_$(MACH)) -L$(ROOT)/lib/fm -lfmevent \
111		-L$(ROOT)/usr/lib/fm
112LDFLAGS +=	-R/lib/fm
113
114FILEMODE = 0555
115
116.KEEP_STATE:
117
118.PARALLEL: $(ALLOBJS)
119
120all: $(PROG)
121
122$(PROG): $(ALLOBJS)
123	$(LINK.c) -o $@ $(ALLOBJS) $(LDLIBS) $(LDFLAGS) $(CTFMERGE_HOOK)
124	$(POST_PROCESS)
125
126$(POFILE): $(POFILES)
127	cat $(POFILES) > $(POFILE)
128
129install: all $(ROOTLIBSVCBINPROG)
130
131clean:
132	$(RM) $(ALLOBJS)
133
134include ../../Makefile.targ
135