how to set conditional bin program creation using autotools - makefile

I am a beginner in using autotool, I want to add some shell script in the Makefile.am, when I use the method below, the Makefile created by autotool is not I am expected. How can I write to create the correct one.
Thanks for your reply!
PS:
this is my configure.in and Makefile.am(parts)
configure.in:
if test "$sample" = yes;then
DEFS="$DEFS -DSAMPLE=1"
AC_SUBST(SAMPLE, [yes])
fi
Makefile.am:
if test "$SAMPLE" = yes;then
noinst_PROGRAMS = test
test_SOURCES = test.c
else
bin_PROGRAMS = release
release_SOURCES = main.c
fi
Makefile autotool created:
........
........
.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
clean-libLTLIBRARIES clean-libtool clean-noinstPROGRAMS ctags \
distclean distclean-compile distclean-generic \
distclean-libtool distclean-tags distdir dvi dvi-am html \
html-am info info-am install install-am install-data \
install-data-am install-dvi install-dvi-am install-exec \
install-exec-am install-html install-html-am \
install-includeHEADERS install-info install-info-am \
install-libLTLIBRARIES install-man install-pdf install-pdf-am \
install-ps install-ps-am install-strip installcheck \
installcheck-am installdirs maintainer-clean \
maintainer-clean-generic mostlyclean mostlyclean-compile \
mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
tags uninstall uninstall-am uninstall-includeHEADERS \
uninstall-libLTLIBRARIES
if test "yes" = yes;then
fi

Automake conditionals don't work like that. See the manual.
Here's how it should look:
configure.ac:
AM_CONDITIONAL([SAMPLE], [test "$SAMPLE" = yes])
Makefile.am:
if SAMPLE
noinst_PROGRAMS = test
test_SOURCES = test.c
else
bin_PROGRAMS = release
release_SOURCES = main.c
endif

Related

How to solve this 'Error Refreshing Makefiles'?

