forked from PaulStoffregen/X-Plane_Plugin
-
Notifications
You must be signed in to change notification settings - Fork 4
/
Makefile
80 lines (63 loc) · 2.11 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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
# This makefile has been modified to accept
# external environment variables
OS ?= LINUX
#OS = MACOSX
#OS = WINDOWS
#OS = WINDOWS64
ifeq ($(OS), LINUX)
# sudo apt-get install libudev-dev
CC ?= gcc
INC += -ISDK/CHeaders/XPLM
#CFLAGS = -Wall -O0 -g -D$(OS) $(INC)
CFLAGS += -Wall -O2 -fPIC -D$(OS) $(INC) -fvisibility=hidden
LDFLAGS += -Wl,--version-script=linkscript.lnk
LDDYNFLAGS += -shared
LIBS += -ludev -lpthread -lrt
TARGET ?= lin.xpl
else ifeq ($(OS), MACOSX)
CC ?= gcc-4.2
SDK ?= /Developer/SDKs/MacOSX10.5.sdk
#ARCH = -arch i386 -mmacosx-version-min=10.5
ARCH ?= -arch i386 -arch x86_64 -mmacosx-version-min=10.5
INC += -ISDK/CHeaders/XPLM
CFLAGS += -Wall -O2 $(ARCH) -D$(OS) -isysroot $(SDK) $(INC) -fvisibility=hidden
LDFLAGS += $(ARCH) -isysroot $(SDK)
LDDYNFLAGS += -bundle -undefined dynamic_lookup -single_module
LIBS += -framework IOKit -framework CoreFoundation
TARGET ?= mac.xpl
else ifeq ($(OS), WINDOWS)
# sudo apt-get install mingw32 mingw32-binutils mingw32-runtime
# sudo apt-get install mono-devel wine
CC ?= i586-mingw32msvc-gcc
INC += -ISDK/CHeaders/XPLM
CFLAGS += -Wall -O2 -D$(OS) $(INC) -g
LDFLAGS += -Wl,--version-script=linkscript.lnk -g
LDDYNFLAGS += -shared
LIBS += SDK/Libraries/Win/XPLM.lib -lhid -lsetupapi -lwsock32
TARGET ?= win.xpl
else ifeq ($(OS), WINDOWS64)
# sudo apt-get install gcc-mingw-w64-x86-64 binutils-mingw-w64-x86-64
# x86_64-w64-mingw32-gcc
CC ?= x86_64-w64-mingw32-gcc
INC += -ISDK/CHeaders/XPLM
CFLAGS += -Wall -O2 -D$(OS) $(INC)
LDFLAGS += -Wl,--version-script=linkscript.lnk
LDDYNFLAGS += -shared
LIBS += SDK/Libraries/Win/XPLM_64.lib -lhid -lsetupapi -lwsock32
TARGET ?= win.xpl
endif
all: linktest TeensyControls.xpl
OBJS = TeensyControls.o printf.o usb.o memory.o io.o display.o thread.o
TeensyControls.xpl: $(OBJS)
$(CC) $(LDFLAGS) $(LDDYNFLAGS) $(OBJS) -o TeensyControls.xpl $(LIBS)
cp TeensyControls.xpl $(TARGET)
linktest: linktest.o $(OBJS)
$(CC) $(LDFLAGS) linktest.o $(OBJS) -o linktest $(LIBS)
#copy:
#ifeq ($(OS), WINDOWS)
# ./cp_win32.sh TeensyControls.xpl
#endif
%.o: %.c TeensyControls.h Makefile
$(CC) $(CFLAGS) -c $<
clean:
rm -f *.o TeensyControls.xpl linktest