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