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