c++ userland example

This commit is contained in:
Ciro Santilli
2018-05-08 15:04:41 +01:00
parent 237b7603b7
commit 9f876f7897
3 changed files with 13 additions and 3 deletions

View File

@@ -1,11 +1,12 @@
.PHONY: all clean
CFLAGS_EXTRA ?= -fopenmp -std=c99 -Wall -Werror -Wextra
IN_EXT ?= .c
IN_EXT_C ?= .c
IN_EXT_CXX ?= .cpp
LIBS :=
OUT_EXT ?= .out
OUTS := $(addsuffix $(OUT_EXT), $(basename $(wildcard *$(IN_EXT))))
OUTS := $(foreach IN_EXT,$(IN_EXT_C) $(IN_EXT_CXX),$(addsuffix $(OUT_EXT), $(basename $(wildcard *$(IN_EXT)))))
ifeq ($(BR2_PACKAGE_OPENBLAS),y)
LIBS += -lopenblas
else
@@ -14,8 +15,11 @@ endif
all: $(OUTS)
%$(OUT_EXT): %$(IN_EXT)
%$(OUT_EXT): %$(IN_EXT_C)
$(CC) $(CFLAGS) $(CFLAGS_EXTRA) -o '$@' '$<' $(LIBS)
%$(OUT_EXT): %$(IN_EXT_CXX)
$(CXX) $(CXXFLAGS) $(CXXFLAGS_EXTRA) -o '$@' '$<' $(LIBS)
clean:
rm -f *'$(OUT_EXT)'

View File

@@ -10,6 +10,7 @@ These programs can also be compiled and used on host.
. Standalone
.. link:hello.c[]
.. link:hello_cpp.cpp[]
.. link:myinsmod.c[]
.. link:myrmmod.c[]
.. link:sched_getaffinity.c[]

View File

@@ -0,0 +1,5 @@
#include <iostream>
int main() {
std::cout << "hello world" << std::endl;
}