Commit b7128ca8 authored by David Griffith's avatar David Griffith 💬

Added dist, distclean, and uninstall targets. Also added version number.

parent b1af0e3e
......@@ -7,9 +7,11 @@ MINIPRO_QUERY_DB=minipro-query-db
MINIPROHEX=miniprohex
TESTS=$(wildcard tests/test_*.c);
OBJCOPY=objcopy
VERSION=0.1
PREFIX = /usr/local
DIST_DIR = $(MINIPRO)-$(VERSION)
BIN_DIR = $(PREFIX)/bin/
UDEV_RULES_DIR = /etc/udev/rules.d/
MAN_DIR = $(PREFIX)/share/man/man1/
......@@ -22,7 +24,10 @@ CFLAGS = -g -O0
override CFLAGS += $(libusb_CFLAGS)
override LIBS += $(libusb_LIBS)
all: $(OBJECTS) $(PROGS)
all: version $(OBJECTS) $(PROGS)
version:
@echo "#define VERSION \"$(VERSION)\"" > version.h
minipro: $(COMMON_OBJECTS) main.o
$(CC) $(COMMON_OBJECTS) main.o $(LIBS) -o $(MINIPRO)
......@@ -31,7 +36,11 @@ minipro-query-db: $(COMMON_OBJECTS) minipro-query-db.o
$(CC) $(COMMON_OBJECTS) minipro-query-db.o $(LIBS) -o $(MINIPRO_QUERY_DB)
clean:
rm -f $(OBJECTS) $(PROGS)
rm -f $(OBJECTS) $(PROGS) version.h
distclean: clean
rm -rf $(DIST_DIR)
rm -f $(DIST_DIR).tar.gz
install:
mkdir -p $(BIN_DIR)
......@@ -44,3 +53,30 @@ install:
cp udev/rules.d/80-minipro.rules $(UDEV_RULES_DIR)
cp bash_completion.d/minipro $(COMPLETIONS_DIR)
cp man/minipro.1 $(MAN_DIR)
uninstall:
rm -f $(BIN_DIR)/$(MINIPRO)
rm -f $(BIN_DIR)/$(MINIPRO_QUERY_DB)
rm -f $(BIN_DIR)/$(MINIPROHEX)
rm -f $(UDEV_RULES_DIR)/80-minipro.rules
rm -f $(COMPLETIONS_DIR)/minipro
rm -f $(MAN_DIR)/minipro.1
find $(BIN_DIR) -type d -empty -delete
find $(COMPLETIONS_DIR) -type d -empty -delete
find $(MAN_DIR) -type d -empty -delete
dist: distclean
mkdir $(DIST_DIR)
@for file in `ls`; do \
if test $$file != $(DIST_DIR); then \
cp -Rp $$file $(DIST_DIR)/$$file; \
fi; \
done
find $(DIST_DIR) -type l -exec rm -f {} \;
tar chof $(DIST_DIR).tar $(DIST_DIR)
gzip -f --best $(DIST_DIR).tar
rm -rf $(DIST_DIR)
@echo
@echo "$(DIST_DIR).tar.gz created"
@echo
......@@ -3,6 +3,7 @@
#include <stdarg.h>
#include <string.h>
#include <unistd.h>
#include <libgen.h>
#include "main.h"
#include "minipro.h"
#include "database.h"
......@@ -24,8 +25,9 @@ struct {
int idcheck_continue;
} cmdopts;
void print_help_and_exit(const char *progname) {
void print_help_and_exit(char *progname) {
char usage[] =
"minipro version %s A free and open TL866XX programmer\n"
"Usage: %s [options]\n"
"options:\n"
" -l List all supported devices\n"
......@@ -41,7 +43,7 @@ void print_help_and_exit(const char *progname) {
" -i Use ICSP\n"
" -I Use ICSP (without enabling Vcc)\n"
" -y Do NOT error on ID mismatch\n";
fprintf(stderr, usage, progname);
fprintf(stderr, usage, VERSION, basename(progname));
exit(-1);
}
......
......@@ -6,6 +6,8 @@
#include <libusb.h>
#include "version.h"
#define MP_TL866A 1
#define MP_TL866CS 2
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment