# libctl: flexible Guile-based control files for scientific software
# Copyright (C) 1998 Steven G. Johnson
#
# This file may be used without restriction. It is in the public
# domain, and is NOT restricted by the terms of any GNU license.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Library General Public License for more details.
#
# Steven G. Johnson can be contacted at stevenj@alum.mit.edu.
SHELL = @SHELL@
##############################################################################
# Makefile.in for programs using libctl (assumes that autoconf is
# being used, of course). You should only need to change the definitions
# in this section of the file.
SPECIFICATION_FILE = mpb.scm
PROGRAM_NAME = mpb
# what is printed out when invoking your program with --version:
VERSION_STRING = "MIT Photonic Bands @MPB_VERSION@, Copyright (C) 1999-2001 by MIT."
# objects for program sources:
OBJECTS = mpb.o epsilon.o fields.o epsilon_file.o matrix-smob.o field-smob.o \
geom.o # since we use the geom.scm utilities
HEADERS = # any extra header files you are dependent on
MY_LIBS = ../src/maxwell/maxwell.a \
../src/matrixio/matrixio.a \
../src/matrices/matrices.a \
../src/util/util.a
MY_LDFLAGS = # extra -L flags go here
MY_CPPFLAGS = -I. -I../src/util -I../src/matrices -I../src/matrixio \
-I../src/maxwell
MY_DEFS = -DHAVE_CTL_HOOKS=1 -DHAVE_CTL_EXPORT_HOOK=1
# The following variables should be detected and set by autoconf:
# libctl install. dir., e.g. /usr/local/share/libctl
LIBCTL_DIR = @LIBCTL_DIR@
# gen-ctl-io program
GEN_CTL_IO = @GEN_CTL_IO@
##############################################################################
# don't (normally) edit past here #
##############################################################################
CC = @CC@
CFLAGS = @CFLAGS@
CPPFLAGS = -I. $(MY_CPPFLAGS) @CPPFLAGS@
DEFS = @DEFS@ $(CTL_DEFS) $(MY_DEFS)
##############################################################################
LIBS = $(MY_LIBS) @LIBS@
LDFLAGS = $(MY_LDFLAGS) @LDFLAGS@
##############################################################################
INSTALL = @INSTALL@
prefix = @prefix@
mandir = @mandir@
# c.f. AC_ARG_PROGRAM autoconf docs:
transform=@program_transform_name@
@SET_MAKE@
##############################################################################
CTL_DEFS = -DCTL_SCM='"'$(LIBCTL_DIR)/base/ctl.scm'"' \
-DINCLUDE_SCM='"'$(LIBCTL_DIR)/base/include.scm'"' \
-DSPEC_SCM='"'$(prefix)/share/libctl/specs/$(SPECIFICATION_FILE)'"' \
-DVERSION_STRING='"'$(VERSION_STRING)'"'
##############################################################################
ALL_OBJECTS = main.o ctl-io.o $(OBJECTS)
all: $(PROGRAM_NAME) mpb-split-tmp
main.o: main.c ctl-io.h
mpb.o: mpb.c ctl-io.h mpb.h
epsilon.o: epsilon.c ctl-io.h mpb.h
fields.o: fields.c ctl-io.h mpb.h
matrix-smob.o: matrix-smob.c matrix-smob.h my-smob.h ctl-io.h mpb.h
field-smob.o: field-smob.c field-smob.h my-smob.h ctl-io.h mpb.h
ctl-io.c ctl-io.h: $(SPECIFICATION_FILE)
$(GEN_CTL_IO) $(SPECIFICATION_FILE) $(LIBCTL_DIR)
# Some hackery follows. The program executable needs to have the
# location of the spec file hard-coded into it. However, we have to
# hard-code the location that the spec file *will* be in when it is
# installed...but we would still like to be able to run the program
# before installing it. So, the actual executable is named
# .$(PROGRAM_NAME) (notice the leading dot), and $(PROGRAM_NAME) is a
# shell script that calls the executable, specifying the uninstalled
# spec file location via the --spec-file command-line argument. 'make
# install' copies the real executable and spec files into their final
# locations.
$(PROGRAM_NAME): ctl-io.h $(ALL_OBJECTS) $(MY_LIBS)
$(CC) $(LDFLAGS) $(CFLAGS) $(ALL_OBJECTS) $(LIBS) -o .$@
rm -f $@
echo '#!/bin/sh' > $@
echo `pwd`/.$@ --spec-file=`pwd`/$(SPECIFICATION_FILE) '$$*' >> $@
chmod u+x $@
main.c: $(LIBCTL_DIR)/base/main.c
cp -f $(LIBCTL_DIR)/base/main.c $@
geom.c: $(LIBCTL_DIR)/utils/geom.c
cp -f $(LIBCTL_DIR)/utils/geom.c $@
.c.o: $(HEADERS) ctl-io.h
$(CC) -c $(DEFS) $(CPPFLAGS) $(CFLAGS) $< -o $@
# 'make install' target. This is supplied here so that you can easily
# copy this Makefile into your own program, but it should not be
# called for the example program included with libctl (and is not, at
# least by the top-level Makefile). Two reasons: first, you don't
# really want to install the example program; and second, it won't
# work because LIBCTL_DIR is not set to the global (post-install)
# location of libctl.
install: install-mpb @INSTALL_MPB_SPLIT@
install-mpb: $(PROGRAM_NAME)
$(INSTALL) -d $(prefix)/bin
$(INSTALL) -m 0755 -s .$(PROGRAM_NAME) $(prefix)/bin/`echo $(PROGRAM_NAME)|sed '$(transform)'`
$(INSTALL) -d $(prefix)/share/libctl/specs
$(INSTALL) -m 0644 $(SPECIFICATION_FILE) $(prefix)/share/libctl/specs
$(INSTALL) -d $(mandir)/man1
$(INSTALL) -m 0644 $(PROGRAM_NAME).1 $(mandir)/man1
mpb-split-tmp:
rm -f mpb-split-tmp
mpb_name=`echo mpb | sed '$(transform)'`; \
sed "s%\./mpb%"$(prefix)/bin/"$$mpb_name%g" mpb-split > mpb-split-tmp;
install-mpb-split: mpb-split-tmp
mpb_name=`echo mpb | sed '$(transform)'`; \
$(INSTALL) -m 0755 mpb-split-tmp $(prefix)/bin/$${mpb_name}-split
$(INSTALL) -d $(mandir)/man1
$(INSTALL) -m 0644 mpb-split.1 $(mandir)/man1
clean:
rm -f $(ALL_OBJECTS) ctl-io.c ctl-io.h main.c geom.c \
.$(PROGRAM_NAME) $(PROGRAM_NAME) core mpb-split-tmp
##############################################################################
check: $(PROGRAM_NAME)
./$(PROGRAM_NAME) examples/check.ctl
syntax highlighted by Code2HTML, v. 0.9.1