move 32-bit libs to lib/i386 subdirs & 64-bit libs to lib/
[unleashed.git] / usr / src / cmd / hal / tools / Makefile
blob5a14b479d1c7eaf4b53f84ea62417044daac45f2
2 # CDDL HEADER START
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.
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.
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]
19 # CDDL HEADER END
21 # Copyright 2014 Garrett D'Amore <garrett@damore.org>
23 # Copyright 2008 Sun Microsystems, Inc. All rights reserved.
24 # Use is subject to license terms.
27 SUBDIR = illumos
29 HAL_PROG = hal-device hal-find-by-capability hal-find-by-property \
30 hal-get-property hal-set-property lshal
32 HAL_LIB = hal-is-caller-privileged
34 SCRIPT_BIN = hal-fdi-validate
36 SCRIPT_LIB = hal-system-lcd-set-brightness hal-system-lcd-get-brightness \
37 hal-system-power-hibernate hal-system-power-suspend \
38 hal-system-power-reboot hal-system-power-shutdown hal-functions
40 STORAGE_METHOD_PROG = hal-storage-closetray hal-storage-eject \
41 hal-storage-mount hal-storage-unmount \
42 hal-storage-zpool-export hal-storage-zpool-import
44 STORAGE_PROG = $(STORAGE_METHOD_PROG) \
45 hal-storage-cleanup-mountpoint \
46 hal-storage-cleanup-all-mountpoints
48 PROGSRCS = $(PROG:%=%.c) $(STORAGE_PROG:%=%.c)
51 STORAGE_OBJS = $(STORAGE_PROG:%=%.o)
52 STORAGE_SHAREDOBJS = hal-storage-shared.o
53 STORAGE_SHAREDSRCS = $(STORAGE_SHAREDOBJS:%.o=%.c) $(STORAGE_SHAREDOBJS:%.o=../utils/%.c)
55 SRCS = $(PROGSRCS) $(STORAGE_SHAREDSRCS)
57 CLOBBERFILES += $(HAL_PROG) $(STORAGE_PROG) $(SCRIPT_BIN) $(SCRIPT_LIB) $(HAL_LIB)
58 CLEANFILES += $(STORAGE_SHAREDOBJS) $(STORAGE_OBJS) hal-storage-zpool.o
60 include ../../Makefile.cmd
61 include ../../Makefile.cmd.64
62 include ../Makefile.hal
64 $(HAL_PROG) := LDLIBS += -lc -ldbus-1 -lhal
66 lshal := LDLIBS += -ldbus-glib-1 -lglib-2.0
68 $(HAL_LIB) := LDLIBS += -lc -ldbus-1 -lpolkit $(ZIGNORE) -lglib-2.0
70 $(STORAGE_PROG) := LDLIBS += -lc -ldbus-1 -lglib-2.0 -lhal -lhal-storage
72 $(STORAGE_METHOD_PROG) := LDLIBS += -lpolkit
74 CPPFLAGS += $(HAL_DBUS_CPPFLAGS) $(HAL_GLIB_CPPFLAGS) $(HAL_CONFIG_CPPFLAGS)
75 CPPFLAGS += -I$(ROOT)/usr/include/hal
76 CPPFLAGS += -I$(ROOT)/usr/include/libpolkit
77 CSTD = $(CSTD_GNU99)
79 ROOTUSRSBINPROG = $(HAL_PROG:%=$(ROOTUSRSBIN)/%) \
80 $(SCRIPT_BIN:%=$(ROOTUSRSBIN)/%)
82 ROOTCMDDIR = $(ROOTLIB_HAL)
83 ROOTCMD = $(STORAGE_PROG:%=$(ROOTCMDDIR)/%) \
84 $(HAL_LIB:%=$(ROOTCMDDIR)/%) \
85 $(SCRIPT_LIB:%=$(ROOTCMDDIR)/%)
87 all := TARGET= all
88 install := TARGET= install
89 clean := TARGET= clean
90 clobber := TARGET= clobber
92 .KEEP_STATE:
94 all: $(HAL_PROG) $(STORAGE_PROG) $(SCRIPT_BIN) $(SCRIPT_LIB) $(HAL_LIB) $(SUBDIR)
96 hal-storage-shared.o: hal-storage-shared.c
97 $(COMPILE.c) -o $@ hal-storage-shared.c
99 hal-storage-closetray: hal-storage-closetray.o $(STORAGE_SHAREDOBJS)
100 $(LINK.c) hal-storage-closetray.o $(STORAGE_SHAREDOBJS) -o $@ $(LDLIBS)
101 $(POST_PROCESS)
103 hal-storage-eject: hal-storage-eject.o $(STORAGE_SHAREDOBJS)
104 $(LINK.c) hal-storage-eject.o $(STORAGE_SHAREDOBJS) -o $@ $(LDLIBS)
105 $(POST_PROCESS)
107 hal-storage-mount: hal-storage-mount.o $(STORAGE_SHAREDOBJS)
108 $(LINK.c) hal-storage-mount.o $(STORAGE_SHAREDOBJS) -o $@ $(LDLIBS)
109 $(POST_PROCESS)
111 hal-storage-unmount: hal-storage-unmount.o $(STORAGE_SHAREDOBJS)
112 $(LINK.c) hal-storage-unmount.o $(STORAGE_SHAREDOBJS) -o $@ $(LDLIBS)
113 $(POST_PROCESS)
115 hal-storage-cleanup-mountpoint: hal-storage-cleanup-mountpoint.c \
116 $(STORAGE_SHAREDOBJS)
117 $(LINK.c) hal-storage-cleanup-mountpoint.c \
118 $(STORAGE_SHAREDOBJS) -o $@ $(LDLIBS)
119 $(POST_PROCESS)
121 hal-storage-cleanup-all-mountpoints: hal-storage-cleanup-all-mountpoints.c \
122 $(STORAGE_SHAREDOBJS)
123 $(LINK.c) hal-storage-cleanup-all-mountpoints.c \
124 $(STORAGE_SHAREDOBJS) -o $@ $(LDLIBS)
125 $(POST_PROCESS)
127 hal-storage-zpool-export: hal-storage-zpool.c $(STORAGE_SHAREDOBJS)
128 $(LINK.c) -o $@ $(STORAGE_SHAREDOBJS) -DZPOOL_SUBCMD=\"export\" hal-storage-zpool.c $(LDLIBS)
129 $(POST_PROCESS)
131 hal-storage-zpool-import: hal-storage-zpool.c $(STORAGE_SHAREDOBJS)
132 $(LINK.c) -o $@ $(STORAGE_SHAREDOBJS) -DZPOOL_SUBCMD=\"import\" hal-storage-zpool.c $(LDLIBS)
133 $(POST_PROCESS)
135 hal-device: hal-device.c
136 $(LINK.c) -o $@ hal-device.c $(LDLIBS)
137 $(POST_PROCESS)
139 hal-find-by-capability: hal_find_by_capability.c
140 $(LINK.c) -o $@ hal_find_by_capability.c $(LDLIBS)
141 $(POST_PROCESS)
143 hal-find-by-property: hal_find_by_property.c
144 $(LINK.c) -o $@ hal_find_by_property.c $(LDLIBS)
145 $(POST_PROCESS)
147 hal-get-property: hal_get_property.c
148 $(LINK.c) -o $@ hal_get_property.c $(LDLIBS)
149 $(POST_PROCESS)
151 hal-set-property: hal_set_property.c
152 $(LINK.c) -o $@ hal_set_property.c $(LDLIBS)
153 $(POST_PROCESS)
155 lshal: lshal.c
156 $(LINK.c) -o $@ lshal.c $(LDLIBS)
157 $(POST_PROCESS)
159 install: all $(ROOTUSRSBINPROG) $(ROOTCMD) $(SUBDIR)
161 clean: $(SUBDIR)
162 $(RM) $(CLEANFILES)
164 $(SUBDIR): FRC
165 @cd $@; pwd; $(MAKE) $(TARGET)
167 FRC:
169 include ../../Makefile.targ