xref: /titanic_41/usr/src/cmd/allocate/Makefile (revision 7801e5e8b5bc4af34929c54a02cfb78398da08dd)
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$(ROOTSECDEV)/% :=	FILEMODE = 0400
94$(ROOTSECLIB)/% :=	FILEMODE = 0555
95
96lint :=			LDLIBS += -lbsm -lsec -lsecdb -ldevinfo -ltsol
97
98$(PROGalloc) :=		LDLIBS += -lbsm -lsec -lsecdb -ldevinfo -ltsol
99$(PROGmkdevalloc) :=	LDLIBS += -lbsm
100$(PROGdminfo) :=	LDLIBS += -lbsm
101$(PROGaddalloc) :=	LDLIBS += -lbsm -lsecdb -ltsol
102
103CLOBBERFILES +=	$(SCRIPTS)
104
105.KEEP_STATE:
106
107all :		$(PROG) $(RTLCKS) $(SCRIPTS)
108
109install :	$(PROG) $(ROOTDIRS) $(ROOTPROG) $(ROOTLOCKS) \
110		$(ROOTSCRIPTS) $(ROOTLINKS) $(ROOTWDWLINKS) $(ROOTETCTSOLFILES)
111
112$(RTLCKS):
113		$(TOUCH) $@
114
115$(ROOTSECLIB)/%: %.sh
116		$(INS.rename)
117
118$(PROGalloc) :	$(PROGallocOBJS)
119		$(LINK.c) $(PROGallocOBJS) -o $@ $(LDLIBS)
120		$(POST_PROCESS)
121
122$(PROGaddalloc) :	$(PROGaddallocOBJS)
123		$(LINK.c) $(PROGaddallocOBJS) -o $@ $(LDLIBS)
124		$(POST_PROCESS)
125
126$(PROGmkdevalloc) :	$(PROGmkdevallocOBJS)
127			$(LINK.c) $(PROGmkdevallocOBJS) -o $@ $(LDLIBS)
128			$(POST_PROCESS)
129
130$(PROGdminfo) :	$(PROGdminfoOBJS)
131		$(LINK.c) $(PROGdminfoOBJS) -o $@ $(LDLIBS)
132		$(POST_PROCESS)
133
134$(ROOTDIRS) :
135		$(INS.dir)
136
137$(ROOTSECDEV)/%: %
138		$(INS.file)
139
140$(ROOTSECLIB)/%: %
141		$(RM) $@
142		$(INS.file)
143
144$(ROOTLINKalloc) :	$(PROGalloc:%=$(ROOTUSRSBIN)/%)
145			$(RM) $@
146			$(LN) $(PROGalloc:%=$(ROOTUSRSBIN)/%) $@
147
148$(ROOTLINKaddalloc) :	$(PROGaddalloc:%=$(ROOTUSRSBIN)/%)
149			$(RM) $@
150			$(LN) $(PROGaddalloc:%=$(ROOTUSRSBIN)/%) $@
151
152$(ROOTLINKmkdevalloc) :	$(PROGmkdevalloc:%=$(ROOTUSRSBIN)/%)
153			$(RM) $@
154			$(LN) $(PROGmkdevalloc:%=$(ROOTUSRSBIN)/%) $@
155
156
157$(ROOTETCSECLIB)/%.windowing: %
158	$(RM) $@
159	$(SYMLINK) $< $@
160
161$(POFILE):      $(POFILES)
162		$(RM) $@
163		$(CAT) $(POFILES) > $@
164
165#
166# Concatenate all the scripts into one before we build the catalogue.
167# Done to shrink the catalogue since some messages are shared between
168# the various scripts.
169#
170$(ALLSCRIPTS):	$(SCRIPTS:%=%.sh)
171		$(CAT) $(SCRIPTS:%=%.sh) > $@
172
173clean :
174		$(RM) $(PROG) $(RTLCKS) $(OBJS) \
175		$(SCRIPTS) $(ALLSCRIPTS) $(POFILE) $(POFILES)
176
177lint :		lint_SRCS
178
179strip :
180		$(STRIP) $(PROG)
181
182include		../Makefile.targ
183