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