47 lines
1.8 KiB
Makefile
47 lines
1.8 KiB
Makefile
|
CC = cc # C compiler
|
||
|
# cc and gcc is the same
|
||
|
CXX = c++ # C++ compiler
|
||
|
# c++
|
||
|
# g++
|
||
|
# clang++
|
||
|
CPPFLAGS = # preprocessor flags
|
||
|
CFLAGS = -Wall -Wfloat-equal -std=c99 -O0 -mtune=native -funroll-loops $(OPT) # C compiler flags
|
||
|
# -Wall: Warnings all
|
||
|
# -Wfloat-equal: Warn if comparing floats with ==
|
||
|
# -OX: Optimization level -O0 (none, default), -O1, -O2, -O3 (most, may increase file size), -Os (decrease file size), -ffast-math
|
||
|
# -mtune: Tune for specific/generic CPU
|
||
|
# -funrool-loops: Unroll loops when compiling
|
||
|
# -fopenmp: Enable OpenMP (When running, set the environmental variable OMP_NUM_THREADS)
|
||
|
# $(OPT): Passes any parameter given when calling make with 'make OPT=...'
|
||
|
CXXFLAGS = -Wall -std=c++20 -O0 # C++ compiler flags
|
||
|
LDFLAGS = # linker flags
|
||
|
LDLIBS = # library flags
|
||
|
# -lm (for <math.h>)
|
||
|
# -lblas (BASIC LINEAR ALGEBRA SUBPROGRAMS)
|
||
|
# -lcblas (for <cblas.h>)
|
||
|
# -lopenblas (NOT INSTALLED; blas and cblas in one; conflicts with blas and cblas)
|
||
|
# -llapack (LAPACKE)
|
||
|
# -llapacke (LAPACK) NOTE: The order of "-llapacke -llapack -lblas" is very important
|
||
|
#LINK.o = $(CXX) $(LDFLAGS) # use CXX for linking
|
||
|
|
||
|
simple_string_matching: simple_string_matching.o Rabin_fingerprint.o general_library.o
|
||
|
$(CXX) $(CXXFLAGS) simple_string_matching.o Rabin_fingerprint.o general_library.o -o simple_string_matching
|
||
|
|
||
|
simple_string_matching.o: simple_string_matching.cpp
|
||
|
$(CXX) $(CXXFLAGS) -c simple_string_matching.cpp
|
||
|
|
||
|
Rabin_fingerprint.o: Rabin_fingerprint.cpp Rabin_fingerprint.hpp
|
||
|
$(CXX) $(CXXFLAGS) -c Rabin_fingerprint.cpp
|
||
|
|
||
|
general_library.o: general_library.cpp general_library.hpp
|
||
|
$(CXX) $(CXXFLAGS) -c general_library.cpp
|
||
|
|
||
|
|
||
|
# Tell the compiler that 'clean' isn't referring to a file
|
||
|
.PHONY: clean
|
||
|
|
||
|
# A make target that cleans (by deleting files)
|
||
|
clean:
|
||
|
$(RM) simple_string_matching
|
||
|
$(RM) *.o
|