[Bio] / ReleaseTools / standard.mk Repository:
ViewVC logotype

Annotation of /ReleaseTools/standard.mk

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.18 - (view) (download)

1 : efrank 1.1 #######################################################################
2 :     # standard.mk
3 :     #
4 :     # Centralized make rules, macros, etc., shared amongst the packages.
5 :     # Package level makefiles do not define rules, targets, etc. Instead,
6 :     # they define a few macros needed to generate the build lists and
7 :     # standard.mk does the rest.
8 :     #
9 :     # The general pattern is to have "all of a kind" selected by wildcard
10 :     # into a build product, e.g., all .c or .cc go into a library or
11 :     # all .py get .pyc'd into the install area. But, there are a few
12 :     # macro's that define things to exclude, e.g., .c files that have main()
13 :     # and are executables or foo.py files that are top-level programs and
14 :     # are to be installed in bin as foo.
15 :     #
16 :     # A package level makefile does "include standard.mk". This works because
17 :     # of -I's in the Makefile.top in the workdir. See Makefile.PackageSample.
18 :     #
19 :     #######################################################################
20 :    
21 : efrank 1.2 ########################################################################
22 : efrank 1.1 # Document macros users define in their package level makefiles here:
23 : efrank 1.2 ########################################################################
24 : efrank 1.1 #
25 : efrank 1.17 # WEBPAGES := list of stuff to copy to cgidir/Html. built in bin step
26 :     #
27 :     # PYTHON_OPEN_CGI := list of py scripts to install as cgi scripts in
28 :     # bin step and exclude from py lib list.
29 :     #
30 : olson 1.16 # CBINS := foo.c bar.c etc. List of .c binaries to build.
31 : efrank 1.13 #
32 : olson 1.16 # CEXCLUDES := list of .c files, besides $(CBINS), to exclude from the
33 :     # list of C code to build into a .o
34 : efrank 1.12 #
35 : olson 1.16 #
36 :     #BINPYSCRIPTS := script1.py etc. List of py scripts to install in bin.
37 : efrank 1.1 # Installed as script1, not script1.py. Filtered out of
38 :     # python library list (LIBPYFILES)
39 : olson 1.16 #BINPERLSCRIPTS := script1.pl etc. List of perl scripts to install in bin.
40 :     # Installed as script1, not script1.pl. Filtered out of
41 :     # python library list (LIBPYFILES)
42 :     #BINSHSCRIPTS: List of borne shell scripts to be copied to bin verbatim.
43 : efrank 1.6 #
44 : olson 1.16 #SCHEMATOOLS := file.py, etc. List of python files defining input to schema
45 : efrank 1.6 # tools.
46 : efrank 1.1 #
47 : olson 1.16 #BINSCRIPTS: List of scripts to be copied to bin verbatim.
48 : efrank 1.1 #
49 : efrank 1.6 # *** migrate away from BINSCRIPTS! The extra info that
50 :     # *** its borne shell, py, etc., will let us edit the #! line
51 :     # *** during installation, eventually.
52 : efrank 1.2 #
53 : efrank 1.1
54 :    
55 :    
56 : efrank 1.2 ########################################################################
57 : efrank 1.1 # Various lists of things to build
58 : efrank 1.2 # implemented via macros above.
59 :     ########################################################################
60 :    
61 : efrank 1.1
62 : efrank 1.17 LIBPYFILES := $(filter-out $(BINPYSCRIPTS) $(PYTHON_OPEN_CGI) $(SCHEMATOOLS), $(wildcard *.py))
63 : olson 1.16 LIBPERLFILES := $(filter-out $(BINPERLSCRIPTS), $(wildcard *.pl))
64 :     LIBCFILES := $(foreach var, $(filter-out $(CBINS) $(CEXCLUDES), $(wildcard *.c)), $(libdir)/$(PKGNAME)/$(subst .c,.o,$(var)))
65 : efrank 1.1
66 :    
67 : efrank 1.2 ########################################################################
68 :     # Package-level makefile Targets
69 :     ########################################################################
70 :    
71 : efrank 1.3 # this follows the all: in Makefile.top, but we drop decouple:, makefile:,
72 :     # and installdirs:, because those don't make sense at package level
73 : efrank 1.1
74 : efrank 1.3 all: schematools lib bin
75 : efrank 1.1
76 : efrank 1.17 bin: $(foreach var, $(BINPYSCRIPTS), $(subst .py,,$(bindir)/$(var))) $(foreach var, $(BINPERLSCRIPTS), $(subst .pl,,$(bindir)/$(var))) $(foreach var, $(BINSHSCRIPTS), $(subst .sh,,$(bindir)/$(var))) $(foreach var, $(BINSCRIPTS), $(bindir)/$(var)) $(foreach var, $(CBINS), $(subst .c,,$(bindir)/$(var))) opencgi webpages
77 : efrank 1.1
78 : olson 1.16 lib: $(foreach var, $(LIBPYFILES), $(libdir)/$(PKGNAME)/$(var)) $(foreach var, $(LIBPERLFILES), $(libdir)/$(PKGNAME)/$(var)) $(LIBCFILES)
79 : efrank 1.1
80 : efrank 1.17 opencgi: $(foreach var, $(PYTHON_OPEN_CGI), $(subst .py,.cgi, $(cgidir)/$(var)))
81 :    
82 :     webpages: $(foreach var, $(WEBPAGES), $(cgidir)/Html/$(var))
83 :    
84 : efrank 1.5 schematools: stDeclFiles stGeneratedFiles
85 :    
86 :     stDeclFiles: $(foreach var, $(SCHEMATOOLS), $(libdir)/$(PKGNAME)/$(var))
87 :    
88 :     stGeneratedFiles: $(foreach var, $(subst .py,,$(SCHEMATOOLS)), $(libdir)/$(PKGNAME)Gen/$(var)_st.py) $(foreach var, $(subst .py,,$(SCHEMATOOLS)), $(libdir)/$(PKGNAME)Gen/$(var).sql) $(foreach var, $(subst .py,,$(SCHEMATOOLS)), $(libdir)/$(PKGNAME)Gen/$(var)DbiHandler.py)
89 : efrank 1.2
90 : olson 1.16 #test:
91 : efrank 1.1
92 :     clean:
93 :    
94 : efrank 1.2 ########################################################################
95 :     # Rules
96 :     ########################################################################
97 :    
98 : efrank 1.1 ##
99 : efrank 1.2 # lib related
100 : efrank 1.1 ##
101 : efrank 1.8
102 : olson 1.16 $(libdir)/$(PKGNAME)/%.o: $(TOPDIR)/$(PKGNAME)/%.c
103 :     $(CC) $(CFLAGS) -c -o $@ $<
104 : efrank 1.13
105 : efrank 1.7 $(libdir)/$(PKGNAME)/%.py: $(TOPDIR)/$(PKGNAME)/%.py
106 : efrank 1.5 cp -p $< $@
107 :    
108 :     $(libdir)/$(PKGNAME)/__init__.py: $(TOPDIR)/$(PKGNAME)/__init__.py
109 :     cp -p $< $@
110 :    
111 : olson 1.16 $(libdir)/$(PKGNAME)/%.pl: $(TOPDIR)/$(PKGNAME)/%.pl
112 :     cp -p $< $@
113 :    
114 :    
115 : efrank 1.2 # verbatim copy from sourcedir to libdir, e.g., py (distutils someday...)
116 : efrank 1.5 # keep this overly generic one below the more specific py, above.
117 : olson 1.16 #
118 :     # why is this here??? -ed
119 : efrank 1.2 $(libdir)/$(PKGNAME)/%: $(TOPDIR)/$(PKGNAME)/%
120 :     cp -p $< $@
121 : efrank 1.1
122 : efrank 1.2 # generate .py from schematools description of class. (Kah related)
123 : efrank 1.8
124 :     # Note- add a __init__ dep because everything is required to be a package
125 :     # and so must have an __init__. putting the dep here is a way to force the
126 :     # __init__ to be copied into the dir first so that i can immediately
127 :     # be ref'd as a package. this is needed for schema tools ina way i don't
128 :     # grok yet
129 :    
130 :     $(libdir)/$(PKGNAME)Gen/%_st.py: $(TOPDIR)/$(PKGNAME)/%.py $(libdir)/$(PKGNAME)/__init__.py
131 : efrank 1.11 cd $(libdir)/$(PKGNAME); env PYTHONPATH=$(libdir) $(bindir)/generatePy $< > $@
132 : efrank 1.2
133 :     # generate .sql from schematools description of class. (Kah related)
134 : efrank 1.5 $(libdir)/$(PKGNAME)Gen/%.sql: $(TOPDIR)/$(PKGNAME)/%.py
135 : efrank 1.11 cd $(libdir)/$(PKGNAME); env PYTHONPATH=$(libdir) $(bindir)/generateDb $< > $@
136 : efrank 1.2
137 :     # generate object/relational converters from schematools
138 :     # description of class. (Kah related)
139 : efrank 1.5 $(libdir)/$(PKGNAME)Gen/%DbiHandler.py: $(TOPDIR)/$(PKGNAME)/%.py
140 : efrank 1.11 $(libdir)/$(PKGNAME); env PYTHONPATH=$(libdir) $(bindir)/generateDbiHandler $< > $@
141 : efrank 1.2
142 :     ##
143 :     # bin related
144 :     ##
145 : olson 1.16
146 :     # C excecutables.
147 :     $(bindir)/%: $(TOPDIR)/$(PKGNAME)/%.c
148 :     $(CC) $(CFLAGS) -o $@ $< $(wildcard $(libdir)/$(PKGNAME)/*.o)
149 :    
150 : efrank 1.2 # python scripts. make script, "foo" from "foo.py". (rewrite path #! someday)
151 :     $(bindir)/%: $(TOPDIR)/$(PKGNAME)/%.py
152 : efrank 1.1 cp -p $< $@
153 : efrank 1.4 chmod 755 $@
154 : efrank 1.1
155 : olson 1.16 # perl scripts. make script, "foo" from "foo.pl". (rewrite path #! someday)
156 :     $(bindir)/%: $(TOPDIR)/$(PKGNAME)/%.pl
157 :     cp -p $< $@
158 :     chmod 755 $@
159 :    
160 : efrank 1.6 # borne shell scripts
161 :    
162 :     $(bindir)/%: $(TOPDIR)/$(PKGNAME)/%.sh
163 :     cp -p $< $@
164 :     chmod 755 $@
165 :    
166 : efrank 1.2 # scripts to copy verbatim.
167 : efrank 1.1 $(bindir)/%: $(TOPDIR)/$(PKGNAME)/%
168 : efrank 1.2 cp -p $< $@
169 : efrank 1.4 chmod 755 $@
170 : efrank 1.1
171 : efrank 1.17 ##
172 :     # cgi related
173 :     ##
174 :    
175 :     $(cgidir)/Html/%: $(TOPDIR)/$(PKGNAME)/%
176 :     cp -p $< $(cgidir)/Html/.
177 :    
178 :     $(cgidir)/%.cgi: $(TOPDIR)/$(PKGNAME)/%.py $(TOOL_HDR_PY)
179 :     ( cat $(TOOL_HDR_PY) $< > $@; chmod +x $@ )
180 : efrank 1.1
181 : efrank 1.18
182 : efrank 1.2 ########################################################################
183 : efrank 1.1 # Dependency generation
184 : efrank 1.2 ########################################################################
185 : efrank 1.1 #
186 :     # not written yet. (of all the things not to have...)
187 :     #

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3