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