Makefile loops endless - makefile

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

Related

mpif90 not found but it's intsalled

I'm trying to run a makefile and came across two errors. When I run make I get this:
$ make
mpif90 -xHost -ip -fpp -O3 -align -I/include/intel64/lp64 -I/include/fftw -c integ-Coul.F
make: mpif90: Command not found
make: *** [makefile:181: integ-Coul.o] Error 127
So, I already have installed openmpi-devel and the file mpif90 it's in the /usr/lib64/openmpi/bin folder, but the error keeps reocurring.
This is the makefile
#
.SUFFIXES:
.SUFFIXES: .f .F .for .cpp .F90 .cu .o
#FC=ifort -xHost -ip -fpp
FC = mpif90 -xHost -ip -fpp
FREE = -free
# use this flag for debugging and coding up
SAFE = #-g -traceback -check all #-fstack-protector -assume protect_parens -implicitnone -warn all
FFLAGS1 = -O3 -align
FFLAGS2 = -O2 -align -qopenmp -parallel $(FREE) $(SAFE)
LDFLAGS = -static-intel
CXX = icpc -std=c++11
SAFE_CXX = #-g -traceback
CFLAGS = -O2 -align -xHost -ip -qopenmp -fno-exceptions -restrict $(SAFE_CXX)
# MKLROOT = If MKLROOT is not defined in your environment, edit and uncomment this line
LIB_BLAS = -lmkl_blas95_lp64
LIB_LAPACK = -lmkl_lapack95_lp64 -lmkl_intel_lp64 -lmkl_intel_thread -lmkl_core
LIB_OMP = -liomp5 -lpthread
INCS_MKL = -I$(MKLROOT)/include/intel64/lp64 -I$(MKLROOT)/include/fftw
# Uncomment the lines below when compiling for GPUs
# GPU_DEFS options:
# -DGPU_TIMING : Print timings (CPU/GPU)
# -DUSE_GPU : Compile with GPU support
# -DGPU_DEBUG : Print some debug messages
# -DGPU_SYGVDM_VER : Use multi-gpu version of SYGVD (faster than single-gpu even with 1 gpu)
# -DGPU_SYGVD2S_VER : Use two stage version of SYGVD (faster, but needs more memory)
# -DGPU_DONT_PIN_MEM : Don't use pinned memory for faster transfers (in Fortran code)
# -DGPU_PIN_MEM_WORK : Use pinned memory for work spaces (in C code)
#GPU_DEFS = -DUSE_GPU
#
ifneq (,$(findstring USE_GPU,$(GPU_DEFS)))
# CUDA compiler
NVCC = nvcc
# compute capality (depends on your GPU, check!)
SM = 35
#SAFE_NVCC = -g -lineinfo
NVCCFLAGS = -O3 -gencode arch=compute_${SM},code=sm_${SM} -Xcompiler "-fno-strict-aliasing -march=native -fno-exceptions" $(SAFE_NVCC)
# -fno-strict-aliasing
#
# CUDA and MAGMA paths:
CUDADIR = /usr/local/cuda
MAGMADIR = /opt/magma
#
# CUDA and MAGMA libs:
# dynamic linking:
#LIB_CUDA = -L$(CUDADIR)/lib64 -lcublas -lcusparse -lcudart
# static linking:
LIB_CUDA = -L$(CUDADIR)/lib64 -lcublas_static -lcusparse_static -lculibos -lcudart_static -ldl
LIB_MAGMA = $(MAGMADIR)/lib/libmagma.a
#
LIB_GPU = $(LIB_MAGMA) $(LIB_CUDA) -lstdc++
INCS_GPU = -I$(CUDADIR)/include -I$(MAGMADIR)/include
endif
LIB = $(LIB_GPU) $(LIB_BLAS) $(LIB_LAPACK) $(LIB_OMP) -lrt
INCS = $(INCS_MKL)
#-----------------------------------------------------------------------
# general rules
#-----------------------------------------------------------------------
#INCS1 = comun.inc integcoul.inc m2cdat.inc $(INCS)
SOURCE1 = integ-Coul.o \
Coul0sim.o \
m2caux3-Coul.o \
abcpes-Coul.o \
ckplm-Coul.o \
util-Coul.o
SOURCE2 = constants_m.o \
Matrix_math.o \
exec_time.o \
types_EHT.o \
types_MM.o \
parameters.o \
MPI_defs.o \
OPT_parent.o \
parameters_MM.o \
checklist.o \
allocation_m.o \
util.o \
EHT_input.o \
tuning.o \
IdentifyNonBonded.o \
babel_routines.o \
babel.o \
gmx2mdflex.o \
namd2mdflex.o \
structure.o \
md_read.o \
md_setup.o \
f_intra.o \
f_inter.o \
md_output.o \
pbc.o \
overlap_D.o \
STO.o \
multip_routines.o \
LCMO_Builder.o \
Coulomb.o \
DP_main.o \
td_dp.o \
DP_FMO.o \
dipole_phi.o \
EnvField.o \
polarizability.o \
hamiltonians.o \
QCModel_Huckel.o \
diabatic-Ehren.o \
HuckelForces.o \
Ehrenfest.o \
CoulInt_QMMM.o \
FMO.o \
electron_hole_DP.o \
AlphaPolar.o \
data_output.o \
backup_MM.o \
Berendsen.o \
NoseHoover.o \
NoseHoover_Reversible.o \
NVE.o \
VDOS_m.o \
MM_dynamics.o \
MM_driver.o \
film_STO.o \
DOS_m.o \
oscillator.o \
ga_QCModel.o \
cost_tuning_EH.o \
cost_tuning_MM.o \
nonlinearCG.o \
CG_class.o \
MM_ERG_class.o \
nonlinear-sidekick.o \
FF_OPT_class.o \
CG_EH_driver.o \
ga_routines.o \
CG_MM_driver.o \
vibes_driver.o \
solvated_M.o \
DOS_tool.o \
backup.o \
auto_correlation.o \
ElHl_schroedinger.o \
diagnostic.o \
qdynamics.o \
Taylor.o \
ElHl_Chebyshev.o \
ElHl_Chebyshev_GPU.o \
AO_adiabatic.o \
Chebyshev_driver.o \
eigen_driver.o \
ga_driver.o \
avrg_confgs.o \
main.o
SOURCE_GPU = GPU_Interface.o \
Taylor_gpu.o
# Chebyshev_gpu.o
ifneq (,$(findstring USE_GPU,$(GPU_DEFS)))
SOURCE_CUDA= Chebyshev_gpu_kernels.o \
dzgemv_kernels.o
endif
a: $(SOURCE1) $(SOURCE2) $(SOURCE_GPU) $(SOURCE_CUDA)
rm -f a
$(FC) $(INCS) $(LDFLAGS) -o a $(SOURCE1) $(SOURCE2) $(SOURCE_GPU) $(SOURCE_CUDA) $(LIB)
.F.o:
$(FC) $(FFLAGS1) $(INCS) -c $<
.f.o:
$(FC) $(FFLAGS2) $(INCS) $(GPU_DEFS) -c $<
.F90.o:
$(FC) $(FFLAGS1) $(INCS) $(GPU_DEFS) -c $<
.cpp.o:
$(CXX) $(CFLAGS) $(INCS_GPU) $(GPU_DEFS) -c $<
.cu.o:
$(NVCC) $(NVCCFLAGS) $(INCS_GPU) $(GPU_DEFS) -c $<
clean:
-rm -f a *.o *.mod; touch *.f
depend:
#echo -en "Searching module dependencies..."
#chmod +x ./makedepend.bsh
#./makedepend.bsh > dependencies.txt
#echo -en " done.\n"
## Dependency list:
-include dependencies.txt
I don't have much experience so I would really appreciate some help with this. Thank you all.
Ps.: my SO is Fedora 32

