From 1fb08362d9bf5efcaea31247969ea65d3618e62a Mon Sep 17 00:00:00 2001 From: "Salvador E. Tropea" Date: Thu, 13 Oct 2016 16:58:21 -0300 Subject: Added a new config variable CHIPDB_SUBDIR. It determines the subdir name used in $(PREFIX)/share/ to install the chip database. This provides a mechanism to choose a directory different than icebox (default). I.e. fpga-icestorm/chipdb for Debian. --- config.mk | 1 + icetime/Makefile | 2 +- icetime/icetime.cc | 4 ++-- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/config.mk b/config.mk index 9313614..d6810ea 100644 --- a/config.mk +++ b/config.mk @@ -3,6 +3,7 @@ CC ?= $(CXX) PKG_CONFIG ?= pkg-config DESTDIR ?= PREFIX ?= /usr/local +CHIPDB_SUBDIR ?= icebox ifeq ($(MXE),1) EXE = .exe diff --git a/icetime/Makefile b/icetime/Makefile index c56002b..cfa7ff0 100644 --- a/icetime/Makefile +++ b/icetime/Makefile @@ -1,6 +1,6 @@ include ../config.mk LDLIBS = -lm -lstdc++ -CXXFLAGS = -MD -O0 -ggdb -Wall -std=c++11 -I/usr/local/include -DPREFIX='"$(PREFIX)"' +CXXFLAGS = -MD -O0 -ggdb -Wall -std=c++11 -I/usr/local/include -DPREFIX='"$(PREFIX)"' -DCHIPDB_SUBDIR='"$(CHIPDB_SUBDIR)"' ifeq ($(STATIC),1) LDFLAGS += -static diff --git a/icetime/icetime.cc b/icetime/icetime.cc index 84ee8cc..8b21b80 100644 --- a/icetime/icetime.cc +++ b/icetime/icetime.cc @@ -295,9 +295,9 @@ void read_chipdb() #else homedir += getenv("HOME"); #endif - snprintf(buffer, 1024, "%s%s/share/icebox/chipdb-%s.txt", homedir.c_str(), PREFIX+1, config_device.c_str()); + snprintf(buffer, 1024, "%s%s/share/" CHIPDB_SUBDIR "/chipdb-%s.txt", homedir.c_str(), PREFIX+1, config_device.c_str()); } else - snprintf(buffer, 1024, "%s/share/icebox/chipdb-%s.txt", PREFIX, config_device.c_str()); + snprintf(buffer, 1024, PREFIX "/share/" CHIPDB_SUBDIR "/chipdb-%s.txt", config_device.c_str()); FILE *fdb = fopen(buffer, "r"); if (fdb == nullptr) { -- cgit v1.2.3