[Bio] / ModelEditor / Makefile Repository:
ViewVC logotype

Annotation of /ModelEditor/Makefile

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.2 - (view) (download)

1 : hwang 1.1 ####
2 :     #
3 :     # NB: One package, one library. Period
4 :     #
5 :     ####
6 :    
7 :    
8 :     PACKAGE := ModelEditor
9 :    
10 :     ###########
11 :     # Sources #
12 :     ###########
13 :    
14 :     # BINS have main()s in them. They don't go into libs. They are 1-1 with
15 :     # linked executables and agree in name, i.e., Foo.cc makes exe, "Foo".
16 :     # CCBINS vs. PCCBINS separates out normal mains from ones that need Pro/C
17 :     # because they have different build rules.
18 :    
19 :     CBINS := ModelEditor
20 :     CCBINS :=
21 :     PCCBINS :=
22 :    
23 :     # BINSCRIPTS are scripts to copy to the bin directory
24 :    
25 :     BINSCRIPTS :=
26 :    
27 :    
28 :    
29 :    
30 :     ########################################################################
31 :     #
32 :     # Everything that follows ought to be package independent and will be
33 :     # included as standard.mk once I figure out what package to put that in.
34 :     #
35 :     #
36 :    
37 :    
38 :    
39 :     BINS := $(CCBINS) $(PCCBINS) $(CBINS)
40 :     CBINFILES := $(addsuffix .c, $(CBINS))
41 :     CCBINFILES := $(addsuffix .cc, $(CCBINS))
42 :     PCCBINFILES := $(addsuffix .pcc, $(PCCBINS))
43 :    
44 :    
45 :     ## The rest you shouldn't need to touch, execpt the dependencies at the
46 :     # bottom, until auto dependency is turned on.
47 :    
48 :     # These are sources that do go into libs. You shouldn't need to edit this.
49 :    
50 :     LIBPCCFILES = $(filter-out $(PCCBINFILES), $(wildcard *.pcc) )
51 :     LIBCCFILES = $(filter-out $(CCBINFILES), $(wildcard *.cc) )
52 :     LIBCFILES = $(filter-out $(CBINFILES), $(wildcard *.c) )
53 :     OBJS = $(subst .cc,.o, $(LIBPCCFILES) $(LIBCCFILES) $(LIBCFILES) )
54 :    
55 :    
56 :     ############################
57 :     # "Global-ish" parameters #
58 :     ############################
59 :    
60 :     # someday, will specify the architecture as a subdir of buildir, bindir
61 :     # and libdir.
62 :    
63 :     srcdir := $(PWD)/
64 :     reldir := $(PWD)/../
65 :     buildir := $(reldir)tmp/
66 :     bindir := $(reldir)bin/
67 :     libdir := $(reldir)lib/
68 :    
69 :     # the library for this package.
70 :    
71 :     LIB := $(libdir)lib$(PACKAGE).a
72 :    
73 :     # Oracle ProC/C++ precompiler
74 :     PROC = proc
75 :    
76 :     # SBW stuff
77 :    
78 :     SBWBASE = /nfs/proj-sysbio/SysBio/external/releases/0.0.0
79 :     SBMLBASE= /nfs/proj-sysbio/SysBio/external/releases/0.0.0
80 :     XERCESBASE= /nfs/proj-sysbio/SysBio/external/releases/0.0.0
81 :    
82 :    
83 :     SBWINC = $(SBWBASE)/include
84 :     SBMLINC = $(SBMLBASE)/include
85 :     XERCESINC = $(XERCESBASE)/include
86 :    
87 :     INCLUDES := -I$(reldir) -I$(SBWINC) -I$(SBMLINC) -I$(XERCESINC)
88 :    
89 :     CXX := g++
90 :     CXXFLAGS := -g -DLINUX
91 :     CXXAR := ar #on some sys, c++ compiler must build .a's
92 :     CXX_SUFFIX :=.cc
93 :    
94 :     AR := ar
95 :     MFLAG := -M
96 :    
97 :     CC = gcc
98 :     CFLAGS = -g -DLINUX
99 :    
100 :     #LDFLAGS = -L$(libdir) -L$(ORACLE_HOME)/lib
101 :     #LIBS = -lBio -lclntsh -lsqlplus
102 :    
103 :     ###
104 :     # This is where real PackageList should go
105 :     ###
106 :    
107 :     # The next two can be automated and will be soon but are here for now
108 :    
109 :     LDFLAGS = -L$(libdir) -L$(ORACLE_HOME)/lib -L$(SBWBASE)/lib -L$(SBMLBASE)/lib\
110 :     -Xlinker -rpath -Xlinker $(SBWBASE)/lib \
111 :     -L$(XERCESBASE)/lib
112 :    
113 : efrank 1.2 LIBS = -lMExplorer -lRecoReadoutOracle -lModelEditor -lRecoElemSBW -lRecoReadout -lclntsh -lsqlplus -lsbw \
114 : hwang 1.1 -lsbml -lxerces-c -lpthread
115 :    
116 :     include arch_spec_Glade.mk
117 :    
118 :    
119 :    
120 :     ###########
121 :     # Targets #
122 :     ###########
123 :    
124 :     # for scalability reasons, someday there will be no all and no
125 :     # auto chase through all dependencies...long story.
126 :    
127 :     all: lib bin
128 :    
129 :     lib: $(LIB)
130 :    
131 :     bin: $(addprefix $(bindir),$(BINS) $(BINSCRIPTS))
132 :    
133 :     clean:
134 :     rm -f $(buildir)* $(addprefix $(bindir), $(BINS) $(BINSCRIPTS)) $(LIB)
135 :    
136 :    
137 :     # we make the lib depend on its .o's then use auto generated dependency
138 :     # rules to tie the .o's to source files. that will snag a .cc.o or other
139 :     # dot rule. The dot rule will compile and insert into the lib.
140 :    
141 :     $(LIB) : $(foreach V, $(LIBCCFILES),$(LIB)($(V:$(CXX_SUFFIX)=.o))) \
142 :     $(foreach V, $(LIBPCCFILES),$(LIB)($(V:.pcc=.o))) \
143 :     $(foreach V, $(LIBCFILES),$(LIB)($(V:.c=.o)))
144 :    
145 :    
146 :    
147 :     # Tie the BINS to their source files and give a rule for making them. This is
148 :     # possible because of the naming scheme. Notice that we are keeping the .o
149 :     # for the file with main() out of the lib.
150 :    
151 :     $(addprefix $(bindir),$(CBINS)): $(bindir)% : $(srcdir)%.c
152 :     cd $(buildir); $(CC) $(CFLAGS) $(INCLUDES) -c $?
153 :     cd $(buildir); $(CXX) $(CXXFLAGS) -o $(bindir)$* $(buildir)$*.o $(INCLUDES) $(LDFLAGS) $(LIBS)
154 :    
155 :     $(addprefix $(bindir),$(CCBINS)): $(bindir)% : $(srcdir)%.cc
156 :     cd $(buildir); $(CXX) $(CXXFLAGS) -o $(bindir)$* $? $(INCLUDES) $(LDFLAGS) $(LIBS)
157 :    
158 :     $(addprefix $(bindir),$(PCCBINS)): $(bindir)% : $(srcdir)%.pcc
159 :     cd $(buildir); $(CXX) $(CXXFLAGS) -o $(bindir)$* $? $(INCLUDES) $(LDFLAGS) $(LIBS)
160 :     # Copy the scripts to bin. Someday this may have to localize the script.
161 :    
162 :     $(addprefix $(bindir),$(BINSCRIPTS)): $(bindir)% : $(srcdir)%
163 :     cp -p $< $@
164 :    
165 :    
166 :     ############################
167 :     # pattern and suffix rules #
168 :     ############################
169 :    
170 :    
171 :     .SUFFIXES: .cc .o .pcc .pc .c
172 :    
173 :    
174 :     # basic rule to get bar.cc into libFoo(bar.o). We do the ar here because
175 :     # c++ ar is different from c ar on some systems and by the time we have a
176 :     # .o, we don't know what lang it came from. Notice this is in terms of
177 :     # $(srcdir)%.cc! (see .pcc below)
178 :    
179 :     (%.o) : $(srcdir)%.cc
180 :     cd $(buildir); $(CXX) $(CXXFLAGS) $(INCLUDES) -c $<
181 :     $(CXXAR) cr $@ $(buildir)$*.o
182 :    
183 :    
184 :     # ...and for bar.c
185 :    
186 :     (%.o) : $(buildir)%.c
187 :     cd $(buildir); $(CC) $(CFLAGS) $(INCLUDES) -c $(srcdir)$<
188 :     $(AR) cr $@ $(buildir)$*.o
189 :    
190 :     (%.o) : $(srcdir)%.c
191 :     cd $(buildir); $(CC) $(CFLAGS) $(INCLUDES) -c $<
192 :     $(AR) cr $@ $(buildir)$*.o
193 :    
194 :     # rules for Oracle Pro/C++ file. The Pro/C file ends in .pcc and is in the
195 :     # sourcedir. The generated file, from Pro/C, will be erased and is put in
196 :     # the build directory. That is why, unlike the normal .cc pattern, this
197 :     # keys off the buildir. We separate pcc->cc from cc->o so that the pcc->cc
198 :     # step can be reused for pcc->.d (dependency from pcc file).
199 :    
200 :     $(buildir)%.cc : $(srcdir)%.pcc
201 :     cd $(buildir); $(PROC) code=cpp cpp_suffix=cc include=$(reldir) oname=$(buildir)$*.cc $<
202 :    
203 :     (%.o) : $(buildir)%.cc
204 :     cd $(buildir); $(CXX) $(CXXFLAGS) $(INCLUDES) -c $<
205 :     $(CXXAR) cr $@ $(buildir)$*.o
206 :    
207 :     # and now for Pro/C rather than Pro/C++
208 :    
209 :     $(buildir)%.c : $(srcdir)%.pc
210 :     cd $(buildir); $(PROC) code=c include=$(reldir) oname=$(buildir)$*.c $<
211 :    
212 :    
213 :     # We probably don't want these....
214 :     #.cc.o:
215 :     # cd $(buildir); $(CXX) $(CXXFLAGS) $(INCLUDES) -c $(srcdir)$<
216 :     #
217 :     #.c.o:
218 :     # cd $(buildir); $(CC) $(CFLAGS) $(INCLUDES) -c $(srcdir)$<
219 :     #
220 :    
221 :     ################
222 :     # Dependencies #
223 :     ################
224 :    
225 :    
226 :     $(addsuffix .d, $(addprefix $(buildir),$(LIBCCFILES:.cc=) $(CCBINS))): $(buildir)%.d : $(srcdir)%.cc
227 :     @echo "Making $(@F)"; \
228 :     sh -ec '$(CXX) $(MFLAG) $(CXXFLAGS) $(INCLUDES) $< | sed '\''s?$*\.o?$(LIB)\($*.o\) $@ ?g'\'' > $@'
229 :    
230 :    
231 :     $(addsuffix .d, $(addprefix $(buildir),$(LIBPCCFILES:.pcc=) $(PCCBINS))): $(buildir)%.d : $(buildir)%.cc
232 :     @echo "Making $(@F)"; \
233 :     sh -ec '$(CXX) $(MFLAG) $(CXXFLAGS) $(INCLUDES) $< | sed '\''s?$*\.o?$(LIB)\($*.o\) $@ ?g'\'' > $@'
234 :    
235 :    
236 :     -include $(addsuffix .d, $(addprefix $(buildir),$(CCBINS) $(LIBCCFILES:.cc=) $(LIBPCCFILES:.pcc=) $(LIBPCCFILES:.pcc=)))

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3