make 'match 'is up to date - makefile

When I run the code of siftDemoV4 I get the following error:
make 'match 'is up to date
What's wrong with this? I know that there is something wrong with the Makefile:
# ------------------ Compilation options ------------------------
# Loads math library.
LIBS = -lm
# Flags for the C compiler:
# -Wall for strict gcc warnings (requires prototypes for all functions).
# -g to produce debug data for gdb
# -O for optimization
CFLAGS = -Wall -g
CC = gcc
# --------------------- Code modules ----------------------------
# Object files
OBJ = match.o util.o
# Definitions
DEFS = defs.h
# ------------------------ Rules --------------------------------
match: ${OBJ}
${CC} -o $# ${CFLAGS} ${OBJ} ${LIBS}
# Implicit rule used by Gnu Make: $(CC) -c $(CPPFLAGS) $(CFLAGS)
${OBJ}: ${DEFS}

Related

Porting old make file to Windows

I'm attempting to convert this make file to a Windows make file. I haven't done anything like this before, and need some help. I've done research but don't really understand the plethora of errors that I'm running into. Is there an easy way to port this? Is it possible? Could this be made cross platform for cmake? This is all new to me.
#FLAGS = -lm -L/usr/pub/lib -lefence -o
#CC = cc -O2 -fullwarn -TENV:large_GOT
#CC = cc -g -Wall
CC = gcc -O2 # at least for SunOS
#CC = cc -g
#CC = cc -O2 -fullwarn
#CC = cc -O2
FLAGS = -lm -o
SOURCE = stride.c splitstr.c rdpdb.c initchn.c geometry.c thr2one.c one2thr.c filename.c tolostr.c strutil.c place_h.c hbenergy.c memory.c helix.c sheet.c rdmap.c phipsi.c command.c molscr.c die.c hydrbond.c mergepat.c fillasn.c escape.c p_jrnl.c p_rem.c p_atom.c p_helix.c p_sheet.c p_turn.c p_ssbond.c p_expdta.c p_model.c p_compnd.c report.c nsc.c area.c ssbond.c chk_res.c chk_atom.c turn.c pdbasn.c dssp.c outseq.c chkchain.c elem.c measure.c asngener.c p_endmdl.c stred.c contact_order.c contact_map.c
OBJECT = ${SOURCE:.c=.o}
BINDIR = .
.c.o:
$(CC) -c $< -o $#
stride : $(OBJECT)
$(CC) $(OBJECT) $(FLAGS) $(BINDIR)/stride${ARCH}
$(OBJECT) : stride.h protot.h
clean:
rm -f $(OBJECT)
show:
echo $(SOURCE)

Fortran Makefile with 2 executables

