Make it easier to compile flashrom under NetBSD and DragonFlyBSD: - Use /usr/pkg/ as prefix for includes and linking - Use pciutils as include path for the right(tm) libpci
Signed-off-by: Stefan Tauner stefan.tauner@student.tuwien.ac.at ---
While using the pkgsrc prefix is not exactly pretty, we do similar things for OSX, FreeBSD and OpenBSD already with the difference that we use /usr/local/ there. IMHO we should support the most plausible configuration on default and that's libraries installed with pkg_src in its default path in the cases of NetBSD and DragonFlyBSD AFAICS. The FLAGs can still be overridden via the command line too. Tested on NetBSD 6.1 and DragonFlyBSD 3.4.2 VMs.
Makefile | 14 ++++++++++++++ README | 6 ++---- hwaccess.h | 6 ++++++ 3 files changed, 22 insertions(+), 4 deletions(-)
diff --git a/Makefile b/Makefile index 70ef640..de3cf97 100644 --- a/Makefile +++ b/Makefile @@ -97,6 +97,16 @@ CPPFLAGS += -I/usr/local/include LDFLAGS += -L/usr/local/lib endif
+ifeq ($(TARGET_OS), NetBSD) +CPPFLAGS += -I/usr/pkg/include +LDFLAGS += -L/usr/pkg/lib +endif + +ifeq ($(TARGET_OS), DragonFlyBSD) +CPPFLAGS += -I/usr/pkg/include +LDFLAGS += -L/usr/pkg/lib +endif + ifeq ($(TARGET_OS), DOS) EXEC_SUFFIX := .exe CPPFLAGS += -I../libgetopt @@ -716,7 +726,11 @@ compiler: featuresavailable define LIBPCI_TEST /* Avoid a failing test due to libpci header symbol shadowing breakage */ #define index shadow_workaround_index +#if !defined __NetBSD__ && !defined __DragonFly__ #include <pci/pci.h> +#else +#include <pciutils/pci.h> +#endif struct pci_access *pacc; int main(int argc, char **argv) { diff --git a/README b/README index 7f24cca..2441089 100644 --- a/README +++ b/README @@ -80,11 +80,9 @@ To compile on Solaris, use:
gmake LDFLAGS="-L$pathtolibpci" CC="gcc -I$pathtopciheaders" CFLAGS=-O2
-To compile on NetBSD or DragonFly BSD, use: +To compile on NetBSD or DragonFly BSD (with pciutils, libftdi, libusb installed in /usr/pkg/), use:
- ln -s /usr/pkg/include/pciutils pci - gmake CPPFLAGS="-I. -I/usr/pkg/include" \ - LDFLAGS="-L/usr/pkg/lib -Wl,-rpath-link,/usr/pkg/lib" + gmake
To compile on OpenBSD, use:
diff --git a/hwaccess.h b/hwaccess.h index fd6eb12..83f349e 100644 --- a/hwaccess.h +++ b/hwaccess.h @@ -37,7 +37,13 @@ * or as builtin. */ #define index shadow_workaround_index + +#if !defined (__NetBSD__) && !defined (__DragonFly__) #include <pci/pci.h> +#else +#include <pciutils/pci.h> +#endif + #undef index #endif