forked from dcwbrown/dwire-debug
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
55 lines (33 loc) · 1.07 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
#PATH := /bin
TARGET := dwdebug
ifdef WINDIR
BINARY := $(TARGET).exe
else
BINARY := $(TARGET)
endif
ifndef TOOLCHAIN_DIR
CC = gcc
all: run
run: $(BINARY)
./$(BINARY)
install:
cp -p $(BINARY) /usr/local/bin
else
# set variable TOOLCHAIN_DIR to cross compile
# example: https://github.com/raspberrypi/tools
# make TOOLCHAIN_DIR=<tools>/arm-bcm2708/arm-rpi-4.9.3-linux-gnueabihf
# this toolchain has package libusb-1.0-0-dev installed, but
# we need files from the pi package libusb-dev (previous version):
# /usr/include/usb.h => <toolchain_dir>/arm-linux-gnueabihf/sysroot/usr/include
# /usr/lib/arm-linux-gnueabihf/libusb.a => <toolchain_dir>/arm-linux-gnueabihf/sysroot/lib
CC := $(wildcard $(TOOLCHAIN_DIR)/bin/*-gcc)
endif
$(BINARY): */*/*.c */*.c Makefile
ifdef WINDIR
i686-w64-mingw32-gcc -std=gnu99 -Wall -o $(BINARY) -Dwindows src/$(TARGET).c -lKernel32 -lWinmm -lComdlg32 -lWs2_32
else
$(CC) -std=gnu99 -g -fno-pie -rdynamic -fPIC -Wall -o $(BINARY) src/$(TARGET).c -lusb -ldl
endif
ls -lap $(BINARY)
clean:
-rm -rf *.o *.map *.list $(BINARY)