How to write a makeFile to install primme and slepc?

38 views Asked by At

I want to execute multiple files and two libraries (primme and slepc) using my makeFile. My makeFile looks like :

# Compiler
CC = gcc

# Directories
SLEPC_DIR = /home/student/Documents/projet/codeProjet17SLEPc/CodePub/slepc-3.20.1
PRIMME_DIR = /home/student/Documents/projet/codeProjet17SLEPc/CodePub/primme

# SLEPc settings
include ${SLEPC_DIR}/lib/slepc/conf/slepc_common
SLEPC_INC = -I${SLEPC_DIR}/include

# PRIMME settings
PRIMME_LIB = -L${PRIMME_DIR} -lprimme
PRIMME_INC = -I${PRIMME_DIR}/PRIMMESRC/COMMONSRC

# Compiler flags
CFLAGS = -g -Wall $(SLEPC_CCFLAGS)

# Linker flags
LDFLAGS = $(SLEPC_EPS_LIB) -lm -lblas -llapack

# Targets
TARGET = executable
SOURCES = main.c prob.c time.c interface_primme.c graph.c res.c temp.c diff.c # Add your source files here
OBJECTS = $(SOURCES:.c=.o)

# Build rules
all: $(TARGET)

$(TARGET): $(OBJECTS)
    $(CC) $(CFLAGS) $^ -o $@ $(PRIMME_LIB) $(LDFLAGS)

%.o: %.c
    $(CC) $(CFLAGS) -c $< -o $@ $(SLEPC_INC) $(PRIMME_INC)

clean:
    rm -f $(OBJECTS) $(TARGET)

I followed the documentation of slepc. The documentation ask to write a makeFile of the form :

default: ex1
include ${SLEPC_DIR}/lib/slepc/conf/slepc_common
ex1: ex1.o
    -${CLINKER} -o ex1 ex1.o ${SLEPC_EPS_LIB}
     ${RM} ex1.o

However, I still encounter the same problem constantly : I get the error " Makefile:36: *** target file 'clean' has both : and :: entries. Stop. " I do not know how to overcome this problem ...

I tried to execute my program without using the splec_common (this file points to multiple others and I feel like it may give some clean information which cause the problem). Nonetheless, then using the library become difficult.... I do not have a lot of experience in makeFile writing, so if any body could help my with that I would be grateful

0

There are 0 answers