forked from Frans-Willem/CsrSpiDrivers
-
Notifications
You must be signed in to change notification settings - Fork 102
/
Makefile.wine
70 lines (55 loc) · 2.04 KB
/
Makefile.wine
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
TARGET_PLATFORM ?= linux
WINE_LIB ?= /usr/lib/i386-linux-gnu/wine
# Uncomment for wine-devel:
#WINE_LIB = /opt/wine-devel/lib/wine /opt/wine-devel/lib
I386_LIB ?= /usr/lib/i386-linux-gnu
STDCXX_LIB ?= /usr/lib/gcc/i686-linux-gnu/$(WINEGCC_VER)
# Print scr-spi-ftdi statistics before exit
CPPFLAGS += -DSPI_STATS
# Enable LEDs
CPPFLAGS += -DENABLE_LEDS
# Compile with debugging
#CFLAGS += -g -fno-inline
#LDFLAGS += -g -fno-inline
# Compile without debugging
LDFLAGS += -s
WINEGCC_VER := $(shell env LC_ALL=C winegcc -v 2>&1 | awk '/^gcc version/ {print $$3}' | cut -d. -f1,2)
VERSION := $(shell cat VERSION)
GIT_REVISION := $(shell git log -1 --format=%h 2>/dev/null)
CPPFLAGS += -DVERSION=\"$(VERSION)\" -DGIT_REVISION=\"$(GIT_REVISION)\"
CC = winegcc
CXX = wineg++
LD = winegcc
CFLAGS += -Wall -m32 -fPIC -DPIC
CXXFLAGS += -fno-exceptions
LDFLAGS += -shared -m32 -static-libgcc
# 64 bit winegcc tries to link with 64 bit wine libs even if -m32 is specified.
# Direct it to the 32bit libraries.
LDFLAGS += $(addprefix -L,$(WINE_LIB)) $(addprefix -L,$(I386_LIB)) $(addprefix -L,$(STDCXX_LIB))
#LDLIBS= -lftdi -lusb-1.0
# Build with static versions of libraries
LDLIBS += $(I386_LIB)/libftdi.a $(I386_LIB)/libusb.a
MAKEFILE = $(firstword $(MAKEFILE_LIST))
LIBDIR = lib-wine-$(TARGET_PLATFORM)
OBJDIR = obj-wine-$(TARGET_PLATFORM)
LIBNAME = usbspi.dll.so
LIBRARY_SPEC = usbspi.dll.spec
all: $(LIBDIR)/$(LIBNAME)
$(LIBDIR)/$(LIBNAME): $(OBJDIR)/$(LIBNAME)
mkdir -p $(LIBDIR)
cp -p $< $@
$(OBJDIR)/$(LIBNAME): $(OBJDIR)/dllmain.o $(OBJDIR)/basics.o $(OBJDIR)/spi.o $(OBJDIR)/logging.o $(LIBRARY_SPEC)
$(LD) $(LDFLAGS) $^ -o $@ $(LDLIBS)
install:
install -m 0644 -o root -g root $(OBJDIR)/$(LIBNAME) $(WINE_LIB)/$(LIBNAME)
$(OBJDIR)/basics.o: spi.h spifns.h logging.h dllmain.h compat.h
$(OBJDIR)/spi.o: spi.h compat.h logging.h
$(OBJDIR)/logging.o: logging.h compat.h
$(OBJDIR)/%.o: %.c
mkdir -p $(OBJDIR)
$(CC) -c $(CFLAGS) $(CPPFLAGS) -o $@ $<
$(OBJDIR)/%.o: %.cpp
mkdir -p $(OBJDIR)
$(CXX) -c $(CFLAGS) $(CXXFLAGS) $(CPPFLAGS) -o $@ $<
clean:
rm -fr $(LIBDIR) $(OBJDIR)