Undefined reference to `compress2' and other functions in the HDF5 library

I am trying to make a code called iPIC3D and it has some prerequisite libraries such as HDF5, H5hut etc. I did everything as instructed. One has to install all the prerequisites and then run the "make" command. But while running the make command, I get a series of errors such as
/usr/local/hdf5/1.8.11-par/lib/libhdf5.a(H5Zdeflate.o): In function `H5Z_filter_deflate':
H5Zdeflate.c:(.text+0xf1): undefined reference to `compress2'
H5Zdeflate.c:(.text+0x1af): undefined reference to `inflateInit_'
H5Zdeflate.c:(.text+0x1c9): undefined reference to `inflate'
H5Zdeflate.c:(.text+0x27a): undefined reference to `inflateEnd'
H5Zdeflate.c:(.text+0x2dc): undefined reference to `inflateEnd'
H5Zdeflate.c:(.text+0x3de): undefined reference to `inflateEnd'
collect2: error: ld returned 1 exit status
make: *** [main] Error 1
Here is a copy of my makefile for reference
PIC_HOME = $(dir $(abspath $(lastword $(MAKEFILE_LIST))))
## SECTION THAT DEPENDS ON THE SYSTEM
# -- Modify this variables according
# -- to your system options.
# -- Possible flags:
# -DPARALLEL_IO Use parallel HDF5
# -DUSEH5HUT Use H5hut (must include also -DPARALLEL_IO)
# -DBATSRUS Coupling with BATS-R-US
CXX = mpicxx
HDF5_HOME = /usr/local/hdf5/1.8.11-par
H5HUT_HOME = /usr/local/H5hut/1.8.11
IPIC_FLAGS = "-DUSEH5HUT -DPARALLEL_IO"
## END OF SECTION
OPTIM = -O3
HDF5_LIB = $(HDF5_HOME)/lib/libhdf5_hl.a $(HDF5_HOME)/lib/libhdf5.a
H5HUT_LIB = $(H5HUT_HOME)/lib/libH5hut.a
H5HUTIO_LIB = $(IPIC_HOME)/H5hut-io/libH5hut-io.a
INC_DIR = ./include
INC_H5HUT = $(H5HUT_HOME)/include
INC_H5HUTIO = $(IPIC_HOME)/H5hut-io/include
INC_HDF5 = $(HDF5_HOME)/include
.SUFFIXES:
.SUFFIXES: .cpp .o .h
SRC = \
$(IPIC_HOME)/grids/Grid3DCU.cpp \
$(IPIC_HOME)/fields/BCStructure.cpp \
$(IPIC_HOME)/fields/EMfields3D.cpp \
$(IPIC_HOME)/inputoutput/phdf5.cpp \
$(IPIC_HOME)/inputoutput/Restart3D.cpp \
$(IPIC_HOME)/inputoutput/ParallelIO.cpp \
$(IPIC_HOME)/inputoutput/Collective.cpp \
$(IPIC_HOME)/performances/Timing.cpp \
$(IPIC_HOME)/PSKOutput3D/PSKhdf5adaptor.cpp \
$(IPIC_HOME)/bc/BcParticles.cpp \
$(IPIC_HOME)/bc/BcFields3D.cpp \
$(IPIC_HOME)/mathlib/EllipticF.cpp \
$(IPIC_HOME)/solvers/CG.cpp \
$(IPIC_HOME)/solvers/GMRES.cpp \
$(IPIC_HOME)/ConfigFile/src/ConfigFile.cpp \
$(IPIC_HOME)/main/iPic3Dlib.cpp \
$(IPIC_HOME)/particles/Particles3Dcomm.cpp \
$(IPIC_HOME)/particles/Particles3D.cpp \
$(IPIC_HOME)/communication/ComNodes3D.cpp \
$(IPIC_HOME)/communication/ComParser3D.cpp \
$(IPIC_HOME)/communication/ComInterpNodes3D.cpp \
$(IPIC_HOME)/communication/ComParticles3D.cpp \
ALLOBJ = $(subst .cpp,.o,$(SRC))
IPIC3D_EXE = $(IPIC_HOME)/iPic3D
IPIC3D_LIB = $(IPIC_HOME)/libiPic3Dlib.a
LDLIBS = $(IPIC3D_LIB) $(H5HUTIO_LIB) $(H5HUT_LIB) $(HDF5_LIB) -ldl
all : io lib main
io :
CXX=$(CXX) HDF5_HOME=$(HDF5_HOME) H5HUT_HOME=$(H5HUT_HOME) IPIC_FLAGS=$(IPIC_FLAGS) $(MAKE) -C $(IPIC_HOME)/H5hut-io
lib : $(ALLOBJ)
$(AR) sr $(IPIC3D_LIB) $(ALLOBJ)
ranlib $(IPIC3D_LIB)
main : iPic3D.o
$(CXX) $(LDFLAGS) -I$(INC_DIR) -I$(INC_HDF6) iPic3D.cpp -o $(IPIC3D_EXE) $(LDLIBS)
clean : cleanio
$(RM) $(ALLOBJ)
$(RM) $(IPIC3D_LIB)
$(RM) iPic3D.o
$(RM) $(IPIC3D_EXE)
cleanio :
$(MAKE) -C $(IPIC_HOME)/H5hut-io clean
%.o : %.cpp
echo " Compiling " $#
$(CXX) $(CXXFLAGS) $(OPTIM) $(IPIC_FLAGS) -I$(INC_DIR) -I$(INC_H5HUTIO) -I$(INC_H5HUT) -I$(INC_HDF5) -c $< -o $#
I am unable to understand what exactly is causing this problem.
I would say you are missing linking in the libz library as this is where the compress2 function should come from. Try adding -lz to your LDLIBS.

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.