I'm trying to compile 2 F90 files and to execute each one separately using a Makefile. The language used is fortran. I am not used to this so I need your help.
The first file is called HECESE_avec_modif.f90 and the second one is called hecese_seq.f90.
The makefile is below :
# Define dependance for suffix .FFREE
# -----------------------------------
.SUFFIXES: .exe .out .o .f .f90
#
# Compilation options for ifort
# ---------------------------------
# ---------------------------------
#FLAGS_fred = -free -O2 -traceback -mcmodel=large\
# -check overflow -check bounds
#FLAGS_fred = -FR -free -ftz -O3 -fPIC
#F90_COMPILER = /opt/intel/bin/ifort
#---------------------------------------------------------
#
# Compilation options for G95
#
#FLAGS_fred = -C -O3 -ffree-form -ffree-line-length-huge -fzero
#FLAGS_fred = -O5 -ffree-form -ffree-line-length-huge -fzero
#F90_COMPILER = g95
#
# Compilation options for GFortran
FLAGS_fred = -ffree-form -ffree-line-length-none -O3 #-march=native
F90_COMPILER = gfortran -m64
F90_COMPILER7 = gfortran-7 -m64
#FLAGS_fred = -O3
#F90_COMPILER = gfortran
#FLAGS_CPPFOR = -L/usr/local/gfortran/lib/x86_64/
#
#
#FLAGS_fred = -free -O4
#
#
# ***************************************************
# ***************************************************
# ** **
# ** definition of file groups for F. Waymel **
# ** **
# ***************************************************
# ***************************************************
#
# 0.) group of all modules containing common variables
# for multiblocs initialisation
# ----------------------------------------------------
#
MAIN = HECESE_avec_modif.f90
MAIN2 = hecese_seq.f90
#
# Compilation of object files :
# -----------------------------
#
MAIN_OBJ =$(MAIN:.f90=.o)
MAIN_OBJ2 =$(MAIN2:.f90=.o)
# Creation of executable:
# ---------------------------------
#
#DEST1 = ~/bin
EXEC = hecesevfinale.out
EXEC2 = heceseseq.out
all : $(EXEC) $(EXEC2)
$(EXEC):$(MAIN_OBJ)
$(F90_COMPILER) -g $(FLAGS_fred) -o $(EXEC) $(MAIN_OBJ)
$(EXEC2):$(MAIN_OBJ2)
$(F90_COMPILER) -g $(FLAGS_fred) -o $(EXEC2) $(MAIN_OBJ2)
#
%.o : %.mod
.f90.o:
$(F90_COMPILER) -g $(FLAGS_fred) -c $<
# $(F90_COMPILER) -g $(FLAGS_fred) -c $<
%.o : %.mod
.f90.o:
$(F90_COMPILER) -g $(FLAGS_fred) -c $<
# $(F90_COMPILER) -g $(FLAGS_fred) -c $<
clean:
rm -f *.o *.mod *.out
#depend .depend:
# makedepf90 metas.f90 $(SOURCES90_fred1) $(SOURCES90_fred2) $(SOURCES90_mwl) $(SOURCES90_mwl2) > .depend
#include .depend
I think that I made a mistake related to the second file.
The message I get when I execute this makefile is :
gfortran -m64 -g -ffree-form -ffree-line-length-none -O3 -o hecesevfinale.out HECESE_avec_modif.o
make: *** No rule to make target 'hecese_seq.o', needed by 'heceseseq.out'. Stop.
I have another problem when I try to execute make clean.
I get :
makefile:82: warning: overriding recipe for target '.f90.o'
makefile:76: warning: ignoring old recipe for target '.f90.o'
Can you help me, please ?

Adding static library file to the makefile

