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