summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorEvgeny Zinoviev <me@ch1p.io>2020-10-18 23:45:08 +0300
committerEvgeny Zinoviev <me@ch1p.com>2020-10-24 02:38:24 +0300
commit557a8f9de0961c5ad26d8a84950d67f3cae3bf1a (patch)
treec3299aa624c52669de4f37f147c163a5e49e1058 /Makefile
initial commit
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile41
1 files changed, 41 insertions, 0 deletions
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..a90f12f
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,41 @@
+CC := gcc
+
+PROGRAM = isv
+
+OS = $(shell uname -s)
+ifeq ($(OS),Linux)
+ HIDAPI = hidapi-hidraw
+endif
+ifeq ($(OS),Darwin)
+ HIDAPI = hidapi
+endif
+
+CFLAGS = -O2 -std=c99
+CFLAGS += -Wall -W
+CFLAGS += `pkg-config --cflags $(HIDAPI)`
+LDFLAGS = -lm
+LDFLAGS += `pkg-config --libs $(HIDAPI)`
+
+INSTALL = /usr/bin/env install
+PREFIX = /usr/local
+
+OBJS = isv.o util.o p18.o print.o variant.o
+OBJS += libvoltronic/voltronic_dev_usb_hidapi.o
+OBJS += libvoltronic/voltronic_crc.o
+OBJS += libvoltronic/voltronic_dev.o
+
+all: $(PROGRAM)
+
+$(PROGRAM): $(OBJS)
+ $(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS)
+
+install: $(PROGRAM)
+ $(INSTALL) $(PROGRAM) $(PREFIX)/bin
+
+clean:
+ rm -f $(OBJS) $(PROGRAM)
+
+%.o: %.c
+ $(CC) $(CFLAGS) -c $^ -I. -o $@
+
+.PHONY: all install clean distclean \ No newline at end of file