7a6b53020035a4a8a72c2df4941acb663307b97f
[platform/upstream/libusb.git] / libusb / Makefile.am
1 all: libusb-1.0.la libusb-1.0.dll
2
3 AUTOMAKE_OPTIONS = subdir-objects
4
5 lib_LTLIBRARIES = libusb-1.0.la
6
7 POSIX_POLL_SRC = os/poll_posix.h os/poll_posix.c
8 POSIX_THREADS_SRC = os/threads_posix.h os/threads_posix.c
9 WINDOWS_POLL_SRC = os/poll_windows.h os/poll_windows.c
10 WINDOWS_THREADS_SRC = os/threads_windows.h os/threads_windows.c
11 LINUX_USBFS_SRC = os/linux_usbfs.h os/linux_usbfs.c
12 DARWIN_USB_SRC = os/darwin_usb.h os/darwin_usb.c
13 OPENBSD_USB_SRC = os/openbsd_usb.c
14 NETBSD_USB_SRC = os/netbsd_usb.c
15 SUNOS_USB_SRC = os/sunos_usb.c os/sunos_usb.h
16 WINDOWS_USB_SRC = libusb-1.0.def libusb-1.0.rc \
17                 os/windows_common.h os/windows_common.c \
18                 os/windows_usbdk.h os/windows_usbdk.c \
19                 os/windows_winusb.h os/windows_winusb.c
20 HAIKU_USB_SRC = os/haiku_usb.h os/haiku_usb_backend.cpp \
21                 os/haiku_usb_raw.h os/haiku_usb_raw.cpp os/haiku_pollfs.cpp
22 NULL_USB_SRC = os/null_usb.c
23
24 EXTRA_DIST = $(POSIX_POLL_SRC) $(POSIX_THREADS_SRC) \
25         $(WINDOWS_POLL_SRC) $(WINDOWS_THREADS_SRC) \
26         $(LINUX_USBFS_SRC) $(DARWIN_USB_SRC) \
27         $(OPENBSD_USB_SRC) $(NETBSD_USB_SRC) \
28         $(WINDOWS_USB_SRC) \
29         $(HAIKU_USB_SRC) $(NULL_USB_SRC) \
30         os/linux_udev.c os/linux_netlink.c
31
32 if OS_LINUX
33
34 if USE_UDEV
35 OS_SRC = $(LINUX_USBFS_SRC) os/linux_udev.c
36 else
37 OS_SRC = $(LINUX_USBFS_SRC) os/linux_netlink.c
38 endif
39
40 endif
41
42 if OS_DARWIN
43 OS_SRC = $(DARWIN_USB_SRC)
44 AM_CFLAGS_EXT = -no-cpp-precomp
45 endif
46
47 if OS_OPENBSD
48 OS_SRC = $(OPENBSD_USB_SRC)
49 endif
50
51 if OS_NETBSD
52 OS_SRC = $(NETBSD_USB_SRC)
53 endif
54
55 if OS_SUNOS
56 OS_SRC = $(SUNOS_USB_SRC)
57 endif
58
59 if OS_HAIKU
60 noinst_LTLIBRARIES = libusb_haiku.la
61 libusb_haiku_la_SOURCES = $(HAIKU_USB_SRC)
62 libusb_1_0_la_LIBADD = libusb_haiku.la
63 endif
64
65 if OS_NULL
66 OS_SRC = $(NULL_USB_SRC)
67 endif
68
69 if OS_WINDOWS
70 OS_SRC = $(WINDOWS_USB_SRC)
71
72 .rc.lo:
73         $(AM_V_GEN)$(LIBTOOL) $(AM_V_lt) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --tag=RC --mode=compile $(RC) $(RCFLAGS) -i $< -o $@
74
75 libusb-1.0.rc: version.h version_nano.h
76 endif
77
78 libusb-1.0.dll: libusb-1.0.def libusb-1.0.la
79 if CREATE_IMPORT_LIB
80 # Rebuild the import lib from the .def so that MS and MinGW DLLs can be interchanged
81         $(AM_V_GEN)$(DLLTOOL) $(DLLTOOLFLAGS) --kill-at --input-def $(srcdir)/libusb-1.0.def --dllname $@ --output-lib .libs/$@.a
82 endif
83
84 if OS_WINDOWS
85 POLL_SRC = $(WINDOWS_POLL_SRC)
86 else
87 POLL_SRC = $(POSIX_POLL_SRC)
88 endif
89
90 if THREADS_POSIX
91 THREADS_SRC = $(POSIX_THREADS_SRC)
92 else
93 THREADS_SRC = $(WINDOWS_THREADS_SRC)
94 endif
95
96 libusb_1_0_la_CFLAGS = $(AM_CFLAGS)
97 libusb_1_0_la_LDFLAGS = $(LTLDFLAGS)
98 libusb_1_0_la_SOURCES = libusbi.h libusb.h version.h version_nano.h \
99         core.c descriptor.c hotplug.h hotplug.c io.c strerror.c sync.c \
100         $(POLL_SRC) $(THREADS_SRC) $(OS_SRC)
101
102 hdrdir = $(includedir)/libusb-1.0
103 hdr_HEADERS = libusb.h