xref: /illumos-gate/usr/src/cmd/allocate/Makefile (revision 8226594fdd4479be135127f43632f1f995074654)
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#
23# Copyright (c) 1992, 2010, Oracle and/or its affiliates. All rights reserved.
24#
25# Copyright (c) 2018, Joyent, Inc.
26
27ETCTSOLFILES =	devalloc_defaults
28
29include		../Makefile.cmd
30
31CERRWARN +=	-_gcc=-Wno-unused-value
32CERRWARN +=	$(CNOWARN_UNINIT)
33CERRWARN +=	-_gcc=-Wno-parentheses
34CERRWARN +=	-_gcc=-Wno-clobbered
35
36# not linted
37SMATCH=off
38
39ROOTSEC =	$(ROOTETC)/security
40ROOTSECDEV =	$(ROOTSEC)/dev
41ROOTSECLIB =	$(ROOTSEC)/lib
42ROOTSECAUD =	$(ROOTSEC)/audio
43ROOTDIRS =	$(ROOTSECDEV) $(ROOTSECLIB) $(ROOTSECAUD)
44
45ROOTMANIFESTDIR=	$(ROOTSVCSYSTEMDEVICE)
46SVCMETHOD =	svc-allocate
47MANIFEST =	allocate.xml
48
49RTLCKS =	audio fd0 sr0 st0 st1
50CLEANfd =	fd_clean
51CLEANsr =	sr_clean
52CLEANst =	st_clean
53CLEANaudio =	audio_clean
54CLEANdisk =	disk_clean
55CLEAN_SCRIPTS =	$(CLEANfd) $(CLEANsr) $(CLEANst) $(CLEANaudio) $(CLEANdisk)
56WDW_SCRIPTS =	wdwmsg wdwwrapper
57WDW_LINKS =	$(CLEANaudio) $(CLEANdisk) $(CLEANst)
58SCRIPTS =	$(CLEAN_SCRIPTS) $(WDW_SCRIPTS)
59ALLSCRIPTS =	allscripts.sh
60
61PROGalloc =	allocate
62PROGmkdevalloc =	mkdevalloc
63PROGdminfo =	dminfo
64PROGaddalloc =	add_allocatable
65PROG =		$(PROGalloc) $(PROGmkdevalloc) $(PROGdminfo) \
66	$(PROGaddalloc)
67
68LINKPROGalloc =	deallocate list_devices
69LINKPROGmkdevalloc = mkdevmaps
70LINKPROGaddalloc = remove_allocatable
71
72POFILE =	allocate_all.po
73POFILES =	$(OBJS:%.o=%.po) $(ALLSCRIPTS:%.sh=%.po)
74
75DFLAGS +=	-D_REENTRANT
76CPPFLAGS +=	$(DFLAGS)
77
78ROOTLOCKS =	$(RTLCKS:%=$(ROOTSECDEV)/%)
79ROOTSCRIPTS =	$(SCRIPTS:%=$(ROOTSECLIB)/%)
80ROOTWDWLINKS =	$(WDW_LINKS:%=$(ROOTSECLIB)/%.windowing)
81
82ROOTPROG =	$(PROGallocate:%=$(ROOTUSRSBIN)/%) \
83		$(PROGmkdevalloc:%=$(ROOTUSRSBIN)/%) \
84		$(PROGdminfo:%=$(ROOTUSRSBIN)/%) \
85		$(PROGaddaloc:%=$(ROOTUSRSBIN)/%)
86ROOTLINKalloc =	$(LINKPROGalloc:%=$(ROOTUSRSBIN)/%)
87ROOTLINKmkdevalloc = $(LINKPROGmkdevalloc:%=$(ROOTUSRSBIN)/%)
88ROOTLINKaddalloc = $(LINKPROGaddalloc:%=$(ROOTUSRSBIN)/%)
89ROOTLINKS =	$(ROOTLINKalloc) $(ROOTLINKmkdevalloc) $(ROOTLINKaddalloc)
90
91PROGallocOBJS =		allocate.o allocate3.o
92PROGmkdevallocOBJS =	mkdevalloc.o
93PROGdminfoOBJS =	dminfo.o
94PROGaddallocOBJS =	add_allocatable.o
95
96OBJS =		$(PROGallocOBJS) \
97		$(PROGmkdevallocOBJS) \
98		$(PROGdminfoOBJS) \
99		$(PROGaddallocOBJS)
100
101SRCS =		$(OBJS:%.o=%.c)
102
103$(ROOTUSRSBIN)/% :=	FILEMODE = 555
104$(ROOTUSRSBIN)/allocate :=	FILEMODE = 4555
105$(ROOTSECDEV)/% :=	FILEMODE = 0400
106$(ROOTSECLIB)/% :=	FILEMODE = 0555
107
108lint :=			LDLIBS += -lbsm -lsec -lsecdb -ldevinfo -ltsol
109
110$(PROGalloc) :=		LDLIBS += -lbsm -lsec -lsecdb -ldevinfo -ltsol
111$(PROGmkdevalloc) :=	LDLIBS += -lbsm
112$(PROGdminfo) :=	LDLIBS += -lbsm
113$(PROGaddalloc) :=	LDLIBS += -lbsm -lsecdb -ltsol
114
115CLOBBERFILES +=	$(SCRIPTS)
116
117.KEEP_STATE:
118
119all :		$(PROG) $(RTLCKS) $(SCRIPTS)
120
121install :	$(PROG) $(ROOTDIRS) $(ROOTPROG) $(ROOTLOCKS) \
122		$(ROOTSCRIPTS) $(ROOTLINKS) $(ROOTWDWLINKS) \
123		$(ROOTETCTSOLFILES) $(ROOTMANIFEST) $(ROOTSVCMETHOD)
124$(RTLCKS):
125		$(TOUCH) $@
126
127$(ROOTSECLIB)/%: %.sh
128		$(INS.rename)
129
130$(PROGalloc) :	$(PROGallocOBJS)
131		$(LINK.c) $(PROGallocOBJS) -o $@ $(LDLIBS)
132		$(POST_PROCESS)
133
134$(PROGaddalloc) :	$(PROGaddallocOBJS)
135		$(LINK.c) $(PROGaddallocOBJS) -o $@ $(LDLIBS)
136		$(POST_PROCESS)
137
138$(PROGmkdevalloc) :	$(PROGmkdevallocOBJS)
139			$(LINK.c) $(PROGmkdevallocOBJS) -o $@ $(LDLIBS)
140			$(POST_PROCESS)
141
142$(PROGdminfo) :	$(PROGdminfoOBJS)
143		$(LINK.c) $(PROGdminfoOBJS) -o $@ $(LDLIBS)
144		$(POST_PROCESS)
145
146$(ROOTDIRS) :
147		$(INS.dir)
148
149$(ROOTSECDEV)/%: %
150		$(INS.file)
151
152$(ROOTSECLIB)/%: %
153		$(RM) $@
154		$(INS.file)
155
156$(ROOTLINKalloc) :	$(PROGalloc:%=$(ROOTUSRSBIN)/%)
157			$(RM) $@
158			$(LN) $(PROGalloc:%=$(ROOTUSRSBIN)/%) $@
159
160$(ROOTLINKaddalloc) :	$(PROGaddalloc:%=$(ROOTUSRSBIN)/%)
161			$(RM) $@
162			$(LN) $(PROGaddalloc:%=$(ROOTUSRSBIN)/%) $@
163
164$(ROOTLINKmkdevalloc) :	$(PROGmkdevalloc:%=$(ROOTUSRSBIN)/%)
165			$(RM) $@
166			$(LN) $(PROGmkdevalloc:%=$(ROOTUSRSBIN)/%) $@
167
168
169$(ROOTETCSECLIB)/%.windowing: %
170	$(RM) $@
171	$(SYMLINK) $< $@
172
173$(POFILE):      $(POFILES)
174		$(RM) $@
175		$(CAT) $(POFILES) > $@
176
177#
178# Concatenate all the scripts into one before we build the catalogue.
179# Done to shrink the catalogue since some messages are shared between
180# the various scripts.
181#
182$(ALLSCRIPTS):	$(SCRIPTS:%=%.sh)
183		$(CAT) $(SCRIPTS:%=%.sh) > $@
184
185clean :
186		$(RM) $(PROG) $(RTLCKS) $(OBJS) \
187		$(SCRIPTS) $(ALLSCRIPTS) $(POFILE) $(POFILES)
188
189lint :		lint_SRCS
190
191strip :
192		$(STRIP) $(PROG)
193
194include		../Makefile.targ
195