-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
42 lines (32 loc) · 1.16 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
all: imx_usb imx_uart
DESTDIR ?=
prefix ?= /usr
bindir ?= $(prefix)/bin
sysconfdir ?= $(prefix)/etc
BUILDHOST := $(shell uname -s)
BUILDHOST := $(patsubst CYGWIN_%,CYGWIN,$(BUILDHOST))
ifneq ($(BUILDHOST),CYGWIN)
USBCFLAGS = `pkg-config --cflags libusb-1.0`
USBLDFLAGS = `pkg-config --libs libusb-1.0`
else
USBCFLAGS = -I/usr/include/libusb-1.0
USBLDFLAGS = -L/usr/lib -lusb-1.0
endif
CONFCPPFLAGS = -DSYSCONFDIR='"$(sysconfdir)"'
imx_usb.o : imx_usb.c
$(CC) -c $*.c -o $@ -Wstrict-prototypes -Wno-trigraphs -pipe -ggdb $(USBCFLAGS) $(CFLAGS) $(CONFCPPFLAGS)
%.o : %.c
$(CC) -c $*.c -o $@ -Wstrict-prototypes -Wno-trigraphs -pipe -ggdb $(CFLAGS) $(CONFCPPFLAGS)
imx_usb: imx_usb.o imx_sdp.o
$(CC) -o $@ [email protected] imx_sdp.o $(LDFLAGS) $(USBLDFLAGS)
imx_uart: imx_uart.o imx_sdp.o
$(CC) -o $@ [email protected] imx_sdp.o $(LDFLAGS)
install: imx_usb imx_uart
mkdir -p '$(DESTDIR)$(sysconfdir)/imx-loader.d/'
install -m644 *.conf '$(DESTDIR)$(sysconfdir)/imx-loader.d/'
mkdir -p '$(DESTDIR)$(bindir)'
install -m755 imx_usb '$(DESTDIR)$(bindir)/imx_usb'
install -m755 imx_uart '$(DESTDIR)$(bindir)/imx_uart'
clean:
rm -f imx_usb imx_uart imx_usb.o imx_uart.o imx_sdp.o
.PHONY: all clean install