-
Notifications
You must be signed in to change notification settings - Fork 6
/
Makefile
52 lines (39 loc) · 1.09 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
# SPDX-License-Identifier: GPL-2.0-only
VERSION = 0.3.0
# Install paths
PREFIX = /usr/local
# Flags
CPPFLAGS = -DVERSION=\"$(VERSION)\"
ifeq ($(OS), Windows_NT)
CFLAGS = -Wall -O2 `pkg-config --cflags libusb-1.0` $(INCLUDES)
LDFLAGS = -L/mingw64/lib -I/mingw64/include/libusb-1.0 -lusb-1.0
else
CFLAGS = -Wall -O2 `pkg-config --cflags libusb-1.0` $(INCLUDES)
LDFLAGS = `pkg-config --libs libusb-1.0`
endif
SRC = wch-ch56x-isp.c ./cargs/src/cargs.c
HDR = ./cargs/include/cargs.h devices.h
OBJ = $(SRC:.c=.o)
BIN = wch-ch56x-isp
DISTFILES = $(SRC) $(HDR) Makefile
INCLUDES = \
-I"./cargs/include"
all: $(BIN)
$(OBJ): ./cargs/include/cargs.h devices.h
$(BIN): $(OBJ)
$(CC) -o $@ $^ $(LDFLAGS)
install:
mkdir -p $(DESTDIR)$(PREFIX)/bin
cp -f $(BIN) $(DESTDIR)$(PREFIX)/bin
chmod 755 $(DESTDIR)$(PREFIX)/bin/$(BIN)
uninstall:
rm -vf $(DESTDIR)$(PREFIX)/bin/$(BIN)
dist:
mkdir -p $(BIN)-$(VERSION)
cp $(DISTFILES) $(BIN)-$(VERSION)
tar -cf $(BIN)-$(VERSION).tar $(BIN)-$(VERSION)
gzip $(BIN)-$(VERSION).tar
rm -rf $(BIN)-$(VERSION)
clean:
rm -f $(OBJ) $(BIN)
.PHONY: all install uninstall dist clean