# file: Makefile G. Moody 6 July 1983 # Last revised: 13 April 1997 Version 9.7 # UNIX 'make' description file for compiling the DB library # # Copyright(C) Massachusetts Institute of Technology 1996. All rights reserved. # This file is used with the UNIX `make' command to install the DB library. # Before using it for the first time, check that the site-specific variables # below are appropriate for your system. To build and install the standard DB # library, just type `make' (from within this directory). To build and install # a library for `lint' (not available on all systems), type `make lintlib'. To # build and install the alternate DB library (not available on all systems), # type `make slib'. # The DB library functions assume that a "char" is 8 bits, a "short int" is 16 # bits, an "int" is at least 16 bits, and a "long" is at least 32 bits. The # last two assumptions are valid for ANSI C compilers, and for almost all older # C compilers as well. The assumption most likely to be incorrect is that # regarding the "short int"; if it is not true, it may be necessary to rewrite # db_g16() in `dbio.c' and r16() in `signal.c'. # Version numbers # --------------- # Each release of the DB Software Package is identified by a three-part version # number, defined in this section (unless overridden by settings in the top- # level Makefile for the DB Software Package). See the top-level Makefile # (in the parent of this directory) for details. MAJOR = 9 MINOR = 7 RELEASE = 0 VERSION = $(MAJOR).$(MINOR).$(RELEASE) # Site-specific variables # ----------------------- # CC is the name of your C compiler. The DB library can be compiled with K&R # C compilers (`cc' on most if not all UNIX systems) as well as with ANSI C # compilers such as GNU C (`gcc'). To use the K&R C compiler available # on most UNIX systems, uncomment the next line. CC = cc # For `gcc', uncomment the next line (and see CFLAGS and SCFLAGS below). # CC = gcc # INCDIR should be one of the directories searched by CC for #include <...> # files. INCDIR = /usr/local/include # CCDEFS is the set of C compiler options needed to set preprocessor variables # while compiling the DB Software Package. You should include definitions of # the major, minor, and release numbers, as shown below. Add the following # options to CCDEFS as appropriate (separating them by spaces if you use more # than one): # -DISPRINTF if you do not have `stdlib.h' and your `sprintf' returns an # int (see dblib.h) # -DNOMALLOC_H if you have neither `stdlib.h' nor `malloc.h' (see dblib.h) # -DNOSTRTOK if your standard C library does not include function `strtok' # (see dbio.c) # -DNOTIME if you do not have `time.h' (see signal.c) # -DOLDC if you have neither `stdarg.h' nor `varargs.h' (see dbio.c) # -DSOLARIS if you are using Sun Solaris #include <...> files (see db.h) # -DUSE_FREAD if you do not have a `read' function, or if using `fread' # is preferable (see signal.c) # -DUSE_FWRITE if you do not have a `write' function, or if using `fwrite' # is preferable (see signal.c) # If your C compiler fails to compile `signal.c', add -DBROKEN_CC to CCDEFS # and try again (see signal.c). CCDEFS = -DDB_MAJOR=$(MAJOR) -DDB_MINOR=$(MINOR) -DDB_RELEASE=$(RELEASE) # CFLAGS is the set of C compiler options. CFLAGS should always include # CCDEFS. Add the following options to CFLAGS as appropriate (separating them # by spaces if you use more than one): # -g to save symbols for debugging # -O if you trust your C compiler's optimizer # -I$(INCDIR) unless CC=gcc and INCDIR=/usr/include # With the exception of `gcc', most C compilers do not allow you to use -g and # -O simultaneously. CFLAGS = -g -I$(INCDIR) $(CCDEFS) # For `gcc', comment out the previous line, and uncomment the next one. # CFLAGS = -g -O -I$(INCDIR) $(CCDEFS) # Note: -I$(INCDIR) should not be included in the values of CFLAGS or SCFLAGS # (below) if you are using `gcc' and if INCDIR is /usr/include. If `gcc' is # not the standard compiler for your system, it normally searches a private # directory for gcc-compatible versions of standard #include files such as # stdio.h, and then looks in /usr/include. The -I$(INCDIR) option forces it # to search INCDIR first, and if INCDIR contains unmodified versions of these # #include files (as may be the case if you are using `gcc' on a system that # also has a manufacturer-supplied `cc'), then `gcc' will read the wrong # versions, probably causing compilation errors. On the other hand, if `gcc' # is the standard compiler for your system, and INCDIR is /usr/include, it is # harmless but redundant to include -I$(INCDIR) in CFLAGS. # LIBDIR should be one of the directories searched by CC's loader for -l... # libraries. You will also need to have write permission in LIBDIR. If you # plan to make a shared DB library (see below), note that DB application users # will need to have read permission in LIBDIR. LIBDIR = /usr/local/lib # DBLIB is the name of the standard DB library. In order to access it via # `-ldb', DBLIB should be `libdb.a'. DBLIB = libdb.a # If your system requires indexed libraries, uncomment the next two lines. LFILES = $(OFILES) RANLIB = ranlib # Otherwise, if your system requires ordered libraries, uncomment the next two # lines. (As distributed, this file contains a sorted list of OFILES already.) # LFILES = `lorder $(OFILES) | tsort` # RANLIB = : # Otherwise, uncomment the next two lines. # LFILES = $(OFILES) # RANLIB = : # AR is the name of the command used to build a standard library from `.o' # files, and ARFLAGS is the set of options used when doing so. AR and ARFLAGS # are usually `make' builtins and need not be defined here; under HP UX, and # perhaps other versions of UNIX, however, you will need to define these # variables by uncommenting the next two lines. # AR = ar # ARFLAGS = rv # BUILDLIB is the command to be used to create DBLIB once all of its components # have been compiled separately. This will not usually need to be changed. BUILDLIB = $(AR) $(ARFLAGS) $(DBLIB) $(LFILES) # PRINT is the name of the program used to produce listings (including any # options for the desired formatting). PRINT = lpr # SETPERMISSIONS is the command needed to make the installed files accessible # to those who will use them. The value given below makes them readable by # everyone, and writeable by the owner only. (If you perform the installation # as `root', `root' is the owner of the installed files.) SETPERMISSIONS = chmod 644 #............................................................................. # Ignore this section of site-specific variables unless your system supports # two or more types of libraries. As distributed, this section contains # settings suitable for generating an ELF-format shared library under Linux. # By selecting alternative settings below, you can make a shared library with # `cc' under SunOS or Solaris, `gcc' version 2.0 or later (tested under SunOS, # Solaris, Linux, and HP/UX), or with `cc' or `gcc' under UNIX SVR4 (not # tested). By modifying these settings, this mechanism can be used to generate # other types of variant libraries (e.g., for alternative memory models on # systems that support more than one, or using an alternative C compiler or # cross-compiler). # SCC is the C compiler to be used for the alternate library. SCC = $(CC) # SINCDIR is a directory searched by SCC for include <...> files. SINCDIR = $(INCDIR) # SCFLAGS is the set of C compiler options used when compiling the alternate # library. For SunOS `cc', uncomment the next line. # SCFLAGS = -pic -O -I$(SINCDIR) $(CCDEFS) # For Solaris or SVR4 `cc', uncomment the next line. # SCFLAGS = -K PIC -O -I$(SINCDIR) $(CCDEFS) # For `gcc', uncomment the next line. SCFLAGS = -fpic -g -O -I$(INCDIR) $(CCDEFS) # See comments on CFLAGS (above). If you don't have `gdb', you won't be able # to debug the shared library, so you might want to remove the `-g' option in # that case. # SLIBDIR is the directory in which the alternate library is to be installed. SLIBDIR = $(LIBDIR) # SDBLIB is the name of the alternate library. For a shared library, the # version number is significant for proper run-time binding. If you make # incompatible changes to the library, increment the major version number and # set the minor version number to zero. If you change the library without # changing the function interfaces, increment the minor version number. SDBLIB = libdb.so.$(MAJOR).$(MINOR) # SLIBOBJS is the list of *.o modules to be included in the alternate library. # This should match OFILES below, and should not need to be changed. SLIBOBJS = dbinit.o annot.o signal.o calib.o dbio.o # SBUILDLIB is the command that creates the alternate library once its # components have been compiled separately. For SunOS 4.x, using either `cc' # or `gcc', uncomment the next line. # SBUILDLIB = ld -o $(SDBLIB) -assert pure-text $(SLIBOBJS) # For Solaris, uncomment the next line instead. # SBUILDLIB = ld -o $(SDBLIB) -G -z text $(SLIBOBJS) # For SVR4, uncomment the next line instead. # SBUILDLIB = ld -o $(SDBLIB) -z text $(SLIBOBJS) # For (at least some versions of) HP/UX, uncomment the next line instead. # SBUILDLIB = ld -b -o $(SDBLIB) $(SLIBOBJS) # To build an ELF-format shared library under Linux, uncomment the next line. SBUILDLIB = gcc -shared -Wl,-soname,libdb.so.$(MAJOR) -o $(SDBLIB) $(SLIBOBJS) # SRANLIB is the name of the program used to index the alternate library. # Shared libraries are not generally indexed. SRANLIB = : # LDCONFIG is the name of the program needed to refresh the system's cached # index of shared libraries (needed under SunOS and Linux). # Under SunOS, use /usr/etc/ldconfig. # LDCONFIG = /usr/etc/ldconfig $(SLIBDIR) # Under Linux (with or without ELF support), use /sbin/ldconfig. LDCONFIG = /sbin/ldconfig # Under Solaris, SVR4, and other operating systems that do not maintain a # cached index of shared libraries, uncomment the next line. # LDCONFIG = : # SMAKE is the `make' command that is to be executed when `make slib' is run. SMAKE = $(MAKE) CC=$(SCC) "CFLAGS=$(SCFLAGS)" INCDIR=$(SINCDIR) \ LIBDIR=$(SLIBDIR) DBLIB=$(SDBLIB) "BUILDLIB=$(SBUILDLIB)" RANLIB=$(SRANLIB) \ "LDCONFIG=$(LDCONFIG)" #............................................................................. # The remainder of these site-specific variables are needed only if you wish # to use `lint' to generate a lint library or to check the sources for # portability. # LINT is the name of your `lint' command. LINT = lint # LINTLIB is the name of the lint library generated using `lint -Cdb ...' or # `lint -o db ...'. LINTLIB = llib-ldb.ln # LLIBDIR is the directory in which lint libraries are kept. You will need # write permission in LLIBDIR if you `make lintlib'. SunOS 4.x users may # have the same problem as with INCDIR (see above). LLIBDIR = /usr/lib/lint # LLFLAGS are the `lint' flags needed to generate LINTLIB, and LCFLAGS are # those needed to perform portability checks. BSD (including SunOS and Ultrix) # lint does not accept the `-g' and `-O' options as does System V lint, so we # cannot simply append CFLAGS to these variables for BSD lint. If you have # added any `-D' options to CFLAGS, add them to LLFLAGS and LCFLAGS as well. # Furthermore, it is impossible to make BSD lint completely happy with # functions that use the varargs mechanism (but it will accept the OLDC # version of db_error). Uncomment the next two lines if you have BSD lint. LLFLAGS = -Cdb -DOLDC LCFLAGS = -bchuxz -DOLDC # On System V (and earlier versions of UNIX), uncomment the next two lines. # LLFLAGS = -anu -o db $(CFLAGS) -DISPRINTF # LCFLAGS = -anu $(CFLAGS) -DISPRINTF # It should not be necessary to modify anything below this line. # ----------------------------------------------------------------------------- HEADERS = $(INCDIR)/ecg/db.h $(INCDIR)/ecg/ecgcodes.h $(INCDIR)/ecg/ecgmap.h HFILES = db.h ecgcodes.h ecgmap.h dblib.h CFILES = dbinit.c annot.c signal.c calib.c dbio.c OFILES = dbinit.o annot.o signal.o calib.o dbio.o MFILES = Makefile makefile.dos # `make' or `make install': build and install the DB library and headers install: $(LIBDIR)/$(DBLIB) $(LIBDIR)/$(DBLIB): $(HEADERS) $(OFILES) $(BUILDLIB) cp $(DBLIB) $(LIBDIR) $(SETPERMISSIONS) $(LIBDIR)/$(DBLIB) $(RANLIB) $(LIBDIR)/$(DBLIB) # `make lintlib': build and install the `lint' library lintlib: $(LLIBDIR)/$(LINTLIB) $(LLIBDIR)/$(LINTLIB): $(HEADERS) $(CFILES) $(LINT) $(LLFLAGS) $(CFILES) cp $(LINTLIB) $(LLIBDIR) $(SETPERMISSIONS) $(LLIBDIR)/$(LINTLIB) # `make lib': build the library in the current directory lib: $(HEADERS) $(OFILES) $(BUILDLIB) $(RANLIB) $(DBLIB) # `make slib': build and install the alternate DB library slib: $(MAKE) clean $(SMAKE) $(MAKE) clean $(LDCONFIG) # `make slib-linux': build and install the shared DB library for Linux slib-linux: sh ./mkshlib.lnx $(MAJOR).$(MINOR) cp $(SDBLIB) libdb.sa $(SLIBDIR) $(SETPERMISSIONS) $(SLIBDIR)/$(SDBLIB) $(SLIBDIR)/libdb.sa $(LDCONFIG) # `make clean': remove intermediate and backup files clean: rm -f $(OFILES) *~ # `make really-clean': also remove previously compiled versions of the library really-clean: rm -f $(DBLIB) $(LINTLIB) $(SDBLIB) $(OFILES) *~ # `make check': check DB library for portability check: $(HEADERS) $(CFILES) $(LINT) $(LCFLAGS) $(CFILES) # `make TAGS': make an `emacs' TAGS file TAGS: $(HFILES) $(CFILES) @etags $(HFILES) $(CFILES) # `make listing': print a listing of DB library sources listing: $(PRINT) README $(MFILES) $(HFILES) $(CFILES) # Rules for installing the header files $(INCDIR)/ecg: mkdir $(INCDIR)/ecg $(INCDIR)/ecg/db.h: $(INCDIR)/ecg db.h cp -p db.h $(INCDIR)/ecg; $(SETPERMISSIONS) $(INCDIR)/ecg/db.h $(INCDIR)/ecg/ecgcodes.h: $(INCDIR)/ecg ecgcodes.h cp -p ecgcodes.h $(INCDIR)/ecg $(SETPERMISSIONS) $(INCDIR)/ecg/ecgcodes.h $(INCDIR)/ecg/ecgmap.h: $(INCDIR)/ecg ecgmap.h cp -p ecgmap.h $(INCDIR)/ecg; $(SETPERMISSIONS) $(INCDIR)/ecg/ecgmap.h # Prerequisites for the library modules dbinit.o: $(INCDIR)/ecg/db.h dblib.h dbinit.c annot.o: $(HEADERS) dblib.h annot.c signal.o: $(INCDIR)/ecg/db.h dblib.h signal.c calib.o: $(INCDIR)/ecg/db.h dblib.h calib.c dbio.o: $(INCDIR)/ecg/db.h dblib.h dbio.c