xref: /titanic_41/usr/src/cmd/hal/tools/Makefile (revision 602ca9ea8f9ce0933f0944601cc5d230e91a950d)
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
51STORAGE_OBJS =		$(STORAGE_PROG:%=%.o)
52STORAGE_SHAREDOBJS =	hal-storage-shared.o
53STORAGE_SHAREDSRCS =	$(STORAGE_SHAREDOBJS:%.o=%.c)
54
55SRCS =		$(PROGSRCS) $(STORAGE_SHAREDSRCS)
56
57CLOBBERFILES += $(HAL_PROG) $(STORAGE_PROG) $(SCRIPT_BIN) $(SCRIPT_LIB) $(HAL_LIB)
58CLEANFILES += $(STORAGE_SHAREDOBJS) $(STORAGE_OBJS)
59
60include ../../Makefile.cmd
61include ../Makefile.hal
62
63$(HAL_PROG) :=		LDLIBS += -lc -ldbus-1 -lhal
64
65lshal :=		LDLIBS += -ldbus-glib-1 -lglib-2.0
66
67$(HAL_LIB) :=	LDLIBS += -lc -ldbus-1 -lpolkit $(ZIGNORE) -lglib-2.0
68
69$(STORAGE_PROG)	:=	LDLIBS += -lc -ldbus-1 -lglib-2.0 -lhal -lhal-storage -lbsm
70
71$(STORAGE_METHOD_PROG) := LDLIBS += -lpolkit
72
73CPPFLAGS += $(HAL_DBUS_CPPFLAGS) $(HAL_GLIB_CPPFLAGS) $(HAL_CONFIG_CPPFLAGS)
74CPPFLAGS += -I$(ROOT)/usr/include/hal
75CPPFLAGS += -I$(ROOT)/usr/include/libpolkit
76C99MODE = $(C99_ENABLE)
77
78ROOTUSRSBINPROG =	$(HAL_PROG:%=$(ROOTUSRSBIN)/%) \
79			$(SCRIPT_BIN:%=$(ROOTUSRSBIN)/%)
80
81ROOTCMDDIR =		$(ROOTLIB_HAL)
82ROOTCMD =		$(STORAGE_PROG:%=$(ROOTCMDDIR)/%) \
83			$(HAL_LIB:%=$(ROOTCMDDIR)/%) \
84			$(SCRIPT_LIB:%=$(ROOTCMDDIR)/%)
85
86all :=          TARGET= all
87install :=      TARGET= install
88clean :=        TARGET= clean
89clobber :=      TARGET= clobber
90
91.KEEP_STATE:
92
93all: $(HAL_PROG) $(STORAGE_PROG) $(SCRIPT_BIN) $(SCRIPT_LIB) $(HAL_LIB) $(SUBDIR)
94
95$(STORAGE_SHAREDOBJS): $(STORAGE_SHAREDSRCS)
96	$(COMPILE.c) $(STORAGE_SHAREDSRCS)
97
98hal-storage-closetray: hal-storage-closetray.o $(STORAGE_SHAREDOBJS)
99	$(LINK.c) hal-storage-closetray.o $(STORAGE_SHAREDOBJS) -o $@ $(LDLIBS)
100	$(POST_PROCESS)
101
102hal-storage-eject: hal-storage-eject.o $(STORAGE_SHAREDOBJS)
103	$(LINK.c) hal-storage-eject.o $(STORAGE_SHAREDOBJS) -o $@ $(LDLIBS)
104	$(POST_PROCESS)
105
106hal-storage-mount: hal-storage-mount.o $(STORAGE_SHAREDOBJS)
107	$(LINK.c) hal-storage-mount.o $(STORAGE_SHAREDOBJS) -o $@ $(LDLIBS)
108	$(POST_PROCESS)
109
110hal-storage-unmount: hal-storage-unmount.o $(STORAGE_SHAREDOBJS)
111	$(LINK.c) hal-storage-unmount.o $(STORAGE_SHAREDOBJS) -o $@ $(LDLIBS)
112	$(POST_PROCESS)
113
114hal-storage-cleanup-mountpoint: hal-storage-cleanup-mountpoint.c \
115		$(STORAGE_SHAREDOBJS)
116	$(LINK.c) hal-storage-cleanup-mountpoint.c \
117		$(STORAGE_SHAREDOBJS) -o $@ $(LDLIBS)
118	$(POST_PROCESS)
119
120hal-storage-cleanup-all-mountpoints: hal-storage-cleanup-all-mountpoints.c \
121		$(STORAGE_SHAREDOBJS)
122	$(LINK.c) hal-storage-cleanup-all-mountpoints.c \
123		$(STORAGE_SHAREDOBJS) -o $@ $(LDLIBS)
124	$(POST_PROCESS)
125
126hal-storage-zpool-export: hal-storage-zpool.c $(STORAGE_SHAREDOBJS)
127	$(LINK.c) -o $@ $(STORAGE_SHAREDOBJS) -DZPOOL_SUBCMD=\"export\" hal-storage-zpool.c $(LDLIBS)
128	$(POST_PROCESS)
129
130hal-storage-zpool-import: hal-storage-zpool.c $(STORAGE_SHAREDOBJS)
131	$(LINK.c) -o $@ $(STORAGE_SHAREDOBJS) -DZPOOL_SUBCMD=\"import\" hal-storage-zpool.c $(LDLIBS)
132	$(POST_PROCESS)
133
134hal-device: hal-device.c
135	$(LINK.c) -o $@ hal-device.c $(LDLIBS)
136	$(POST_PROCESS)
137
138hal-find-by-capability: hal_find_by_capability.c
139	$(LINK.c) -o $@ hal_find_by_capability.c $(LDLIBS)
140	$(POST_PROCESS)
141
142hal-find-by-property: hal_find_by_property.c
143	$(LINK.c) -o $@ hal_find_by_property.c $(LDLIBS)
144	$(POST_PROCESS)
145
146hal-get-property: hal_get_property.c
147	$(LINK.c) -o $@ hal_get_property.c $(LDLIBS)
148	$(POST_PROCESS)
149
150hal-set-property: hal_set_property.c
151	$(LINK.c) -o $@ hal_set_property.c $(LDLIBS)
152	$(POST_PROCESS)
153
154lshal: lshal.c
155	$(LINK.c) -o $@ lshal.c $(LDLIBS)
156	$(POST_PROCESS)
157
158install: all $(ROOTUSRSBINPROG) $(ROOTCMD) $(SUBDIR)
159
160clean: $(SUBDIR)
161	$(RM) $(CLEANFILES)
162
163$(SUBDIR): FRC
164	@cd $@; pwd; $(MAKE) $(TARGET)
165
166FRC:
167
168include ../../Makefile.targ
169