Skip to content
Snippets Groups Projects
Commit d14d7d91 authored by Tomáš Oberhuber's avatar Tomáš Oberhuber Committed by Tomáš Oberhuber
Browse files

Makefiles added to build tutorial.

parent 483c1764
No related branches found
No related tags found
1 merge request!44Tutorials
No preview for this file type
include Makefile.inc
FILES = Makefile \
Makefile.inc \
$(SOURCES) \
$(HEADERS)
SUBDIRS =
SUBDIRSCLEAN=$(addsuffix clean,$(SUBDIRS))
all: bin subdirs
.PHONY: subdirs $(SUBDIRS)
subdirs: $(SUBDIRS)
$(SUBDIRS):
$(MAKE) -C $@
bin:
mkdir -p bin
install: all
mkdir -p $(INSTALL_DIR)/bin
cp bin/* $(INSTALL_DIR)/bin
.PHONY: clean
clean: $(SUBDIRSCLEAN) clean_curdir
clean_curdir:
rm -f *.o
%clean: %
$(MAKE) -C $< clean
dist: clean
tar zcvf fjfi-num1-src.tgz $(SUBDIRS) $(FILES)
$(TARGETS): % : %.o
$(CXX) $(LDFLAGS) -o $@ $< $(LDLIBS)
$(CUDA_TARGETS): % : %.cu.o
$(CXX) $(CUDA_LDFLAGS) -o $@ $< $(CUDA_LDLIBS)
$(SOURCES:%.cpp=%.o): %.o: %.cpp
$(CXX) $(CPPFLAGS) $(CXXFLAGS) -c -o $@ $<
$(CUDA_SOURCES:%.cu=%.cu.o): %.cu.o : %.cu
$(CUDA_COMPILER) $(CUDA_CPPFLAGS) $(CUDA_CXXFLAGS) -c -o $@ $<
\ No newline at end of file
# Replace the following with your TNL installation path
TNL_HEADERS = ${HOME}/.local/include/tnl
INSTALL_DIR = ${HOME}/.local
WITH_CUDA = yes
WITH_OPENMP = yes
WITH_DEBUG = no
CXX = g++
CUDA_CXX = nvcc
#CXXFLAGS = -DNDEBUG -O3 -funroll-loops -g -std=c++11 -Dlinux
CXXFLAGS = -DNDEBUG -O0 -g -Dlinux -std=c++11 -fPIC
CPPFLAGS = -MD -MP
LDFLAGS += -lm #-lgomp
...@@ -92,6 +92,10 @@ Thus you have one code which you may easily compile with or without CUDA dependi ...@@ -92,6 +92,10 @@ Thus you have one code which you may easily compile with or without CUDA dependi
## Build with Makefile <a name="makefile"></a> ## Build with Makefile <a name="makefile"></a>
Larger projects needs to be managed by Makefile tool. In this section we propose a Makefile template which might help you to create more complex applications with TNL. The basic setup is stored in `Makefile.inc` file:
\include Makefile.inc
## Build with Cmake <a name="cmake"></a> ## Build with Cmake <a name="cmake"></a>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment