forked from lorf/csr-spi-ftdi
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile.mingw
69 lines (49 loc) · 1.58 KB
/
Makefile.mingw
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
CXX = /usr/bin/i586-mingw32msvc-g++
CC = /usr/bin/i586-mingw32msvc-gcc
LD = /usr/bin/i586-mingw32msvc-g++
STRIP ?= /usr/bin/i586-mingw32msvc-strip
LIBFTDI ?= ./libftdi1
LIBUSB ?= ./libusb
CFLAGS += -Wall
LDFLAGS += -shared -static-libgcc
CPPFLAGS += -I$(LIBFTDI)/include/libftdi1
LDLIBS += $(LIBFTDI)/lib32/libftdi1.a
CPPFLAGS += -I$(LIBUSB)/include
LDLIBS += $(LIBUSB)/MinGW32/static/libusb-1.0.a
CPPFLAGS += -DSPI_STATS
CPPFLAGS += -DCOMPAT_USLEEP
# See: http://sourceforge.net/p/mingw-w64/mailman/mingw-w64-public/thread/[email protected]/
CPPFLAGS += -DCOMPAT_MINGW_MS_VSNPRINTF
CPPFLAGS += -DCOMPAT_TIMER_MACROS
MAKEFILE = $(firstword $(MAKEFILE_LIST))
ifeq ($(SPIAPI), )
all: spiapi-1.3 spiapi-1.4
spiapi-1.3::
$(MAKE) -f $(MAKEFILE) SPIAPI=1.3 all
spiapi-1.4::
$(MAKE) -f $(MAKEFILE) SPIAPI=1.4 all
else
OBJDIR = spilpt-win32-api$(SPIAPI)
LIBRARY_DEF = spilpt.dll-api$(SPIAPI).def
ifeq ($(SPIAPI), 1.3)
CPPFLAGS += -DSPIFNS_API=SPIFNS_API_1_3
else ifeq ($(SPIAPI), 1.4)
CPPFLAGS += -DSPIFNS_API=SPIFNS_API_1_4
endif
all: $(OBJDIR)/spilpt.dll
endif
$(OBJDIR)/basics.o: spi.h basics.h spifns.h
$(OBJDIR)/spi.o: spi.h compat.h
$(OBJDIR)/hexdump.o: hexdump.h
$(OBJDIR)/spilpt.dll: $(OBJDIR)/dllmain.o $(OBJDIR)/basics.o $(OBJDIR)/spi.o $(OBJDIR)/hexdump.o $(OBJDIR)/compat.o $(LIBRARY_DEF)
mkdir -p $(OBJDIR)
$(LD) $(LDFLAGS) $^ -o $@ $(LDLIBS)
$(STRIP) $@
$(OBJDIR)/%.o: %.c
mkdir -p $(OBJDIR)
$(CC) -c $(CFLAGS) $(CPPFLAGS) -o $@ $<
$(OBJDIR)/%.o: %.cpp
mkdir -p $(OBJDIR)
$(CXX) -c $(CFLAGS) $(CPPFLAGS) -o $@ $<
clean:
rm -fr spilpt-win32-api1.3 spilpt-win32-api1.4