running linker in bare-metal arm example and linker can't find the loader file which exists

I found a bare-metal example for a board different from mine so I will have to modify the loader script but for now I just want to be able to compile and link the example as it is.
I copied the arm-none-eabi cross-compiler to the directory just above c_blinky which is where the source files are.
(I have a diagram of the directory structure on a page on my website)
Here's the makefile:
ifeq ($(GNU_ARM),)
GNU_ARM = ../arm-none-eabi/bin
endif
CC := $(GNU_ARM)/arm-none-eabi-gcc
CPP := $(GNU_ARM)/arm-none-eabi-g++
ASM := $(GNU_ARM)/arm-none-eabi-as
LINK := $(GNU_ARM)/arm-none-eabi-gcc
BIN := $(GNU_ARM)/arm-none-eabi-objcopy
RM := rm -rf
MKDIR := mkdir
BLDDIR = .
CCINC = -I$(BLDDIR)
APP_DEP = $(BLDDIR)/bsp.h \
$(BLDDIR)/arm_exc.h \
$(BLDDIR)/isr.h
APP_NAME = blinky
ARM_CORE = arm7tdmi
ifeq (rel, $(CONF)) # Release configuration
BINDIR = rel
CCFLAGS = -c -mcpu=$(ARM_CORE) -mthumb-interwork -Os \
-mlong-calls -ffunction-sections -Wall -DNDBEBUG -o$#
ASMFLAGS = -mcpu=$(ARM_CORE) -mthumb-interwork -o$#
LINKFLAGS = -T .\$(APP_NAME).ld -o $(BINDIR)\$(APP_NAME).elf \
-Wl,-Map,$(BINDIR)\$(APP_NAME).map,--cref,--gc-sections
else # default Debug configuration
BINDIR = dbg
CCFLAGS = -g -c -mcpu=$(ARM_CORE) -mthumb-interwork -O \
-mlong-calls -ffunction-sections -Wall -o$#
ASMFLAGS = -g -mcpu=$(ARM_CORE) -mthumb-interwork -o$#
LINKFLAGS = -T .\$(APP_NAME).ld -o $(BINDIR)\$(APP_NAME).elf \
-Wl,-Map,$(BINDIR)\$(APP_NAME).map,--cref,--gc-sections
endif
all: $(BINDIR)/$(APP_NAME).bin
$(BINDIR)/$(APP_NAME).bin : $(BINDIR)/$(APP_NAME).elf
$(BIN) -O binary $(BINDIR)/$(APP_NAME).elf $(BINDIR)/$(APP_NAME).bin
$(BINDIR)/$(APP_NAME).elf : \
./$(APP_NAME).ld \
$(BINDIR)/startup.o \
$(BINDIR)/arm_exc.o \
$(BINDIR)/low_level_init.o \
$(BINDIR)/isr.o \
$(BINDIR)/bsp.o \
$(BINDIR)/blinky.o
$(LINK) \
$(BINDIR)/startup.o \
$(BINDIR)/arm_exc.o \
$(BINDIR)/low_level_init.o \
$(BINDIR)/isr.o \
$(BINDIR)/bsp.o \
$(BINDIR)/blinky.o \
$(LINKFLAGS)
$(BINDIR)/startup.o: $(BLDDIR)/startup.s
$(ASM) $(ASMFLAGS) $<
$(BINDIR)/arm_exc.o: $(BLDDIR)/arm_exc.s
$(ASM) $(ASMFLAGS) $<
# choose the ARM or THUMB compilation for each module...
$(BINDIR)/low_level_init.o: $(BLDDIR)/low_level_init.c $(APP_DEP)
$(CC) -marm $(CCFLAGS) $(CCINC) $<
$(BINDIR)/isr.o: $(BLDDIR)/isr.c $(APP_DEP)
$(CC) -marm $(CCFLAGS) $(CCINC) $<
$(BINDIR)/bsp.o: $(BLDDIR)/bsp.c $(APP_DEP)
$(CC) -mthumb $(CCFLAGS) $(CCINC) $<
$(BINDIR)/blinky.o: $(BLDDIR)/blinky.c $(APP_DEP)
$(CC) -mthumb $(CCFLAGS) $(CCINC) $<
I set GNU_ARM in the makefile to ../arm-none-eabi/bin and ran make and got the following error:
(the file blinky.ld does exist in the source directory)
../arm-none-eabi/bin/arm-none-eabi-gcc \
dbg/startup.o \
dbg/arm_exc.o \
dbg/low_level_init.o \
dbg/isr.o \
dbg/bsp.o \
dbg/blinky.o \
-T .\blinky.ld -o dbg\blinky.elf -Wl,-Map,dbg\blinky.map,--cref,--gc-sections
/home/dan/dev/compile/bare-metal/arm-none-eabi/bin/../lib/gcc/arm-none-eabi/4.9.3/../../../../arm-none-eabi/bin/ld: cannot open linker script file .blinky.ld: No such file or directory
collect2: error: ld returned 1 exit status
make: *** [dbg/blinky.elf] Error 1
I thought the LINK assignment at the beginning should be:
LINK := $(GNU_ARM)/arm-none-eabi-ld
and not
LINK := $(GNU_ARM)/arm-none-eabi-gcc
and I got:
../arm-none-eabi/bin/arm-none-eabi-ld \
dbg/startup.o \
dbg/arm_exc.o \
dbg/low_level_init.o \
dbg/isr.o \
dbg/bsp.o \
dbg/blinky.o \
-T .\blinky.ld -o dbg\blinky.elf -Wl,-Map,dbg\blinky.map,--cref,--gc-sections
../arm-none-eabi/bin/arm-none-eabi-ld: cannot open linker script file .blinky.ld: No such file or directory
make: *** [dbg/blinky.elf] Error 1
It looks like arm-none-eabi-gcc is calling collect2 in lib/gcc/arm-none-eabi/4.9.3 which in turn calls ld which is not in the main bin directory:
/home/dan/dev/compile/bare-metal/arm-none-eabi/bin/../lib/gcc/arm-none-eabi/4.9.3/../../../../arm-none-eabi/bin/ld:
I tried making a symbolic link to arm-none-eabi-ld as ld and got the same error.

Resources