~jdpipe/ascend/trunk-old

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
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
#  ASCEND Models Makefile.Rules
#  Mark Thomas
#  May 27, 1996
#  $Date: 1998/05/21 17:49:44 $
#  $Revision: 1.9 $
#  $Author: mthomas $
#  $Source: /afs/cs.cmu.edu/project/ascend/Repository/models/Makefile.Rules.in,v $
#

#  This file contains the Make Rules which all Makefiles in this
#  subdirectory tree use.
#
#  The Makefiles in this subdirectory tree and this Makefile.Rules
#  file install the ASCEND modeling libraries and examples into
#  the install directory MODELS_DIR

#  Each Makefile.in in this directory tree should define two lists:
#
#    INSTALL_SUBDIR_LIST -- lists the subdirectories of this directory
#                           which contain files to be installed
#
#    INSTALL_FILE_LIST -- lists the files that are to be installed
#                         when ASCEND is installed.
#
#  See Makefile.Template in this directory for a sample Makefile.in


SHELL = /bin/sh
@SET_MAKE@
QUIET_INSTALL=@QUIET_INSTALL@


#  dummy targets so make won't complain
install install-binaries install-libraries install-models::

#  this target traverses the directory tree and installs the files
install-subtree: Makefile
	@if [ ! -d $(INSTALL_TARGET_DIR) ]; then \
	  echo Making directory $(INSTALL_TARGET_DIR) ; \
	  mkdir -p $(INSTALL_TARGET_DIR) ; \
	fi
	@for i in $(INSTALL_FILE_LIST) /dev/null ; do \
	  if $(CMP) -s $(srcdir)/$$i $(INSTALL_TARGET_DIR)/$$i ; then \
	    if test "x$(QUIET_INSTALL)" = "x0" ; then \
	      echo "Skipping $$i (up to date)" ; \
	    fi ; \
	  elif [ $$i != "/dev/null" ]; then \
	    if test -f $(INSTALL_TARGET_DIR)/$$i ; then \
	      echo "Updating $$i --> $(INSTALL_TARGET_DIR)" ; \
	    else \
	      echo "Installing $$i --> $(INSTALL_TARGET_DIR)" ; \
	    fi; \
	    $(INSTALL_DATA) $(srcdir)/$$i $(INSTALL_TARGET_DIR) ; \
	  fi ; \
	done
	@for i in $(INSTALL_SUBDIR_LIST) /dev/null ; do \
	  if [ $$i != "/dev/null" ]; then \
	    (cd $$i ; $(MAKE) $@  RULES_FILE="../$(RULES_FILE)" \
		INSTALL_TARGET_DIR="$(INSTALL_TARGET_DIR)/$$i" \
		INSTALL_DATA="$(INSTALL_DATA)" CMP="$(CMP)" ) ; \
	  fi ; \
	done

#  the reverse of above
uninstall::

uninstall-subtree::
	@for i in $(INSTALL_FILE_LIST) /dev/null ; do \
	  if test -f $(INSTALL_TARGET_DIR)/$$i ; then \
	    echo Removing $(INSTALL_TARGET_DIR)/$$i ; \
	    $(RM) $(INSTALL_TARGET_DIR)/$$i ; \
	  fi ; \
	done
	@for i in $(INSTALL_SUBDIR_LIST) /dev/null ; do \
	  if [ $$i != "/dev/null" ]; then \
	    (cd $$i ; $(MAKE) $@ RULES_FILE="../$(RULES_FILE)" \
		INSTALL_TARGET_DIR="$(INSTALL_TARGET_DIR)/$$i" RM="$(RM)" ) ; \
	  fi ; \
	done



#  Warn when the Makefile is older than Makefile.in
Makefile: $(srcdir)/Makefile.in
	@echo ""
	@echo "$(srcdir)/Makefile.in is newer than Makefile"
	@echo "Consider running 'configure' again or running 'make makes'"
	@echo ""



#  A target to make a backup copy of you Makefile.  Useful to do before
#  you rerun configure so you don't lose all the hacks you added.
save-makes::
	@-for i in $(INSTALL_SUBDIR_LIST) /dev/null ; do \
	  if [ $$i != "/dev/null" ]; then \
	    (cd $$i ; $(MAKE) $@ CP="$(CP)" \
		RULES_FILE="../$(RULES_FILE)"); \
	  fi ; \
	done
	-$(CP) Makefile Makefile.SAVED



#  Targets to remove generated files.  `distclean' removes nearly
#  everything generated since you last ran `configure'
clean::

distclean:: clean
	for i in $(INSTALL_SUBDIR_LIST) /dev/null ; do \
	  if [ $$i != "/dev/null" ]; then \
	    (cd $$i ; $(MAKE) $@ RM="$(RM)" \
		RULES_FILE="../$(RULES_FILE)"); \
	  fi ; \
	done
	$(RM) *~ \#* *.bak TAGS
	$(RM) Makefile Makefile.Rules Makefile.SAVED Makefile.Rules.SAVED



#  Targets to generate emacs style (TAGS) and vi style (tags) tables
#  for quick lookup of ASCEND models and atoms
TAGS::
	-$(ETAGS) --append --output=$(TAGSFILE) --language=none \
	 --regex='/[ \t]*\(UNIVERSAL[ \t]+\)?ATOM[ \t]+\([A-Za-z_]+\)/\2/' \
	 --regex='/[ \t]*\(UNIVERSAL[ \t]+\)?MODEL[ \t]+\([A-Za-z_]+\)/\2/' \
	 --regex='/[ \t]*\(CONSTANT\|DEFINITION\)[ \t]+\([A-Za-z_]+\)/\2/' \
	  $(srcdir)/*.a4l $(srcdir)/*.a4c

# We don't want to recurse in the models tree; otherwise we'll get old code
#	-for i in $(INSTALL_SUBDIR_LIST) /dev/null ; do \
#	  if [ $$i != "/dev/null" ]; then \
#	    (cd $$i ; $(MAKE) $@ TAGSFILE="../$(TAGSFILE)" ETAGS="$(ETAGS)" \
#		RULES_FILE="../$(RULES_FILE)"); \
#	  fi ; \
#	done

tags::
	-$(CTAGS) --append --output=$(TAGSFILE) --language=none \
	  --regex='/[ \t]*\(UNIVERSAL[ \t]+\)?ATOM[ \t]+\([A-Za-z_]+\)/\2/' \
	  --regex='/[ \t]*\(UNIVERSAL[ \t]+\)?MODEL[ \t]+\([A-Za-z_]+\)/\2/' \
	  --regex='/[ \t]*\(CONSTANT\|DEFINITION\)[ \t]+\([A-Za-z_]+\)/\2/' \
	  $(srcdir)/*.a4l $(srcdir)/*.a4c

# We don't want to recurse in the models tree; otherwise we'll get old code
#	-for i in $(INSTALL_SUBDIR_LIST) /dev/null ; do \
#	  if [ $$i != "/dev/null" ]; then \
#	    (cd $$i ; $(MAKE) $@ TAGSFILE="../$(TAGSFILE)" CTAGS="$(CTAGS)" \
#		RULES_FILE="../$(RULES_FILE)"); \
#	  fi ; \
#	done

#  Force emacs to treat this file as a Makefile
#
# Local Variables: ***
# mode:Makefile ***
# End: ***