xref: /illumos-gate/usr/src/cmd/svc/startd/Makefile (revision b30d193948be5a7794d7ae3ba0ed9c2f72c88e0f)
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#
27
28PROG = svc.startd
29OBJS = \
30	contract.o \
31	deathrow.o \
32	dict.o \
33	env.o \
34	expand.o \
35	file.o \
36	fork.o \
37	graph.o \
38	libscf.o \
39	log.o \
40	method.o \
41	misc.o \
42	protocol.o \
43	restarter.o \
44	specials.o \
45	startd.o \
46	transition.o \
47	wait.o \
48	utmpx.o
49
50ALLOBJS = $(OBJS) \
51	proc.o \
52	manifest_hash.o
53
54SRCS = $(OBJS:%.o=%.c) \
55	proc.c \
56	../common/manifest_hash.c
57
58POFILES = $(OBJS:%.o=%.po) \
59	proc.po \
60	../common/manifest_hash.po
61
62include ../../Makefile.cmd
63include ../../Makefile.ctf
64
65ROOTCMDDIR=	$(ROOT)/lib/svc/bin
66
67$(NOT_RELEASE_BUILD)CPPFLAGS += -DDEBUG
68CFLAGS += $(CCVERBOSE)
69CPPFLAGS += -I. -I../common
70
71CERRWARN += -_gcc=-Wno-parentheses
72CERRWARN += -_gcc=-Wno-unused-label
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%.ln:	../common/%.c
88	$(LINT.c) $(OUTPUT_OPTION) -c $<
89
90LDLIBS += \
91	-lcontract \
92	-lkstat \
93	-lmd5 \
94	-lnvpair \
95	-lrestart \
96	-lscf \
97	-lsysevent \
98	-lumem \
99	-luutil
100
101#
102# While svc.startd only searches for libfmevent, which is in
103# $(ROOT)/lib/fm, when resolving dependencies it needs to know to search
104# for those in $(ROOT)/usr/lib/fm. However, we don't need a runpath
105# because libfmevent has that properly set already, but it doesn't help
106# us during the build.
107#
108LDLIBS_i386 +=	-lbe
109LDLIBS +=	$(LDLIBS_$(MACH)) -L$(ROOT)/lib/fm -lfmevent \
110		-L$(ROOT)/usr/lib/fm
111LDFLAGS +=	-R/lib/fm
112
113FILEMODE = 0555
114
115# lint doesn't like the unused _umem_*_init()
116# And lint thinks uadmin() is undefined.
117lint_SRCS := LINTFLAGS += -U_FILE_OFFSET_BITS -xerroff=E_NAME_DEF_NOT_USED2 -u
118lint_SRCS := CPPFLAGS += \
119	-I. -I../common -D_REENTRANT -D_FILE_OFFSET_BITS=64
120
121.KEEP_STATE:
122
123.PARALLEL: $(ALLOBJS)
124
125all: $(PROG)
126
127$(PROG): $(ALLOBJS)
128	$(LINK.c) -o $@ $(ALLOBJS) $(LDLIBS) $(LDFLAGS) $(CTFMERGE_HOOK)
129	$(POST_PROCESS)
130
131$(POFILE): $(POFILES)
132	cat $(POFILES) > $(POFILE)
133
134install: all $(ROOTCMD)
135
136clean:
137	$(RM) $(ALLOBJS)
138
139lint:   lint_SRCS
140
141include ../../Makefile.targ
142