xref: /titanic_50/usr/src/cmd/allocate/Makefile (revision 33f2fefd46350ca5992567761c46a5b70f864340)
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 2008 Sun Microsystems, Inc.  All rights reserved.
24# Use is subject to license terms.
25#
26# ident	"%Z%%M%	%I%	%E% SMI"
27#
28
29ETCTSOLFILES =	devalloc_defaults
30
31include		../Makefile.cmd
32
33ROOTSEC =	$(ROOTETC)/security
34ROOTSECDEV =	$(ROOTSEC)/dev
35ROOTSECLIB =	$(ROOTSEC)/lib
36ROOTDIRS =	$(ROOTSECDEV) $(ROOTSECLIB)
37
38RTLCKS =	audio fd0 sr0 st0 st1
39CLEANfd =	fd_clean
40CLEANsr =	sr_clean
41CLEANst =	st_clean
42CLEANaudio =	audio_clean_wrapper
43CLEANdisk =	disk_clean
44CLEAN_SCRIPTS =	$(CLEANfd) $(CLEANsr) $(CLEANst) $(CLEANaudio) $(CLEANdisk)
45WDW_SCRIPTS =	wdwmsg wdwwrapper
46WDW_LINKS =	$(CLEANaudio) $(CLEANdisk) $(CLEANst)
47SCRIPTS =	$(CLEAN_SCRIPTS) $(WDW_SCRIPTS)
48ALLSCRIPTS =	allscripts.sh
49
50PROGalloc =	allocate
51PROGmkdevalloc =	mkdevalloc
52PROGdminfo =	dminfo
53PROGaudio =	audio_clean
54PROGaddalloc =	add_allocatable
55PROG =		$(PROGalloc) $(PROGmkdevalloc) $(PROGdminfo) \
56	$(PROGaudio) $(PROGaddalloc)
57
58LINKPROGalloc =	deallocate list_devices
59LINKPROGmkdevalloc = mkdevmaps
60LINKPROGaddalloc = remove_allocatable
61
62POFILE =	allocate_all.po
63POFILES =	$(OBJS:%.o=%.po) $(ALLSCRIPTS:%.sh=%.po)
64
65DFLAGS +=	-D_REENTRANT
66CPPFLAGS +=	$(DFLAGS)
67
68ROOTLOCKS =	$(RTLCKS:%=$(ROOTSECDEV)/%)
69ROOTSCRIPTS =	$(SCRIPTS:%=$(ROOTSECLIB)/%)
70ROOTWDWLINKS =	$(WDW_LINKS:%=$(ROOTSECLIB)/%.windowing)
71
72ROOTPROG =	$(PROGallocate:%=$(ROOTUSRSBIN)/%) \
73		$(PROGmkdevalloc:%=$(ROOTUSRSBIN)/%) \
74		$(PROGdminfo:%=$(ROOTUSRSBIN)/%) \
75		$(PROGaudio:%=$(ROOTSECLIB)/%) \
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
85PROGaudioOBJS =		audio_clean.o
86PROGaddallocOBJS =	add_allocatable.o
87
88OBJS =		$(PROGallocOBJS) \
89		$(PROGmkdevallocOBJS) \
90		$(PROGdminfoOBJS) \
91		$(PROGaudioOBJS) \
92		$(PROGaddallocOBJS)
93
94SRCS =		$(OBJS:%.o=%.c)
95
96$(ROOTUSRSBIN)/% :=	FILEMODE = 555
97$(ROOTUSRSBIN)/allocate :=	FILEMODE = 4555
98$(ROOTUSRSBIN)/% :=     OWNER = root
99$(ROOTUSRSBIN)/% :=     GROUP = bin
100$(ROOTSECDEV)/% :=	FILEMODE = 0400
101$(ROOTSECDEV)/% :=	OWNER = root
102$(ROOTSECDEV)/% :=	GROUP = bin
103$(ROOTSECLIB)/% :=	FILEMODE = 0555
104$(ROOTSECLIB)/% :=	OWNER = root
105$(ROOTSECLIB)/% :=	GROUP = sys
106
107lint :=			LDLIBS += -lbsm -lsec -lsecdb -ldevinfo -ltsol
108
109$(PROGalloc) :=		LDLIBS += -lbsm -lsec -lsecdb -ldevinfo -ltsol
110$(PROGmkdevalloc) :=	LDLIBS += -lbsm
111$(PROGdminfo) :=	LDLIBS += -lbsm
112$(PROGaudio) :=		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) $(ROOTETCTSOLFILES)
123
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$(PROGaudio) :	$(PROGaudioOBJS)
147		$(LINK.c) $(PROGaudioOBJS) -o $@ $(LDLIBS)
148		$(POST_PROCESS)
149
150$(ROOTDIRS) :
151		$(INS.dir)
152
153$(ROOTSECDEV)/%: %
154		$(INS.file)
155
156$(ROOTSECLIB)/%: %
157		$(RM) $@
158		$(INS.file)
159
160$(ROOTSECLIB)/audio_clean :	audio_clean
161				$(RM) $@
162				$(INS.file) $(@F)
163
164$(ROOTLINKalloc) :	$(PROGalloc:%=$(ROOTUSRSBIN)/%)
165			$(RM) $@
166			$(LN) $(PROGalloc:%=$(ROOTUSRSBIN)/%) $@
167
168$(ROOTLINKaddalloc) :	$(PROGaddalloc:%=$(ROOTUSRSBIN)/%)
169			$(RM) $@
170			$(LN) $(PROGaddalloc:%=$(ROOTUSRSBIN)/%) $@
171
172$(ROOTLINKmkdevalloc) :	$(PROGmkdevalloc:%=$(ROOTUSRSBIN)/%)
173			$(RM) $@
174			$(LN) $(PROGmkdevalloc:%=$(ROOTUSRSBIN)/%) $@
175
176
177$(ROOTETCSECLIB)/%.windowing: %
178	$(RM) $@
179	$(SYMLINK) $< $@
180
181$(POFILE):      $(POFILES)
182		$(RM) $@
183		$(CAT) $(POFILES) > $@
184
185#
186# Concatenate all the scripts into one before we build the catalogue.
187# Done to shrink the catalogue since some messages are shared between
188# the various scripts.
189#
190$(ALLSCRIPTS):	$(SCRIPTS:%=%.sh)
191		$(CAT) $(SCRIPTS:%=%.sh) > $@
192
193clean :
194		$(RM) $(PROG) $(RTLCKS) $(OBJS) \
195		$(SCRIPTS) $(ALLSCRIPTS) $(POFILE) $(POFILES)
196
197lint :		lint_SRCS
198
199strip :
200		$(STRIP) $(PROG)
201
202include		../Makefile.targ
203