xref: /illumos-gate/usr/src/cmd/hal/tools/Makefile (revision 5801b0f01c3c34499a929ed96164a5a68b470945)
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
62NATIVE_LIBS +=		libdbus-1.so libdbus-glib-1.so libglib-2.0.so
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
76CSTD = $(CSTD_GNU99)
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
95hal-storage-shared.o: hal-storage-shared.c
96	$(COMPILE.c) -o $@ hal-storage-shared.c
97
98adt_data.o: ../utils/adt_data.c
99	$(COMPILE.c) -o $@ ../utils/adt_data.c
100
101hal-storage-closetray: hal-storage-closetray.o $(STORAGE_SHAREDOBJS)
102	$(LINK.c) hal-storage-closetray.o $(STORAGE_SHAREDOBJS) -o $@ $(LDLIBS)
103	$(POST_PROCESS)
104
105hal-storage-eject: hal-storage-eject.o $(STORAGE_SHAREDOBJS)
106	$(LINK.c) hal-storage-eject.o $(STORAGE_SHAREDOBJS) -o $@ $(LDLIBS)
107	$(POST_PROCESS)
108
109hal-storage-mount: hal-storage-mount.o $(STORAGE_SHAREDOBJS)
110	$(LINK.c) hal-storage-mount.o $(STORAGE_SHAREDOBJS) -o $@ $(LDLIBS)
111	$(POST_PROCESS)
112
113hal-storage-unmount: hal-storage-unmount.o $(STORAGE_SHAREDOBJS)
114	$(LINK.c) hal-storage-unmount.o $(STORAGE_SHAREDOBJS) -o $@ $(LDLIBS)
115	$(POST_PROCESS)
116
117hal-storage-cleanup-mountpoint: hal-storage-cleanup-mountpoint.c \
118		$(STORAGE_SHAREDOBJS)
119	$(LINK.c) hal-storage-cleanup-mountpoint.c \
120		$(STORAGE_SHAREDOBJS) -o $@ $(LDLIBS)
121	$(POST_PROCESS)
122
123hal-storage-cleanup-all-mountpoints: hal-storage-cleanup-all-mountpoints.c \
124		$(STORAGE_SHAREDOBJS)
125	$(LINK.c) hal-storage-cleanup-all-mountpoints.c \
126		$(STORAGE_SHAREDOBJS) -o $@ $(LDLIBS)
127	$(POST_PROCESS)
128
129hal-storage-zpool-export: hal-storage-zpool.c $(STORAGE_SHAREDOBJS)
130	$(LINK.c) -o $@ $(STORAGE_SHAREDOBJS) -DZPOOL_SUBCMD=\"export\" hal-storage-zpool.c $(LDLIBS)
131	$(POST_PROCESS)
132
133hal-storage-zpool-import: hal-storage-zpool.c $(STORAGE_SHAREDOBJS)
134	$(LINK.c) -o $@ $(STORAGE_SHAREDOBJS) -DZPOOL_SUBCMD=\"import\" hal-storage-zpool.c $(LDLIBS)
135	$(POST_PROCESS)
136
137hal-device: hal-device.c
138	$(LINK.c) -o $@ hal-device.c $(LDLIBS)
139	$(POST_PROCESS)
140
141hal-find-by-capability: hal_find_by_capability.c
142	$(LINK.c) -o $@ hal_find_by_capability.c $(LDLIBS)
143	$(POST_PROCESS)
144
145hal-find-by-property: hal_find_by_property.c
146	$(LINK.c) -o $@ hal_find_by_property.c $(LDLIBS)
147	$(POST_PROCESS)
148
149hal-get-property: hal_get_property.c
150	$(LINK.c) -o $@ hal_get_property.c $(LDLIBS)
151	$(POST_PROCESS)
152
153hal-set-property: hal_set_property.c
154	$(LINK.c) -o $@ hal_set_property.c $(LDLIBS)
155	$(POST_PROCESS)
156
157lshal: lshal.c
158	$(LINK.c) -o $@ lshal.c $(LDLIBS)
159	$(POST_PROCESS)
160
161install: all $(ROOTUSRSBINPROG) $(ROOTCMD) $(SUBDIR)
162
163clean: $(SUBDIR)
164	$(RM) $(CLEANFILES)
165
166$(SUBDIR): FRC
167	@cd $@; pwd; $(MAKE) $(TARGET)
168
169FRC:
170
171include ../../Makefile.targ
172