- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
hi:
In my project, I intend to provide users with a generic Makefile to compile files for them.
Therefore, I refer to some examples of makefiles provided by Intel official website and makefiles generated in eclipse after integrating dpc++ compiler in eclipse. I find that the same example program compiles slightly different commands. I would like to ask the difference between them and which one is more generic?
eclipse vector-add Makefile:
all: main.o
dpcpp -L${DPCPP_CMPLR_ROOT}/lib -o main main.o -lsycl -lOpenCL
main.o: main.cpp
DPCPP -c -i ${DPCPP_CMPLR_ROOT}/include -i ${DPCPP_CMPLR_ROOT}/lib/clang/9.0.0/include -o main.o main.cpp
Intel's official website vector-add Makefile:
CXX = dpcpp
CXXFLAGS = -O2 -g -std=c++17
BUFFER_EXE_NAME = vector-add-buffers
BUFFER_SOURCES = src/vector-add-buffers.cpp
USM_EXE_NAME = vector-add-usm
USM_SOURCES = src/vector-add-usm.cpp
all: build_buffers
build_buffers:
$(CXX) $(CXXFLAGS) -o $(BUFFER_EXE_NAME) $(BUFFER_SOURCES)
build_usm:
$(CXX) $(CXXFLAGS) -o $(USM_EXE_NAME) $(USM_SOURCES)
run:
./$(BUFFER_EXE_NAME)
run_usm:
./$(USM_EXE_NAME)
clean:
rm -f $(BUFFER_EXE_NAME) $(USM_EXE_NAME)
thanks
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
Thanks for reaching out to us.
Both the eclipse-provided makefile as well as the Intel makefile are supported and you can use any of them to generate the output.
>>I find that the same example program compiles slightly different commands.
Yes, even the output for both the makefiles you are specifying is the same but there is a difference in writing the makefile.
>>I would like to ask the difference between them and which one is more generic?
In this Intel's vector-add makefile there is -O2 flag which optimizes the code.
It is a readable and standard form of writing the Makefile. Here, you can specify the compiler, compilation flags and we can also modify the compiler as well as the compilation options at the run time.
In this makefile, we will specify the path of the source file, executable and later we can use it for other codes by just changing the filename. And also, the steps to make the makefile are very easy. So, this is a more generic way to use the makefile.
Thanks & Regards,
Varsha
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi:
Thanks for your answer, I understand.
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
Glad to know that your issue is resolved. If you need any additional information, please post a new question as this thread will no longer be monitored by Intel.
Thanks & Regards,
Varsha
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page