xref: /titanic_50/usr/src/cmd/hal/tools/Makefile (revision 20c794b39650d115e17a15983b6b82e46238cf45)
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# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
23# Use is subject to license terms.
24#
25# ident	"%Z%%M%	%I%	%E% SMI"
26#
27
28HAL_PROG =	hal-device hal-find-by-capability hal-find-by-property \
29		hal-get-property hal-set-property lshal
30
31SCRIPT =	hal-fdi-validate
32
33STORAGE_METHOD_PROG = hal-storage-closetray hal-storage-eject \
34		hal-storage-mount hal-storage-unmount \
35		hal-storage-zpool-export hal-storage-zpool-import
36
37STORAGE_PROG =	$(STORAGE_METHOD_PROG) \
38		hal-storage-cleanup-mountpoint \
39		hal-storage-cleanup-all-mountpoints
40
41PROGSRCS =	$(PROG:%=%.c) $(STORAGE_PROG:%=%.c)
42
43STORAGE_OBJS =		$(STORAGE_PROG:%=%.o)
44STORAGE_SHAREDOBJS =	hal-storage-shared.o
45STORAGE_SHAREDSRCS =	$(STORAGE_SHAREDOBJS:%.o=%.c)
46
47SRCS =		$(PROGSRCS) $(STORAGE_SHAREDSRCS)
48
49CLOBBERFILES += $(HAL_PROG) $(STORAGE_PROG) $(SCRIPT)
50CLEANFILES += $(STORAGE_SHAREDOBJS) $(STORAGE_OBJS)
51
52include ../../Makefile.cmd
53include ../Makefile.hal
54
55$(HAL_PROG) :=		LDLIBS += -lc -ldbus-1 -lhal
56
57lshal :=		LDLIBS += -ldbus-glib-1 -lglib-2.0
58
59$(STORAGE_PROG)	:=	LDLIBS += -lc -ldbus-1 -lglib-2.0 -lhal -lhal-storage -lbsm
60
61$(STORAGE_METHOD_PROG) := LDLIBS += -lpolkit
62
63CPPFLAGS += $(HAL_DBUS_CPPFLAGS) $(HAL_GLIB_CPPFLAGS) $(HAL_CONFIG_CPPFLAGS)
64CPPFLAGS += -I$(ROOT)/usr/include/hal
65CPPFLAGS += -I$(ROOT)/usr/include/libpolkit
66C99MODE = $(C99_ENABLE)
67
68ROOTUSRSBINPROG =	$(HAL_PROG:%=$(ROOTUSRSBIN)/%) $(SCRIPT:%=$(ROOTUSRSBIN)/%)
69
70ROOTCMDDIR =		$(ROOTLIB_HAL)
71ROOTCMD =		$(STORAGE_PROG:%=$(ROOTCMDDIR)/%)
72
73.KEEP_STATE:
74
75all: $(HAL_PROG) $(STORAGE_PROG) $(SCRIPT)
76
77$(STORAGE_SHAREDOBJS): $(STORAGE_SHAREDSRCS)
78	$(COMPILE.c) $(STORAGE_SHAREDSRCS)
79
80hal-storage-closetray: hal-storage-closetray.o $(STORAGE_SHAREDOBJS)
81	$(LINK.c) hal-storage-closetray.o $(STORAGE_SHAREDOBJS) -o $@ $(LDLIBS)
82	$(POST_PROCESS)
83
84hal-storage-eject: hal-storage-eject.o $(STORAGE_SHAREDOBJS)
85	$(LINK.c) hal-storage-eject.o $(STORAGE_SHAREDOBJS) -o $@ $(LDLIBS)
86	$(POST_PROCESS)
87
88hal-storage-mount: hal-storage-mount.o $(STORAGE_SHAREDOBJS)
89	$(LINK.c) hal-storage-mount.o $(STORAGE_SHAREDOBJS) -o $@ $(LDLIBS)
90	$(POST_PROCESS)
91
92hal-storage-unmount: hal-storage-unmount.o $(STORAGE_SHAREDOBJS)
93	$(LINK.c) hal-storage-unmount.o $(STORAGE_SHAREDOBJS) -o $@ $(LDLIBS)
94	$(POST_PROCESS)
95
96hal-storage-cleanup-mountpoint: hal-storage-cleanup-mountpoint.c \
97		$(STORAGE_SHAREDOBJS)
98	$(LINK.c) hal-storage-cleanup-mountpoint.c \
99		$(STORAGE_SHAREDOBJS) -o $@ $(LDLIBS)
100	$(POST_PROCESS)
101
102hal-storage-cleanup-all-mountpoints: hal-storage-cleanup-all-mountpoints.c \
103		$(STORAGE_SHAREDOBJS)
104	$(LINK.c) hal-storage-cleanup-all-mountpoints.c \
105		$(STORAGE_SHAREDOBJS) -o $@ $(LDLIBS)
106	$(POST_PROCESS)
107
108hal-storage-zpool-export: hal-storage-zpool.c $(STORAGE_SHAREDOBJS)
109	$(LINK.c) -o $@ $(STORAGE_SHAREDOBJS) -DZPOOL_SUBCMD=\"export\" hal-storage-zpool.c $(LDLIBS)
110	$(POST_PROCESS)
111
112hal-storage-zpool-import: hal-storage-zpool.c $(STORAGE_SHAREDOBJS)
113	$(LINK.c) -o $@ $(STORAGE_SHAREDOBJS) -DZPOOL_SUBCMD=\"import\" hal-storage-zpool.c $(LDLIBS)
114	$(POST_PROCESS)
115
116hal-device: hal-device.c
117	$(LINK.c) -o $@ hal-device.c $(LDLIBS)
118	$(POST_PROCESS)
119
120hal-find-by-capability: hal_find_by_capability.c
121	$(LINK.c) -o $@ hal_find_by_capability.c $(LDLIBS)
122	$(POST_PROCESS)
123
124hal-find-by-property: hal_find_by_property.c
125	$(LINK.c) -o $@ hal_find_by_property.c $(LDLIBS)
126	$(POST_PROCESS)
127
128hal-get-property: hal_get_property.c
129	$(LINK.c) -o $@ hal_get_property.c $(LDLIBS)
130	$(POST_PROCESS)
131
132hal-set-property: hal_set_property.c
133	$(LINK.c) -o $@ hal_set_property.c $(LDLIBS)
134	$(POST_PROCESS)
135
136lshal: lshal.c
137	$(LINK.c) -o $@ lshal.c $(LDLIBS)
138	$(POST_PROCESS)
139
140install: all $(ROOTUSRSBINPROG) $(ROOTCMD)
141
142
143clean:
144	$(RM) $(CLEANFILES)
145
146include ../../Makefile.targ
147