xref: /titanic_50/usr/src/cmd/hal/tools/Makefile (revision 4870e0a7381ec2ec57437062574e6ddc3dd48d7f)
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 2008 Sun Microsystems, Inc.  All rights reserved.
23# Use is subject to license terms.
24#
25
26SUBDIR =	sunos
27
28HAL_PROG =	hal-device hal-find-by-capability hal-find-by-property \
29		hal-get-property hal-set-property lshal
30
31HAL_LIB =	hal-is-caller-privileged
32
33SCRIPT_BIN =	hal-fdi-validate
34
35SCRIPT_LIB =	hal-system-lcd-set-brightness  hal-system-lcd-get-brightness \
36		hal-system-power-hibernate hal-system-power-suspend \
37		hal-system-power-reboot hal-system-power-shutdown hal-functions
38
39STORAGE_METHOD_PROG = hal-storage-closetray hal-storage-eject \
40		hal-storage-mount hal-storage-unmount \
41		hal-storage-zpool-export hal-storage-zpool-import
42
43STORAGE_PROG =	$(STORAGE_METHOD_PROG) \
44		hal-storage-cleanup-mountpoint \
45		hal-storage-cleanup-all-mountpoints
46
47PROGSRCS =	$(PROG:%=%.c) $(STORAGE_PROG:%=%.c)
48
49
50STORAGE_OBJS =		$(STORAGE_PROG:%=%.o)
51STORAGE_SHAREDOBJS =	hal-storage-shared.o adt_data.o
52STORAGE_SHAREDSRCS =	$(STORAGE_SHAREDOBJS:%.o=%.c) $(STORAGE_SHAREDOBJS:%.o=../utils/%.c)
53
54SRCS =		$(PROGSRCS) $(STORAGE_SHAREDSRCS)
55
56CLOBBERFILES += $(HAL_PROG) $(STORAGE_PROG) $(SCRIPT_BIN) $(SCRIPT_LIB) $(HAL_LIB)
57CLEANFILES += $(STORAGE_SHAREDOBJS) $(STORAGE_OBJS) hal-storage-zpool.o
58
59include ../../Makefile.cmd
60include ../Makefile.hal
61
62$(HAL_PROG) :=		LDLIBS += -lc -ldbus-1 -lhal
63
64lshal :=		LDLIBS += -ldbus-glib-1 -lglib-2.0
65
66$(HAL_LIB) :=	LDLIBS += -lc -ldbus-1 -lpolkit $(ZIGNORE) -lglib-2.0
67
68$(STORAGE_PROG)	:=	LDLIBS += -lc -ldbus-1 -lglib-2.0 -lhal -lhal-storage -lbsm
69
70$(STORAGE_METHOD_PROG) := LDLIBS += -lpolkit
71
72CPPFLAGS += $(HAL_DBUS_CPPFLAGS) $(HAL_GLIB_CPPFLAGS) $(HAL_CONFIG_CPPFLAGS)
73CPPFLAGS += -I$(ROOT)/usr/include/hal
74CPPFLAGS += -I$(ROOT)/usr/include/libpolkit
75C99MODE = $(C99_ENABLE)
76
77ROOTUSRSBINPROG =	$(HAL_PROG:%=$(ROOTUSRSBIN)/%) \
78			$(SCRIPT_BIN:%=$(ROOTUSRSBIN)/%)
79
80ROOTCMDDIR =		$(ROOTLIB_HAL)
81ROOTCMD =		$(STORAGE_PROG:%=$(ROOTCMDDIR)/%) \
82			$(HAL_LIB:%=$(ROOTCMDDIR)/%) \
83			$(SCRIPT_LIB:%=$(ROOTCMDDIR)/%)
84
85all :=          TARGET= all
86install :=      TARGET= install
87clean :=        TARGET= clean
88clobber :=      TARGET= clobber
89
90.KEEP_STATE:
91
92all: $(HAL_PROG) $(STORAGE_PROG) $(SCRIPT_BIN) $(SCRIPT_LIB) $(HAL_LIB) $(SUBDIR)
93
94hal-storage-shared.o: hal-storage-shared.c
95	$(COMPILE.c) -o $@ hal-storage-shared.c
96
97adt_data.o: ../utils/adt_data.c
98	$(COMPILE.c) -o $@ ../utils/adt_data.c
99
100hal-storage-closetray: hal-storage-closetray.o $(STORAGE_SHAREDOBJS)
101	$(LINK.c) hal-storage-closetray.o $(STORAGE_SHAREDOBJS) -o $@ $(LDLIBS)
102	$(POST_PROCESS)
103
104hal-storage-eject: hal-storage-eject.o $(STORAGE_SHAREDOBJS)
105	$(LINK.c) hal-storage-eject.o $(STORAGE_SHAREDOBJS) -o $@ $(LDLIBS)
106	$(POST_PROCESS)
107
108hal-storage-mount: hal-storage-mount.o $(STORAGE_SHAREDOBJS)
109	$(LINK.c) hal-storage-mount.o $(STORAGE_SHAREDOBJS) -o $@ $(LDLIBS)
110	$(POST_PROCESS)
111
112hal-storage-unmount: hal-storage-unmount.o $(STORAGE_SHAREDOBJS)
113	$(LINK.c) hal-storage-unmount.o $(STORAGE_SHAREDOBJS) -o $@ $(LDLIBS)
114	$(POST_PROCESS)
115
116hal-storage-cleanup-mountpoint: hal-storage-cleanup-mountpoint.c \
117		$(STORAGE_SHAREDOBJS)
118	$(LINK.c) hal-storage-cleanup-mountpoint.c \
119		$(STORAGE_SHAREDOBJS) -o $@ $(LDLIBS)
120	$(POST_PROCESS)
121
122hal-storage-cleanup-all-mountpoints: hal-storage-cleanup-all-mountpoints.c \
123		$(STORAGE_SHAREDOBJS)
124	$(LINK.c) hal-storage-cleanup-all-mountpoints.c \
125		$(STORAGE_SHAREDOBJS) -o $@ $(LDLIBS)
126	$(POST_PROCESS)
127
128hal-storage-zpool-export: hal-storage-zpool.c $(STORAGE_SHAREDOBJS)
129	$(LINK.c) -o $@ $(STORAGE_SHAREDOBJS) -DZPOOL_SUBCMD=\"export\" hal-storage-zpool.c $(LDLIBS)
130	$(POST_PROCESS)
131
132hal-storage-zpool-import: hal-storage-zpool.c $(STORAGE_SHAREDOBJS)
133	$(LINK.c) -o $@ $(STORAGE_SHAREDOBJS) -DZPOOL_SUBCMD=\"import\" hal-storage-zpool.c $(LDLIBS)
134	$(POST_PROCESS)
135
136hal-device: hal-device.c
137	$(LINK.c) -o $@ hal-device.c $(LDLIBS)
138	$(POST_PROCESS)
139
140hal-find-by-capability: hal_find_by_capability.c
141	$(LINK.c) -o $@ hal_find_by_capability.c $(LDLIBS)
142	$(POST_PROCESS)
143
144hal-find-by-property: hal_find_by_property.c
145	$(LINK.c) -o $@ hal_find_by_property.c $(LDLIBS)
146	$(POST_PROCESS)
147
148hal-get-property: hal_get_property.c
149	$(LINK.c) -o $@ hal_get_property.c $(LDLIBS)
150	$(POST_PROCESS)
151
152hal-set-property: hal_set_property.c
153	$(LINK.c) -o $@ hal_set_property.c $(LDLIBS)
154	$(POST_PROCESS)
155
156lshal: lshal.c
157	$(LINK.c) -o $@ lshal.c $(LDLIBS)
158	$(POST_PROCESS)
159
160install: all $(ROOTUSRSBINPROG) $(ROOTCMD) $(SUBDIR)
161
162clean: $(SUBDIR)
163	$(RM) $(CLEANFILES)
164
165$(SUBDIR): FRC
166	@cd $@; pwd; $(MAKE) $(TARGET)
167
168FRC:
169
170include ../../Makefile.targ
171