--- /dev/null
+#!/usr/bin/make
+
+#
+# If you want to cross-compile Comedilib, change CROSS to something
+# useful.
+#
+CROSS =
+#CROSS = i386-uclibc-
+#CROSS = powerpc-linux-
+CC = $(CROSS)gcc
+AR = $(CROSS)ar
+LD = $(CROSS)ld
+
+
+# Optimization and debugging
+CFLAGS = -Wall -Wstrict-prototypes
+CFLAGS += -O2
+#CFLAGS += -g
+
+
+# Python wrapper:
+# If you want to build the python wrapper, change this to yes.
+with_python = no
+
+
+# Perl wrapper:
+# If you want to build the perl wrapper, change this to yes.
+with_perl = no
+
+
+# Installation:
+# PREFIX is the directory prefix where the library/headers/etc. will
+# reside. Typically, this will be /usr or /usr/local.
+# DESTDIR is prepended to installation paths only during the install
+# phase, so you can install to a different directory than /. Useful
+# for packaging.
+
+PREFIX = /usr
+#DESTDIR = $(TOPDIR)/_install
+
# Makefile for comedi
-with_python = no
-with_perl = no
-
-.EXPORT_ALL_VARIABLES:
+TOPDIR=`pwd`
+include Config
include version
-MAJOR=0
-CFLAGS = -Wall -O2
+.EXPORT_ALL_VARIABLES:
-CROSS :=
-CC := $(CROSS)gcc
-AR := $(CROSS)ar
-LD := $(CROSS)ld
-INSTALL := install
+MAJOR=0
TARGETS = comedilib
ifeq ($(with_python),yes)
DOCFILES= README `find doc -type f`
-INSTALLDIR=$(DESTDIR)/usr
-INSTALLDIR_LIB=$(DESTDIR)/usr/lib
+INSTALLDIR=$(DESTDIR)$(PREFIX)
+INSTALLDIR_LIB=$(DESTDIR)$(PREFIX)/lib
ifneq ($(DEB_BUILD_ARCH),)
-INSTALLDIR_DOC=$(DESTDIR)/usr/share/doc/libcomedi
-INSTALLDIR_MAN=$(DESTDIR)/usr/share/man
-INSTALLDIR_PERL=$(DESTDIR)/usr/lib/perl5/
+INSTALLDIR_DOC=$(DESTDIR)$(PREFIX)/share/doc/libcomedi
+INSTALLDIR_MAN=$(DESTDIR)$(PREFIX)/share/man
+INSTALLDIR_PERL=$(DESTDIR)$(PREFIX)/lib/perl5/
else
-INSTALLDIR_DOC=$(DESTDIR)/usr/doc/libcomedi
-INSTALLDIR_MAN=$(DESTDIR)/usr/man
-INSTALLDIR_PERL=$(DESTDIR)/usr/lib/perl/
+INSTALLDIR_DOC=$(DESTDIR)$(PREFIX)/doc/libcomedi
+INSTALLDIR_MAN=$(DESTDIR)$(PREFIX)/man
+INSTALLDIR_PERL=$(DESTDIR)$(PREFIX)/lib/perl/
endif
-INSTALLDIR_BIN=$(DESTDIR)/usr/bin
-INSTALLDIR_SBIN=$(DESTDIR)/usr/sbin
+INSTALLDIR_BIN=$(DESTDIR)$(PREFIX)/bin
+INSTALLDIR_SBIN=$(DESTDIR)$(PREFIX)/sbin
comedilib: subdirs