Makefile 1.18 KB
Newer Older
Valentin Dudouyt's avatar
Valentin Dudouyt committed
1
.PHONY: all clean install test
2
COMMON_OBJECTS=byte_utils.o database.o minipro.o fuses.o easyconfig.o
3 4 5 6
OBJECTS=$(COMMON_OBJECTS) main.o minipro-query-db.o
PROGS=minipro minipro-query-db
MINIPRO=minipro
MINIPRO_QUERY_DB=minipro-query-db
7 8 9
TESTS=$(wildcard tests/test_*.c);
OBJCOPY=objcopy

Valentin Dudouyt's avatar
Valentin Dudouyt committed
10
BIN_DIR=$(DESTDIR)/usr/bin/
11
UDEV_RULES_DIR=$(DESTDIR)/usr/lib/udev/rules.d/
Valentin Dudouyt's avatar
Valentin Dudouyt committed
12
MAN_DIR=$(DESTDIR)/usr/share/man/man1/
13
COMPLETIONS_DIR=$(DESTDIR)/etc/bash_completion.d/
Valentin Dudouyt's avatar
Valentin Dudouyt committed
14

15 16 17 18 19 20
libusb_CFLAGS = `pkg-config --cflags libusb-1.0`
libusb_LIBS = `pkg-config --libs libusb-1.0`

CFLAGS = -g -O0
override CFLAGS += $(libusb_CFLAGS)
override LIBS += $(libusb_LIBS)
21

22 23 24
all: $(OBJECTS) $(PROGS)

minipro: $(COMMON_OBJECTS) main.o
25
	$(CC) $(COMMON_OBJECTS) main.o $(LIBS) -o $(MINIPRO)
26 27

minipro-query-db: $(COMMON_OBJECTS) minipro-query-db.o
28
	$(CC) $(COMMON_OBJECTS) minipro-query-db.o $(LIBS) -o $(MINIPRO_QUERY_DB)
29 30

clean:
31
	rm -f $(OBJECTS) $(PROGS)
32

Valentin Dudouyt's avatar
Valentin Dudouyt committed
33 34 35 36
install:
	mkdir -p $(BIN_DIR)
	mkdir -p $(UDEV_RULES_DIR)
	mkdir -p $(MAN_DIR)
37
	mkdir -p $(COMPLETIONS_DIR)
Valentin Dudouyt's avatar
Valentin Dudouyt committed
38 39 40
	cp $(MINIPRO) $(BIN_DIR)
	cp $(MINIPRO_QUERY_DB) $(BIN_DIR)
	cp udev/rules.d/80-minipro.rules $(UDEV_RULES_DIR)
41
	cp bash_completion.d/minipro $(COMPLETIONS_DIR)
Valentin Dudouyt's avatar
Valentin Dudouyt committed
42
	cp man/minipro.1 $(MAN_DIR)