2018-08-25 19:31:02 -07:00
|
|
|
CC = gcc
|
2018-08-20 22:47:13 -07:00
|
|
|
|
2018-09-15 15:43:23 -07:00
|
|
|
VERSION = $(shell git describe --tags --abbrev=0)
|
2018-08-27 13:34:21 -07:00
|
|
|
GITCOUNT = $(shell git rev-list HEAD --count)
|
2018-09-15 15:23:43 -07:00
|
|
|
UNAME = $(shell uname)
|
2018-08-27 13:34:21 -07:00
|
|
|
CFLAGS = -g -O -Wall -Werror -DVERSION='"$(VERSION).$(GITCOUNT)"'
|
2018-08-22 00:03:22 -07:00
|
|
|
LDFLAGS = -g
|
2018-08-20 22:47:13 -07:00
|
|
|
|
2018-09-17 23:07:42 -07:00
|
|
|
OBJS = main.o util.o radio.o dfu-libusb.o uv380.o md380.o rd5r.o hid.o
|
2018-08-25 19:31:02 -07:00
|
|
|
LIBS = -lusb-1.0
|
2018-08-20 22:47:13 -07:00
|
|
|
|
2018-09-15 15:23:43 -07:00
|
|
|
# Linux
|
|
|
|
ifeq ($(UNAME),Linux)
|
|
|
|
OBJS += hid-libusb.o
|
2018-09-17 16:55:41 -07:00
|
|
|
LIBS = -Wl,-Bstatic -lusb-1.0 -Wl,-Bdynamic -lpthread -ludev
|
2018-09-15 15:23:43 -07:00
|
|
|
endif
|
2018-08-20 22:47:13 -07:00
|
|
|
|
2018-09-17 14:20:02 -07:00
|
|
|
# Mac OS X
|
|
|
|
ifeq ($(UNAME),Darwin)
|
|
|
|
OBJS += hid-macos.o
|
|
|
|
LIBS += -framework IOKit -framework CoreFoundation
|
|
|
|
endif
|
|
|
|
|
2018-08-20 22:47:13 -07:00
|
|
|
all: dmrconfig
|
|
|
|
|
|
|
|
dmrconfig: $(OBJS)
|
|
|
|
$(CC) $(LDFLAGS) -o $@ $(OBJS) $(LIBS)
|
|
|
|
|
|
|
|
clean:
|
2018-09-05 23:47:57 -07:00
|
|
|
rm -f *~ *.o core dmrconfig dmrconfig.exe
|
2018-08-20 22:47:13 -07:00
|
|
|
|
|
|
|
install: dmrconfig
|
|
|
|
install -c -s dmrconfig /usr/local/bin/dmrconfig
|
|
|
|
|
|
|
|
dmrconfig.linux: dmrconfig
|
|
|
|
cp -p $< $@
|
|
|
|
strip $@
|
|
|
|
|
|
|
|
###
|
2018-09-06 12:10:01 -07:00
|
|
|
dfu-libusb.o: dfu-libusb.c util.h
|
2018-09-15 15:43:23 -07:00
|
|
|
dfu-windows.o: dfu-windows.c util.h
|
|
|
|
hid-libusb.o: hid-libusb.c util.h
|
2018-09-17 16:55:41 -07:00
|
|
|
hid-macos.o: hid-macos.c util.h
|
|
|
|
hid-windows.o: hid-windows.c util.h
|
2018-08-20 22:47:13 -07:00
|
|
|
main.o: main.c radio.h util.h
|
2018-08-24 20:13:27 -07:00
|
|
|
md380.o: md380.c radio.h util.h
|
2018-08-20 22:47:13 -07:00
|
|
|
radio.o: radio.c radio.h util.h
|
2018-09-15 15:43:23 -07:00
|
|
|
rd5r.o: rd5r.c radio.h util.h
|
2018-08-20 22:47:13 -07:00
|
|
|
util.o: util.c util.h
|
|
|
|
uv380.o: uv380.c radio.h util.h
|