Question 1:
I have a c++ project that I am trying to re-organize. I am trying to subdivide the src directory to move some src files that seldom are changed to a more out of the way location. The project is a c++ application with a fortran function called from the c.
The reorganization went fine, until I got to the fortran src file. I have two fortran complie rules for the src directory.
# compile src fortran objects with c preprocessor
$(BDIR)/%.o: $(SOURCELOC)/%.FPP \
${SOURCELOC}/COMMON.BLK \
$(SOURCELOC)/PARAM.DAT \
$(SOURCELOC)/ATSYMB.DAT
$(FCOMP) $(FCFLAGS) $(VFLAGS) -c -o $@ $<
# compile src fortran objects with fortran preprocessor
$(BDIR)/%.o: ${SOURCELOC}/%.FOR \
${SOURCELOC}/COMMON.BLK \
${SOURCELOC}/PARAM.DAT \
${SOURCELOC}/ATSYMB.DAT
$(FCOMP) $(FCFLAGS) $(VFLAGS) -c -o $@ $<
What I tried to do was to add a driectory to ./src, ./src/src_main/ and move some or the fortran src files into that directory. I added a compile rule for the new subdirectory,
$(BDIR)/%.o: ${SOURCELOC}/src_main/%.FOR \
${SOURCELOC}/src_main/COMMON.BLK \
${SOURCELOC}/src_main/PARAM.DAT \
${SOURCELOC}/src_main/ATSYMB.DAT
$(FCOMP) $(FCFLAGS) $(VFLAGS) -c -o $@ $<
I am getting an error that there is no rule to make the fortran objects. This same method worked fine to move some cpp src files to a different sub directory. I am guessing this is an issue with the fortran includes (COMMON etc), but I would have expected the fortran to fail with a compiler error, not the linker to fail because the object never go compiled. Is there some off the wall syntax to this or something?
Question 2:
I have a little logic that tries to determine which fortran is installed.
HAVEgfortran := $(shell which gfortran)
ifeq "$(HAVEgfortran)" "/usr/bin/gfortran"
FCOMP = gfortran
endif
ifeq "$(HAVEgfortran)" "/usr/local/bin/gfortran"
FCOMP = gfortran
else
FCOMP = g77
endif
Which gfortran returns /usr/bin/gfortran, but I am getting g77 as FCOMP. I must have made an error in the above, but I can't see it.
Suggestions would be greatly appreciated.
LMHmedchem