When I click on Run on my VeinsTutorial (the one that Christoph Sommer made and you might be familiar with it), I get error shown below. Do you have any idea? I really need to get over this error.
Error refreshing Makefiles
Reason:
you have both .cc and .cpp files -- specify -e cc or -e cpp option to select which set of files to use
make MODE=release all
make: *** No rule to make target 'all'. Stop.
"make MODE=release all" terminated with exit code 2. Build might be incomplete.
'
'Simulation terminated with exit code: 1
<!> Error: NED type 'veinstutorial.src.TutorialAppl' could not be fully resolved due to a missing base type or interface, at C:\Users\konra\git\repository\carlogicapi-master\carlogicapi-master\tutorials\VeinsTutorial\src\TutorialAppl.ned:19
End.
This is the MAKEFILES FILE where I should change something, but I cannot see where it should be changed.
#
# OMNeT++/OMNEST Makefile for $(LIB_PREFIX)veins
#
# This file was generated with the command:
# opp_makemake --make-so -f --deep -o veins -O out -pVEINS -I. -I.
#
# Name of target to be created (-o option)
TARGET = $(LIB_PREFIX)veins$(D)$(SHARED_LIB_SUFFIX)
TARGET_DIR = .
# C++ include paths (with -I)
INCLUDE_PATH = -I. -I.
# Additional object and library files to link with
EXTRA_OBJS =
# Additional libraries (-L, -l options)
LIBS =
# Output directory
PROJECT_OUTPUT_DIR = ../out
PROJECTRELATIVE_PATH = src
O = $(PROJECT_OUTPUT_DIR)/$(CONFIGNAME)/$(PROJECTRELATIVE_PATH)
# Object files for local .cc, .msg and .sm files
OBJS = \
$O/veins/base/connectionManager/BaseConnectionManager.o \
$O/veins/base/connectionManager/ChannelAccess.o \
$O/veins/base/connectionManager/ConnectionManager.o \
$O/veins/base/connectionManager/NicEntryDebug.o \
$O/veins/base/connectionManager/NicEntryDirect.o \
$O/veins/base/modules/BaseApplLayer.o \
$O/veins/base/modules/BaseBattery.o \
$O/veins/base/modules/BaseLayer.o \
$O/veins/base/modules/BaseMacLayer.o \
$O/veins/base/modules/BaseMobility.o \
$O/veins/base/modules/BaseModule.o \
$O/veins/base/modules/BaseWorldUtility.o \
$O/veins/base/modules/BatteryAccess.o \
$O/veins/base/phyLayer/Antenna.o \
$O/veins/base/phyLayer/BaseDecider.o \
$O/veins/base/phyLayer/BasePhyLayer.o \
$O/veins/base/phyLayer/ChannelInfo.o \
$O/veins/base/phyLayer/Decider.o \
$O/veins/base/phyLayer/PhyUtils.o \
$O/veins/base/toolbox/Signal.o \
$O/veins/base/toolbox/SignalUtils.o \
$O/veins/base/toolbox/Spectrum.o \
$O/veins/base/utils/Coord.o \
$O/veins/base/utils/Heading.o \
$O/veins/base/utils/NetwToMacControlInfo.o \
$O/veins/base/utils/SimpleAddress.o \
$O/veins/base/utils/winsupport.o \
$O/veins/modules/analogueModel/BreakpointPathlossModel.o \
$O/veins/modules/analogueModel/NakagamiFading.o \
$O/veins/modules/analogueModel/PERModel.o \
$O/veins/modules/analogueModel/SimpleObstacleShadowing.o \
$O/veins/modules/analogueModel/SimplePathlossModel.o \
$O/veins/modules/analogueModel/TwoRayInterferenceModel.o \
$O/veins/modules/analogueModel/VehicleObstacleShadowing.o \
$O/veins/modules/application/ieee80211p/DemoBaseApplLayer.o \
$O/veins/modules/application/traci/MyVeinsApp.o \
$O/veins/modules/application/traci/TraCIDemo11p.o \
$O/veins/modules/application/traci/TraCIDemoRSU11p.o \
$O/veins/modules/mac/ieee80211p/Mac1609_4.o \
$O/veins/modules/mobility/LinearMobility.o \
$O/veins/modules/mobility/traci/TraCIBuffer.o \
$O/veins/modules/mobility/traci/TraCIColor.o \
$O/veins/modules/mobility/traci/TraCICommandInterface.o \
$O/veins/modules/mobility/traci/TraCIConnection.o \
$O/veins/modules/mobility/traci/TraCICoordinateTransformation.o \
$O/veins/modules/mobility/traci/TraCILauncher.o \
$O/veins/modules/mobility/traci/TraCIMobility.o \
$O/veins/modules/mobility/traci/TraCIRegionOfInterest.o \
$O/veins/modules/mobility/traci/TraCIScenarioManager.o \
$O/veins/modules/mobility/traci/TraCIScenarioManagerForker.o \
$O/veins/modules/mobility/traci/TraCIScenarioManagerLaunchd.o \
$O/veins/modules/mobility/traci/TraCIScreenRecorder.o \
$O/veins/modules/mobility/traci/TraCIVehicleInserter.o \
$O/veins/modules/obstacle/MobileHostObstacle.o \
$O/veins/modules/obstacle/Obstacle.o \
$O/veins/modules/obstacle/ObstacleControl.o \
$O/veins/modules/obstacle/VehicleObstacleControl.o \
$O/veins/modules/phy/Decider80211p.o \
$O/veins/modules/phy/NistErrorRate.o \
$O/veins/modules/phy/PhyLayer80211p.o \
$O/veins/modules/phy/SampledAntenna1D.o \
$O/veins/modules/utility/BBoxLookup.o \
$O/veins/modules/utility/HasLogProxy.o \
$O/veins/modules/utility/TimerManager.o \
$O/veins/modules/world/annotations/AnnotationDummy.o \
$O/veins/modules/world/annotations/AnnotationManager.o \
$O/veins/modules/world/traci/trafficLight/TraCITrafficLightInterface.o \
$O/veins/modules/world/traci/trafficLight/TraCITrafficLightProgram.o \
$O/veins/modules/world/traci/trafficLight/logics/TraCITrafficLightAbstractLogic.o \
$O/veins/modules/world/traci/trafficLight/logics/TraCITrafficLightSimpleLogic.o \
$O/veins/base/messages/AirFrame_m.o \
$O/veins/base/messages/BorderMsg_m.o \
$O/veins/base/messages/MacPkt_m.o \
$O/veins/modules/application/traci/TraCIDemo11pMessage_m.o \
$O/veins/modules/messages/AckTimeOutMessage_m.o \
$O/veins/modules/messages/AirFrame11p_m.o \
$O/veins/modules/messages/BaseFrame1609_4_m.o \
$O/veins/modules/messages/DemoSafetyMessage_m.o \
$O/veins/modules/messages/DemoServiceAdvertisement_m.o \
$O/veins/modules/messages/Mac80211Ack_m.o \
$O/veins/modules/messages/Mac80211Pkt_m.o \
$O/veins/modules/messages/PhyControlMessage_m.o \
$O/veins/modules/messages/TraCITrafficLightMessage_m.o \
$O/veins/modules/messages/WaveShortMessage_m.o
# Message files
MSGFILES = \
veins/base/messages/AirFrame.msg \
veins/base/messages/BorderMsg.msg \
veins/base/messages/MacPkt.msg \
veins/modules/application/traci/TraCIDemo11pMessage.msg \
veins/modules/messages/AckTimeOutMessage.msg \
veins/modules/messages/AirFrame11p.msg \
veins/modules/messages/BaseFrame1609_4.msg \
veins/modules/messages/DemoSafetyMessage.msg \
veins/modules/messages/DemoServiceAdvertisement.msg \
veins/modules/messages/Mac80211Ack.msg \
veins/modules/messages/Mac80211Pkt.msg \
veins/modules/messages/PhyControlMessage.msg \
veins/modules/messages/TraCITrafficLightMessage.msg \
veins/modules/messages/WaveShortMessage.msg
# SM files
SMFILES =
#------------------------------------------------------------------------------
# Pull in OMNeT++ configuration (Makefile.inc)
ifneq ("$(OMNETPP_CONFIGFILE)","")
CONFIGFILE = $(OMNETPP_CONFIGFILE)
else
ifneq ("$(OMNETPP_ROOT)","")
CONFIGFILE = $(OMNETPP_ROOT)/Makefile.inc
else
CONFIGFILE = $(shell opp_configfilepath)
endif
endif
ifeq ("$(wildcard $(CONFIGFILE))","")
$(error Config file '$(CONFIGFILE)' does not exist -- add the OMNeT++ bin directory to the path so that opp_configfilepath can be found, or set the OMNETPP_CONFIGFILE variable to point to Makefile.inc)
endif
include $(CONFIGFILE)
# Simulation kernel and user interface libraries
OMNETPP_LIBS = -loppenvir$D $(KERNEL_LIBS) $(SYS_LIBS)
COPTS = $(CFLAGS) $(IMPORT_DEFINES) -DVEINS_EXPORT $(INCLUDE_PATH) -I$(OMNETPP_INCL_DIR)
MSGCOPTS = $(INCLUDE_PATH) -PVEINS_API
SMCOPTS =
# we want to recompile everything if COPTS changes,
# so we store COPTS into $COPTS_FILE and have object
# files depend on it (except when "make depend" was called)
COPTS_FILE = $O/.last-copts
ifneq ("$(COPTS)","$(shell cat $(COPTS_FILE) 2>/dev/null || echo '')")
$(shell $(MKPATH) "$O" && echo "$(COPTS)" >$(COPTS_FILE))
endif
#------------------------------------------------------------------------------
# User-supplied makefile fragment(s)
# >>>
# inserted from file 'makefrag':
#
# Copyright (C) 2017 Rudolf Hornig <rudi#omnetpp.org>
#
# Documentation for these modules is at http://veins.car2x.org/
#
# SPDX-License-Identifier: GPL-2.0-or-later
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program 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 General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
#
# on windows we have to link with the ws2_32 (winsock2) library as it is no longer added to the omnetpp system libraries by default (as of OMNeT++ 5.1)
# copied from INET Framework (inet-3.6.0) makefrag
#
ifeq ($(PLATFORM),win32.x86_64)
LIBS += -lws2_32
DEFINES += -DVEINS_EXPORT
ENABLE_AUTO_IMPORT=-Wl,--enable-auto-import
LDFLAGS := $(filter-out $(ENABLE_AUTO_IMPORT), $(LDFLAGS))
endif
# <<<
#------------------------------------------------------------------------------
# Main target
all: $(TARGET_DIR)/$(TARGET)
$(TARGET_DIR)/% :: $O/%
#mkdir -p $(TARGET_DIR)
$(Q)$(LN) $< $#
ifeq ($(TOOLCHAIN_NAME),clangc2)
$(Q)-$(LN) $(<:%.dll=%.lib) $(#:%.dll=%.lib)
endif
$O/$(TARGET): $(OBJS) $(wildcard $(EXTRA_OBJS)) Makefile $(CONFIGFILE)
#$(MKPATH) $O
#echo Creating shared library: $#
$(Q)echo >.tmp$$$$ $(OBJS) $(EXTRA_OBJS) && $(AR) .tmplib$$$$ #.tmp$$$$ && $(SHLIB_LD) -o $O/$(TARGET) $(AS_NEEDED_OFF) $(WHOLE_ARCHIVE_ON) .tmplib$$$$ $(LIBS) $(WHOLE_ARCHIVE_OFF) $(OMNETPP_LIBS) $(LDFLAGS) && rm .tmp$$$$ && rm .tmplib$$$$
$(Q)$(SHLIB_POSTPROCESS) $O/$(TARGET)
.PHONY: all clean cleanall depend msgheaders smheaders
.SUFFIXES: .cc
$O/%.o: %.cc $(COPTS_FILE) | msgheaders smheaders
#$(MKPATH) $(dir $#)
$(qecho) "$<"
$(Q)$(CXX) -c $(CXXFLAGS) $(COPTS) -o $# $<
%_m.cc %_m.h: %.msg
$(qecho) MSGC: $<
$(Q)$(MSGC) -s _m.cc -MD -MP -MF $O/$(basename $<)_m.h.d $(MSGCOPTS) $?
%_sm.cc %_sm.h: %.sm
$(qecho) SMC: $<
$(Q)$(SMC) -c++ -suffix cc $(SMCOPTS) $?
msgheaders: $(MSGFILES:.msg=_m.h)
smheaders: $(SMFILES:.sm=_sm.h)
clean:
$(qecho) Cleaning $(TARGET)
$(Q)-rm -rf $O
$(Q)-rm -f $(TARGET_DIR)/$(TARGET)
$(Q)-rm -f $(TARGET_DIR)/$(TARGET:%.dll=%.lib)
$(Q)-rm -f $(call opp_rwildcard, . , *_m.cc *_m.h *_sm.cc *_sm.h)
cleanall:
$(Q)$(MAKE) -s clean MODE=release
$(Q)$(MAKE) -s clean MODE=debug
$(Q)-rm -rf $(PROJECT_OUTPUT_DIR)
# include all dependencies
-include $(OBJS:%=%.d) $(MSGFILES:%.msg=$O/%_m.h.d) ```
I just had to change the extension of the TutorialAppl.cpp to CC.
I guess sometimes we look for the difficult way to solve problems and it is actually the easy way you have to take :)
Thanks for your attention.

Why is automake prefixing my object files with the package name?

In my src directory, I have source files such as cells.c. When I perform a compilation, the compiler prefixes the object file with the package name, so that it becomes neoleo-cells.o, for example. Why is it doing this, and how can I stop it? I don't think it's standard behaviour.
Here is Makefile.am:
#VPATH = $(srcdir) $(builddir)
GUI_SRCS =
GUI_LINK =
#GUI_DEFINES = -DX_DISPLAY_MISSING
GUI_DEFINES = -DHAVE_X
# Order of linking of libraries for Motif seems to be important
# I have decided to mandate the use of the Xbae library, rather than
# have it optional.
if UseMotif
GUI_SRCS += io-motif.c appres.c fallback.c oleo_icon.xpm
GUI_LINK += -lXm -lXt -lXbae
GUI_DEFINES += -DHAVE_MOTIF
endif
GUI_SRCS += io-x11.c xrdb.c
GUI_LINK += -lX11
YFLAGS = -d
EXTRA_DIST = $(srcdir)/neoleo.i
bin_PROGRAMS = neoleo
BUILT_SOURCES = getdate.c parse.c parse.h posixtm.c posixtm.h
#BUILT_SOURCES += neoleo_wrap.c
CLEANFILES = $(BUILT_SOURCES)
#lib_LTLIBRARIES = libneoleo.la
neoleo_CFLAGS = $(GUI_DEFINES) -Dmain0=main
neoleo_LDADD = -lm -lncurses -lpthread $(GUI_LINK)
#neoleo_LDFLAGS = -e main0
#neoleo_la_LDFLAGS = -module -avoid-version -shared
neoleo_SOURCES = afm.c args.c basic.c busi.c byte-compile.c cells.c cmd.c date.c decompile.c display.c \
epson.c eval.c font.c format.c forminfo.c funcs.c graph.c gsl.c hash.c help.c \
info.c init.c input.c \
io-headless.c io-curses.c io-edit.c io-term.c io-utils.c \
ir.c key.c legend.c line.c list.c lists.c mdi.c oleofile.c pcl.c plot.c \
postscript.c print.c prtext.c ref.c regions.c sc.c sort.c string.c stub.c sylk.c utils.c \
window.c \
defuns.c \
get_date.h getdate.y \
parse.y \
posixtm.y \
neoleo_swig.c \
mysql.c $(GUI_SRCS)
noinst_HEADERS = afm.h appres.h args.h basic.h byte-compile.h cell.h \
cmd.h decompile.h defun.h defuns.h display.h epson.h \
errors.h eval.h font.h format.h forminfo.h funcdef.h \
funcs.h global.h graph.h hash.h help.h info.h init.h \
input.h io-abstract.h io-headless.h io-curses.h io-edit.h \
io-generic.h io-motif.h io-term.h io-utils.h io-x11.h \
ir.h key.h line.h list.h lists.h mdi.h mysql.h node.h \
oleofile.h oleo_plot.h oleosql.h oleo_xb.h parse.h pcl.h \
posixtm.h postscript.h print.h proto.h prtext.h ref.h \
regions.h sc.h sciplot.h sciplotI.h sort.h stub.h stubs.h \
sylk.h sysdef.h userpref.h utils.h window.h \
neoleo_swig.h
# exclude these for now:
# plotter.c xbase.cpp
ref.o : parse.h
#neoleo_wrap.c : $(srcdir)/neoleo.i neoleo_swig.c neoleo_swig.h
# swig -tcl8 -o $# $<
This line causes the rename of the object files:
neoleo_CFLAGS = $(GUI_DEFINES) -Dmain0=main
If you have target-dependent compilation flags, Automake chooses different names for the resulting object files. This approach avoids clashes if there are multiple different targets that use the same sources but different flags.
Now, Automake could in theory notice that this isn't happening and not rename the object files. However, in practice most people don't care what the intermediate files are called, and this approach, I believe, simplified the implementation.
In your case, it sounds like you do care. So, just rename that variable to AM_CFLAGS and everything should work as you expect.

How should I link libraries in automake normally linked with pkg-config?

I'm trying to get my project buildable with automake. Specifically while using Allegro5.
I can build my code using the following command just fine
g++ -std=c++0x *.cpp -o mygame $(pkg-config --libs allegro-5.0 \
allegro_acodec-5.0 allegro_audio-5.0 allegro_color-5.0 allegro_dialog-5.0 \
allegro_font-5.0 allegro_image-5.0 allegro_main-5.0 allegro_memfile-5.0 \
allegro_physfs-5.0 allegro_primitives-5.0 allegro_ttf-5.0)
But my Makefile will not work.
Here is my src/Makefile.am
bin_PROGRAMS = mygame
AM_CXXFLAGS = "-std=c++0x"
mygame_SOURCES = Animation.cpp Body.cpp GameObject.cpp Menu.cpp Vector3.cpp \
Arena.cpp Button.cpp Keyboard.cpp Mesh.cpp Assets.cpp Character.cpp \
main.cpp Mouse.cpp Barrier.cpp Environment.cpp Manager.cpp TitleMenu.cpp
mygame_LDADD = allegro-5.0 allegro_acodec-5.0 allegro_audio-5.0 \
allegro_color-5.0 allegro_dialog-5.0 allegro_font-5.0 allegro_image-5.0 \
allegro_main-5.0 allegro_memfile-5.0 allegro_physfs-5.0 \
allegro_primitives-5.0 allegro_ttf-5.0
CLEANFILES = mygame *.o
And here is my configure.ac
AC_INIT(bayou, 0.1.0)
AM_INIT_AUTOMAKE
AC_LANG_CPLUSPLUS
AC_PROG_CXX
LT_INIT
AC_OUTPUT(
Makefile \
src/Makefile\
)
Running my first command works just fine. Running make gives me
make: *** No rule to make target `allegro-5.0', needed by 'mygame'. Stop.
So how should I set up my configure.ac and Makefile.am's so I can use libraries I normally link with pkg-config?
pkg-config is there to tell you dynamically which paths/flags to use.
It is meant to be used dynamically, rather than to run it on your development machine and then copy'n'paste it into the makefile and then expect it to run on any deployment machine.
Here's an updated Makefile.am, based on your own answer:
bin_PROGRAMS = mygame
AM_CXXFLAGS = "-std=c++0x"
PKGLIBS=allegro-5.0 \
allegro_acodec-5.0 allegro_audio-5.0 allegro_color-5.0 allegro_dialog-5.0 \
allegro_font-5.0 allegro_image-5.0 allegro_main-5.0 allegro_memfile-5.0 \
allegro_physfs-5.0 allegro_primitives-5.0 allegro_ttf-5.0
mygame_CXXFLAGS = $(shell pkg-config --cflags $(PKGLIBS)) $(AM_CXXFLAGS)
mygame_LDADD = $(shell pkg-config --libs $(PKGLIBS))
mygame_SOURCES = Animation.cpp Body.cpp GameObject.cpp Menu.cpp Vector3.cpp \
Arena.cpp Button.cpp Keyboard.cpp Mesh.cpp Assets.cpp Character.cpp \
main.cpp Mouse.cpp Barrier.cpp Environment.cpp Manager.cpp TitleMenu.cpp
it might be that in your setup, the entire allegro-foo doesn't need any special compiler-flags, but it might as well need some. therefore my example also sets the compiler-flags for your program (mygame_CXXFLAGS).
finally, it get's rid of the unneeded CLEANFILES.
Also, you could go the autotools route, and use the PKG_CHECK_MODULES macro in your configure.ac
My lead in the suggestion worked. I did not have to modify my configure.ac (though I probably should so I can verify expected packages are installed)
Anyway, I ran pkg-config <insert libs from comment here> in a terminal window, which gave the following output
-L/usr/local/lib -lallegro_acodec -lallegro_audio -lallegro_color
-lallegro_dialog -lallegro_image -lallegro_main -lallegro_memfile
-lallegro_physfs -lallegro_primitives -lallegro_ttf -lallegro_font
-lallegro
So my new Makefile.am looks like
bin_PROGRAMS = mygame
AM_CXXFLAGS = "-std=c++0x"
mygame_SOURCES = Animation.cpp Body.cpp GameObject.cpp Menu.cpp Vector3.cpp \
Arena.cpp Button.cpp Keyboard.cpp Mesh.cpp Assets.cpp Character.cpp \
main.cpp Mouse.cpp Barrier.cpp Environment.cpp Manager.cpp TitleMenu.cpp
mygame_LDADD = -Lusr/local/lib -lallegro_acodec \
-lallegro_audio -lallegro_color -lallegro_dialog -lallegro_image \
-lallegro_main -lallegro_memfile -lallegro_physfs -lallegro_primitives \
-lallegro_ttf -lallegro_font -lallegro
CLEANFILES = mygame *.o
I'd like to thank the academy and my parents for seeing me through this trying time. They've meant so much to me! *blows kisses

Makefile is always 'up to date' while files have been changed

I have a Makefile to compile several fortran files, most of which are module files. Whenever I changed the module file and initiate make command, the make says:
make: `PRM' is up to date.
PRM is the executable name. No such problem when I changed the main file. Another problem is that sometimes I also get:
make: m2c: Command not found
error. My makefile looks like:
.SUFFIXES: .f90
F90 = pgf90
NETCDF_DIR = /opt/netcdf
F90_FLAGS = -Mbackslash -Mlarge_arrays
LIBS = -L$(NETCDF_DIR)/lib -lnetcdff -lnetcdf
INCLUDE_MODULES = -I$(NETCDF_DIR)/include
VPATH = /path/FORTRAN
util_module = \
precmod.o \
strings.o
EXEC = PRM
OBJS = \
${util_module} \
mo_date.o \
mo_utils.o \
module_metcro_lib.o \
module_plumerise1.o \
module_finn_lib.o \
main_plm.o
${EXEC} : ${OBJS}
${F90} -o $# ${OBJS} ${LIBS}
.f90.o:
${F90} -c ${F90_FLAGS} ${INCLUDE_MODULES} $<
clean:
rm -f ${EXEC} ${OBJS} *.mod
thanks for answering!

Makefile loops endless

My makefile loops endless but can't figure out why? Here is it further informations at sf.net/p/ags
AUTOMAKE_OPTIONS = foreign
top_srcdir = $(shell pwd)/src/ags
SUBDIRS = src/ags \
doc
-include ./src/ags/Makefile.am \
$(top_srcdir)/util/Makefile.am \
$(top_srcdir)/lib/Makefile.am \
$(top_srcdir)/object/Makefile.am \
$(top_srcdir)/widget/Makefile.am \
$(top_srcdir)/audio/Makefile.am \
$(top_srcdir)/audio/task/Makefile.am \
$(top_srcdir)/audio/file/Makefile.am \
$(top_srcdir)/audio/recall/Makefile.am \
$(top_srcdir)/audio/task/recall/Makefile.am \
$(top_srcdir)/file/Makefile.am \
$(top_srcdir)/X/Makefile.am \
$(top_srcdir)/X/editor/Makefile.am \
$(top_srcdir)/X/machine/Makefile.am \
$(top_srcdir)/file/Makefile.am \
$(top_srcdir)/server/Makefile.am \
./doc/Makefile.am
CC = gcc
# what flags you want to pass to the C compiler & linker
CFLAGS = -g --pedantic -Wall -O -I./src -I/usr/include
LDFLAGS = -L/lib -L/usr/lib -L/usr/X11/lib -lm -pthread -lrt -lgmp
# this lists the binaries to produce, the (non-PHONY, binary) targets in
# the previous manual Makefile
noinst_LIBRARIES = libags.a libags-thread.a libags-audio.a
bin_PROGRAMS = gsequencer
# library
libags_a_CFLAGS=
libags_a_LDFLAGS =
# application
gsequencer_CFLAGS=
gsequencer_LDFLAGS=
gsequencer_LDADD=libags.a libags-thread.a libags-audio.a
#
libags_audio_h_sources = $(ags_recall_audio_h_sources) $(ags_audio_task_h_sources) $(ags_xorg_task_h_sources) $(ags_audio_file_h_sources) $(ags_audio_recall_task_h_sources)
libags_audio_c_sources = $(ags_recall_audio_c_sources) $(ags_audio_task_c_sources) $(ags_xorg_task_c_sources) $(ags_audio_file_c_sources) $(ags_audio_recall_task_c_sources)
gsequencer_h_sources = $(ags_xorg_h_sources) $(ags_machine_h_sources) $(ags_editor_h_sources)
gsequencer_c_sources = $(ags_xorg_c_sources) $(ags_machine_c_sources) $(ags_editor_c_sources)
libags_a_SOURCES = $(ags_lib_c_sources) $(ags_object_c_sources) $(ags_util_c_sources)
libags_thread_a_SOURCES = $(ags_thread_c_sources)
libags_audio_a_SOURCES = $(ags_audio_c_sources)
libags_gui_a_SOURCES = $(ags_widget_c_sources)
gsequencer_SOURCES = $(gsequencer_c_sources) $(ags_server_c_sources) $(ags_file_c_sources)
Wiping all build scripts
rm *
Touching all files
find . -type f | xargs touch
Running the following to rebuild build scripts did it finally
aclocal
autoheader
libtoolize --force --copy
automake --add-missing --copy --foreign
autoconf
./configure
make
PROBLEM: empty Makefile.am caused infinite loop
SOLUTION: add an empty variable to it

Resources