xref: /titanic_41/usr/src/cmd/allocate/Makefile (revision 724365f7556fc4201fdb11766ebc6bd918523130)
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 2006 Sun Microsystems, Inc.  All rights reserved.
24# Use is subject to license terms.
25#
26# ident	"%Z%%M%	%I%	%E% SMI"
27#
28
29include		../Makefile.cmd
30
31ROOTSEC =	$(ROOTETC)/security
32ROOTSECDEV =	$(ROOTSEC)/dev
33ROOTSECLIB =	$(ROOTSEC)/lib
34ROOTDIRS =	$(ROOTSECDEV) $(ROOTSECLIB)
35
36RTLCKS =	audio fd0 sr0 st0 st1
37SCRIPTS =	fd_clean  sr_clean  st_clean
38ALLSCRIPTS =	allscripts.sh
39
40PROGalloc =	allocate
41PROGmkdevalloc =	mkdevalloc
42PROGdminfo =	dminfo
43PROGaudio =	audio_clean
44PROG =		$(PROGalloc) $(PROGmkdevalloc) $(PROGdminfo) $(PROGaudio)
45
46LINKPROGalloc =	deallocate list_devices
47LINKPROGmkdevalloc = mkdevmaps
48
49
50POFILE =	allocate_all.po
51POFILES =	$(OBJS:%.o=%.po) $(ALLSCRIPTS:%.sh=%.po)
52
53DFLAGS +=	-D_REENTRANT
54CPPFLAGS +=	$(DFLAGS)
55
56ROOTLOCKS =	$(RTLCKS:%=$(ROOTSECDEV)/%)
57ROOTSCRIPTS =	$(SCRIPTS:%=$(ROOTSECLIB)/%)
58
59ROOTPROG =	$(PROGallocate:%=$(ROOTUSRSBIN)/%) \
60		$(PROGmkdevalloc:%=$(ROOTUSRSBIN)/%) \
61		$(PROGdminfo:%=$(ROOTUSRSBIN)/%) \
62		$(PROGaudio:%=$(ROOTSECLIB)/%)
63ROOTLINKalloc =	$(LINKPROGalloc:%=$(ROOTUSRSBIN)/%)
64ROOTLINKmkdevalloc = $(LINKPROGmkdevalloc:%=$(ROOTUSRSBIN)/%)
65ROOTLINKS =	$(ROOTLINKalloc) $(ROOTLINKmkdevalloc)
66
67PROGallocOBJS =		allocate.o allocate3.o
68PROGmkdevallocOBJS =	mkdevalloc.o
69PROGdminfoOBJS =	dminfo.o
70PROGaudioOBJS =		audio_clean.o
71
72OBJS =		$(PROGallocOBJS) \
73		$(PROGmkdevallocOBJS) \
74		$(PROGdminfoOBJS) \
75		$(PROGaudioOBJS)
76
77SRCS =		$(OBJS:%.o=%.c)
78
79$(ROOTUSRSBIN)/% :=	FILEMODE = 555
80$(ROOTUSRSBIN)/allocate :=	FILEMODE = 4555
81$(ROOTUSRSBIN)/% :=     OWNER = root
82$(ROOTUSRSBIN)/% :=     GROUP = bin
83$(ROOTSECDEV)/% :=	FILEMODE = 0400
84$(ROOTSECDEV)/% :=	OWNER = root
85$(ROOTSECDEV)/% :=	GROUP = bin
86$(ROOTSECLIB)/% :=	FILEMODE = 0555
87$(ROOTSECLIB)/% :=	OWNER = root
88$(ROOTSECLIB)/% :=	GROUP = sys
89
90LAZYLIBS =	$(ZLAZYLOAD) -ltsol -lgen $(ZNOLAZYLOAD)
91lint :=		LDLIBS += -lbsm -lsec -lsecdb -ltsol -lgen
92$(PROGalloc) :=		LDLIBS += -lbsm -lsec -lsecdb $(LAZYLIBS)
93$(PROGmkdevalloc) :=	LDLIBS += -lbsm
94$(PROGdminfo) :=	LDLIBS += -lbsm
95$(PROGaudio) :=		LDLIBS += -lbsm
96
97CLOBBERFILES +=	$(SCRIPTS)
98
99.KEEP_STATE:
100
101all :		$(PROG) $(RTLCKS) $(SCRIPTS)
102
103install :	$(PROG) $(ROOTDIRS) $(ROOTPROG) $(ROOTLOCKS) \
104		$(ROOTSCRIPTS) $(ROOTLINKS)
105
106$(RTLCKS):
107		$(TOUCH) $@
108
109$(ROOTSECLIB)/%: %.sh
110		$(INS.rename)
111
112$(PROGalloc) :	$(PROGallocOBJS)
113		$(LINK.c) $(PROGallocOBJS) -o $@ $(LDLIBS)
114		$(POST_PROCESS)
115
116$(PROGmkdevalloc) :	$(PROGmkdevallocOBJS)
117			$(LINK.c) $(PROGmkdevallocOBJS) -o $@ $(LDLIBS)
118			$(POST_PROCESS)
119
120$(PROGdminfo) :	$(PROGdminfoOBJS)
121		$(LINK.c) $(PROGdminfoOBJS) -o $@ $(LDLIBS)
122		$(POST_PROCESS)
123
124$(PROGaudio) :	$(PROGaudioOBJS)
125		$(LINK.c) $(PROGaudioOBJS) -o $@ $(LDLIBS)
126		$(POST_PROCESS)
127
128$(ROOTDIRS) :
129		$(INS.dir)
130
131$(ROOTSECDEV)/%: %
132		$(INS.file)
133
134$(ROOTSECLIB)/%: %
135		$(RM) $@
136		$(INS.file)
137
138$(ROOTSECLIB)/audio_clean :	audio_clean
139				$(RM) $@
140				$(INS.file) $(@F)
141
142$(ROOTLINKalloc) :	$(PROGalloc:%=$(ROOTUSRSBIN)/%)
143			$(RM) $@
144			$(LN) $(PROGalloc:%=$(ROOTUSRSBIN)/%) $@
145
146$(ROOTLINKmkdevalloc) :	$(PROGmkdevalloc:%=$(ROOTUSRSBIN)/%)
147			$(RM) $@
148			$(LN) $(PROGmkdevalloc:%=$(ROOTUSRSBIN)/%) $@
149
150$(POFILE):      $(POFILES)
151		$(RM) $@
152		$(CAT) $(POFILES) > $@
153
154#
155# Concatenate all the scripts into one before we build the catalogue.
156# Done to shrink the catalogue since some messages are shared between
157# the various scripts.
158#
159$(ALLSCRIPTS):	$(SCRIPTS:%=%.sh)
160		$(CAT) $(SCRIPTS:%=%.sh) > $@
161
162clean :
163		$(RM) $(PROG) $(RTLCKS) $(OBJS) \
164		$(SCRIPTS) $(ALLSCRIPTS) $(POFILE) $(POFILES)
165
166lint :		lint_SRCS
167
168strip :
169		$(STRIP) $(PROG)
170
171include		../Makefile.targ
172