I have following makefile executed by python script:
SOURCES_DIRECTORY = sources
# These directories should be created by build.py script
BUILD_DIRECTORY = builds
OBJECTS_DIRECTORY = objs
CORE = cortex-m4
LINKER_SCRIPT = linker_rom.ld
# C definitions
ifeq ($(RAM_FLASH), 1)
C_DEFS = -DRAM_FLASH
else
C_DEFS =
endif
INC_DIRS = sources
SRCS_DIRS = sources
# extension of C files
C_EXT = c
# wildcard for C source files (all files with C_EXT extension found in current
# folder and SRCS_DIRS folders will be compiled and linked)
C_SRCS = $(wildcard $(patsubst %, %/*.$(C_EXT), . $(SRCS_DIRS)))
# extension of ASM files
AS_EXT = s
# wildcard for ASM source files (all files with AS_EXT extension found in
# current folder and SRCS_DIRS folders will be compiled and linked)
AS_SRCS = $(wildcard $(patsubst %, %/*.$(AS_EXT), . $(SRCS_DIRS)))
# optimization flags ("-O0" - no optimization, "-O1" - optimize, "-O2" -
# optimize even more, "-Os" - optimize for size or "-O3" - optimize yet more)
OPTIMIZATION = -Og
# set to 1 to optimize size by removing unused code and data during link phase
REMOVE_UNUSED = 1
C_WARNINGS = -Wall -Wextra -Werror
# C language standard ("c89" / "iso9899:1990", "iso9899:199409",
# "c99" / "iso9899:1999", "gnu89" - default, "gnu99")
C_STD = c99
VPATH = $(SRCS_DIRS)
#============================================#
# Toolchain Configuration #
#============================================#
TOOLCHAIN = arm-none-eabi-
CXX = $(TOOLCHAIN)g++
CC = $(TOOLCHAIN)gcc
AS = $(TOOLCHAIN)gcc -x assembler-with-cpp
OBJCOPY = $(TOOLCHAIN)objcopy
OBJDUMP = $(TOOLCHAIN)objdump
SIZE = $(TOOLCHAIN)size
RM = rm -f
.PHONY: all clean
#=============================================================================#
# various compilation flags
#=============================================================================#
# core flags
CORE_FLAGS = -mcpu=$(CORE) -mthumb -specs=nano.specs -specs=nosys.specs -mfpu=fpv4-sp-d16 -mfloat-abi=hard
# flags for C compiler
C_FLAGS = -std=$(C_STD) -g -ggdb3 -fverbose-asm -Wa,-ahlms=$(OBJECTS_DIRECTORY)/$(notdir $(<:.$(C_EXT)=.lst)) -DSTM32F429xx $(FLAGS)
# flags for assembler
AS_FLAGS = -g -ggdb3 -Wa,-amhls=$(OBJECTS_DIRECTORY)/$(notdir $(<:.$(AS_EXT)=.lst)) $(FLAGS)
# flags for linker
LD_FLAGS = -T$(LINKER_SCRIPT) -g -Wl,-Map=$(OBJECTS_DIRECTORY)/test.map,--cref,--no-warn-mismatch
# process option for removing unused code
ifeq ($(REMOVE_UNUSED), 1)
LD_FLAGS += -Wl,--gc-sections
OPTIMIZATION += -ffunction-sections -fdata-sections
endif
LIBS = libmylib.a
LIB_DIRS = ./sources
#=============================================================================#
# do some formatting
#=============================================================================#
C_OBJS = $(addprefix $(OBJECTS_DIRECTORY)/, $(notdir $(C_SRCS:.$(C_EXT)=.o)))
AS_OBJS = $(addprefix $(OBJECTS_DIRECTORY)/, $(notdir $(AS_SRCS:.$(AS_EXT)=.o)))
OBJS = $(AS_OBJS) $(C_OBJS) $(CXX_OBJS) $(USER_OBJS)
DEPS = $(OBJS:.o=.d)
INC_DIRS_F = -I. $(patsubst %, -I%, $(INC_DIRS))
LIB_DIRS_F = $(patsubst %, -L%, $(LIB_DIRS))
ELF = $(BUILD_DIRECTORY)/$(NAME).elf
HEX = $(BUILD_DIRECTORY)/$(NAME).hex
BIN = $(BUILD_DIRECTORY)/$(NAME).bin
LSS = $(BUILD_DIRECTORY)/$(NAME).lss
DMP = $(BUILD_DIRECTORY)/$(NAME).dmp
# format final flags for tools, request dependancies for C++, C and asm
C_FLAGS_F = $(CORE_FLAGS) $(OPTIMIZATION) $(C_WARNINGS) $(C_FLAGS) $(C_DEFS) -MD -MP -MF $(OBJECTS_DIRECTORY)/$(#F:.o=.d) $(INC_DIRS_F)
AS_FLAGS_F = $(CORE_FLAGS) $(AS_FLAGS) $(AS_DEFS) -MD -MP -MF $(OBJECTS_DIRECTORY)/$(#F:.o=.d) $(INC_DIRS_F)
LD_FLAGS_F = $(CORE_FLAGS) $(LD_FLAGS) $(LIB_DIRS_F)
#contents of output directory
GENERATED = $(wildcard $(patsubst %, $(BUILD_DIRECTORY)/*.%, bin d dmp elf hex lss lst map o))
#=============================================================================#
# make all
#=============================================================================#
all : $(ELF) $(LSS) $(DMP) $(HEX) $(BIN)
# make object files dependent on Makefile
$(OBJS) : $(MAKEFILE_NAME)
# make .elf file dependent on linker script
$(ELF) : $(LINKER_SCRIPT)
#-----------------------------------------------------------------------------#
# linking - objects -> elf
#-----------------------------------------------------------------------------#
$(ELF) : $(OBJS)
$(CC) $(LD_FLAGS_F) $(OBJS) $(LIBS) -o $#
#-----------------------------------------------------------------------------#
# compiling - C source -> objects
#-----------------------------------------------------------------------------#
objs/%.o : %.$(C_EXT)
$(CC) -c $(C_FLAGS_F) $< -o $#
#-----------------------------------------------------------------------------#
# assembling - ASM source -> objects
#-----------------------------------------------------------------------------#
objs/%.o : %.$(AS_EXT)
$(AS) -c $(AS_FLAGS_F) $< -o $#
#-----------------------------------------------------------------------------#
# memory images - elf -> hex, elf -> bin
#-----------------------------------------------------------------------------#
$(HEX) : $(ELF)
$(OBJCOPY) -O ihex $< $#
$(BIN) : $(ELF)
$(OBJCOPY) -O binary $< $#
#-----------------------------------------------------------------------------#
# memory dump - elf -> dmp
#-----------------------------------------------------------------------------#
$(DMP) : $(ELF)
$(OBJDUMP) -x --syms $< > $#
#-----------------------------------------------------------------------------#
# extended listing - elf -> lss
#-----------------------------------------------------------------------------#
$(LSS) : $(ELF)
$(OBJDUMP) -S $< > $#
# include dependancy files
-include $(DEPS)
This is the project tree
-> /sources/
-> /sources/libmylib.a
-> /makefile
I thought adding
LIBS = libmylib.a
LIB_DIRS = ./sources
will solve the problem. My lib is libmylib.a file. However console still outputs the errors with undefined references to functions. What should I change?
Path to the directories with sources, objects, headers and flags are passed dynamically by the python script as arguments.
It should be:
LIBS = -lmylib
The compiler will prepend lib and append .a to the libraries you specify, making it look for a library file named libmylib.a which is what you want.

modifying Makefile for silverfrost FTN95 ( Windows)

Compiling error
I am quite new to Fortran coding.
Currently, I have a makefile which has been previously used by original authors to compile the Fortran codes in Linux. However, I cannot understand what needs to be changed in the previous makefile to run it in Windows-based compiler Silverfrost FTN95.
While trying to compile in FTN95 I encountered the following error:
C:\Users\Geo-TGS\Documents\landslidemodel\src\TRIGRS>MAKE TPX
mpif90 -w -O3 -w -O3 -c ssizgrd.f95
process_begin: CreateProcess(NULL, mpif90 -w -O3 -w -O3 -c ssizgrd.f95, ...) failed.
make (e=2): The system cannot find the file specified.
makefile:59: recipe for target `ssizgrd.o' failed
MAKE: *** [ssizgrd.o] Error 2
C:\Users\Geo-TGS\Documents\landslidemodel\src\TRIGRS>make trg
mpif90 -w -O3 -w -O3 -c grids.f95
process_begin: CreateProcess(NULL, mpif90 -w -O3 -w -O3 -c grids.f95, ...) failed.
make (e=2): The system cannot find the file specified.
makefile:59: recipe for target `grids.o' failed
make: *** [grids.o] Error 2
Below is the Makefile code:
TRG = trg
PRG = prg
TPX = tpx
OBJT90 = trigrs.o flux.o prpijz.o svxmdv.o svijz.o dzero_brac.o
OBJT95 = grids.o input_vars.o model_vars.o dsimps.o input_file_defs.o iverson.o pstpi.o satfin.o savage.o steady.o trini.o unsinf.o ivestp.o pstpf.o rnoff.o satinf.o smallt.o svgstp.o unsfin.o unsth.o ssizgrd.o svlist.o
OBJT77 = calerf.o dbsct.o derfc.o irdgrd.o irdswm.o isvgrd.o roots.o srdgrd.o srdswm.o ssvgrd.o
OBJP90 = trigrs_p.o partial_p.o flux.o flux_p.o prpijz.o svxmdv.o svijz.o dzero_brac.o srdgrd_p.o irdgrd_p.o
OBJP95 = modules_p.o grids.o input_vars.o model_vars.o dsimps.o input_file_defs.o iverson.o pstpi.o pstpi_p.o satfin.o satfin_p.o savage.o steady.o trini.o trini_p.o unsinf.o unsinf_p.o ivestp.o ivestp_p.o pstpf.o pstpf_p.o rnoff.o satinf.o satinf_p.o smallt.o svgstp.o svgstp_p.o unsfin.o unsfin_p.o unsth.o unsth_p.o ssizgrd.o ssizgrd_p.o svlist.o rnoff_p.o steady_p.o
OBJP77 = calerf.o dbsct.o derfc.o irdgrd.o irdswm.o irdswm_p.o isvgrd.o roots.o srdgrd.o srdswm.o srdswm_p.o ssvgrd.o
OBJX90 = tpindx.o nxtcel.o
OBJX95 = ssizgrd.o
OBJX77 = isvgrd.o mpfldr.o rdflodir.o sindex.o slofac.o srdgrd1.o
LIBS =
CC = gcc -O3
CCFLAGS = -lgsl -lgslcblas -lm
FC = ftn95 -w -O3
FFLAGS =
F90 = f95 -w -O3
MPIF90 = mpif90 -w -O3
F90FLAGS = -w -O3
LDFLAGS = -w -O3
all: $(TRG) $(PRG)
#-----------------------------------------------------------------
$(TRG): $(OBJT95) $(OBJT90) $(OBJT77)
$(F90) $(CCLIBS) $(LDFLAGS) -o $# $(OBJT95) $(OBJT90) $(OBJT77) $(CCFLAGS) $(LIBS)
$(PRG): $(OBJP95) $(OBJP90) $(OBJP77)
$(MPIF90) $(CCLIBS) $(LDFLAGS) -o $# $(OBJP95) $(OBJP90) $(OBJP77)
$(CCFLAGS) $(LIBS)
$(TPX): $(OBJX95) $(OBJX90) $(OBJX77)
$(F90) $(CCLIBS) $(LDFLAGS) -o $# $(OBJX95) $(OBJX90) $(OBJX77) $(CCFLAGS) $(LIBS)
#-----------------------------------------------------------------
clean:
rm -f $(TRG) $(TPX) $(PRG)
rm -rf $(OBJT95) $(OBJT90) $(OBJT77) $(OBJP95) $(OBJP90) $(OBJP77)
rm -rf $(OBJX95) $(OBJX90) $(OBJX77)
rm -rf *.mod *.exe *.stackdump
.SUFFIXES: $(SUFFIXES) .f90 .f .c .f95
.f90.o:
$(MPIF90) $(F90FLAGS) -c $<
.f.o:
$(MPIF90) $(F90FLAGS) -c $<
.c.o:
$(CC) $(CCINCLUDE) -c -w $<
.f95.o:
$(MPIF90) $(F90FLAGS) -c $<
What changes need to be made for the code to compile?

make error : *** missing separator. Stop

This is my makefile:
OBJECTS = main.o
CFLAGS = -g -wall
NAME = make
CC = gcc
build: $(OBJECTS)
$(CC) $(CFLAGS) $(OBJECTS) -o $(NAME)
I'm getting below error when I tried to make(Applied tab before gcc command) :
makefile:6: *** missing separator. Stop.
How can I fix this?
First of all, it looks like you have spaces instead of tab.
As for the Makefile itself, I'd make it little bit simpler. For a source file main.c:
int main() {
return 0;
}
I would go with Makefile:
CFLAGS = -g -wall
CC = gcc
main: main.c
$(CC) $(CFLAGS) $< -o $#

Resources