summaryrefslogtreecommitdiff
path: root/Makefile
blob: a90f12f74ab2baf5fcd5a37cf2be95ba4ec6fb18 (plain)
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
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