File: Makefile.in

package info (click to toggle)
libctl 2.1-2
  • links: PTS
  • area: main
  • in suites: woody
  • size: 940 kB
  • ctags: 619
  • sloc: ansic: 2,892; sh: 2,500; lisp: 1,784; makefile: 243
file content (130 lines) | stat: -rw-r--r-- 4,762 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
# libctl: flexible Guile-based control files for scientific software
# Copyright (C) 1998, 1999, 2000, 2001, 2002, 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
# Lesser 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 = example.scm
PROGRAM_NAME = example

# what is printed out when invoking your program with --version:
VERSION_STRING = "example 1.0, copyright (c) 1999 by Steven G. Johnson."

# objects for program sources:
OBJECTS = example.o \
	  geom.o     # since we use the geom.scm utilities

HEADERS =            # any extra header files you are dependent on

MY_LIBS    =         # extra libs you need go here
MY_LDFLAGS =         # extra -L flags go here
MY_CPPFLAGS =        # extra -I include flags go here
MY_DEFS =            # extra -D define flags go here

# 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 = @CPPFLAGS@ -I. $(MY_CPPFLAGS)
DEFS = @DEFS@ $(CTL_DEFS) $(MY_DEFS)

##############################################################################

LIBS = $(MY_LIBS) @LIBS@
LDFLAGS = $(MY_LDFLAGS) @LDFLAGS@

##############################################################################

INSTALL = @INSTALL@
prefix = @prefix@
# 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)

main.o: main.c ctl-io.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)
	$(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: $(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

clean:
	rm -f $(ALL_OBJECTS) ctl-io.c ctl-io.h main.c geom.c \
              .$(PROGRAM_NAME) $(PROGRAM_NAME) core