This repository has been archived by the owner on Feb 26, 2022. It is now read-only.
forked from fx5/usbdmx
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
64 lines (47 loc) · 1.74 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
CC=gcc
CXX=g++
CPPOBJS=
OBJS=$(COBJS) $(CPPOBJS)
CFLAGS+=-Wall -g -c -fpic -pthread
ifeq ($(shell uname -s), Darwin)
PLATFORM=mac
COBJS=$(PLATFORM)/hid.o usbdmx.o
LIBS=-pthread -framework IOKit -framework CoreFoundation
LIB_NAMES=libusbdmx.dylib
LD_SHARED=-dynamic -bundle
else
COBJS=linux/hid.o usbdmx.o
LIBS=-pthread `pkg-config libudev --libs`
LIB_NAMES=libusbdmx.so
LD_SHARED=-shared
endif
all: usbdmx_example usbdmx_example_static simple_example simple_example_static loopback_test $(LIB_NAMES)
echo "" ; head -n 17 README.md
clean:
rm -f $(OBJS) usbdmx_example usbdmx_example_static libusbdmx.a simple_example simple_example_static loopback_test $(LIB_NAMES)
make -f Makefile-mingw32 clean
make -f Makefile-mingw64 clean
windows-all:
make -f Makefile-mingw32
make -f Makefile-mingw64
usbdmx_example: usbdmx_example.cpp libusbdmx.a $(LIB_NAMES)
g++ -L. -Wall -o usbdmx_example usbdmx_example.cpp -lusbdmx
usbdmx_example_static: usbdmx_example.cpp libusbdmx.a $(LIB_NAMES)
g++ $(OBJS) usbdmx_example.cpp -o usbdmx_example_static $(LIBS)
simple_example: simple_example.c libusbdmx.a $(LIB_NAMES)
gcc -L. -Wall -o simple_example simple_example.c -l usbdmx
simple_example_static: simple_example.c libusbdmx.a $(LIB_NAMES)
gcc $(OBJS) $(LIBS) simple_example.c -o simple_example_static
loopback_test: loopback_test.c libusbdmx.a $(LIB_NAMES)
gcc $(OBJS) $(LIBS) loopback_test.c -o loopback_test
libusbdmx.so: $(OBJS)
$(CC) $(OBJS) $(LD_SHARED) -s -o libusbdmx.so $(LIBS)
libusbdmx.dylib: $(OBJS)
$(CC) $(OBJS) -dynamiclib -s -o libusbdmx.dylib $(LIBS)
libusbdmx.a: usbdmx.o
ar rcs libusbdmx.a usbdmx.o
$(COBJS): %.o: %.c
$(CC) $(CFLAGS) $< -o $@
$(CPPOBJS): %.o: %.cpp
$(CXX) $(CFLAGS) $< -o $@
.PHONY: clean