Add c++ examples
This commit is contained in:
parent
06924c0e47
commit
3a38f68c69
@ -4,7 +4,7 @@ PROJECT_DIR := $(realpath $(CUR_DIR)/../)
|
|||||||
# Dependencies: need to be compiled but not to run by any Makefile target
|
# Dependencies: need to be compiled but not to run by any Makefile target
|
||||||
TEST_DEPS := dev_null
|
TEST_DEPS := dev_null
|
||||||
# Tests: need to be compiled and run by test-% target
|
# Tests: need to be compiled and run by test-% target
|
||||||
TESTS := empty argv hello_world malloc file getpid spawn pipe time truncate readdir mkdir link tls pthread uname rlimit client server server_epoll unix_socket
|
TESTS := empty argv hello_world malloc file getpid spawn pipe time truncate readdir mkdir link tls pthread uname rlimit client server server_epoll unix_socket cout
|
||||||
# Benchmarks: need to be compiled and run by bench-% target
|
# Benchmarks: need to be compiled and run by bench-% target
|
||||||
BENCHES := spawn_and_exit_latency pipe_throughput unix_socket_throughput
|
BENCHES := spawn_and_exit_latency pipe_throughput unix_socket_throughput
|
||||||
|
|
||||||
|
5
test/cout/Makefile
Normal file
5
test/cout/Makefile
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
include ../test_common.mk
|
||||||
|
|
||||||
|
EXTRA_C_FLAGS :=
|
||||||
|
EXTRA_LINK_FLAGS :=
|
||||||
|
BIN_ARGS :=
|
5
test/cout/main.cc
Normal file
5
test/cout/main.cc
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
#include <iostream>
|
||||||
|
int main(){
|
||||||
|
std::cout<< "hello world" <<std::endl;
|
||||||
|
return 0;
|
||||||
|
}
|
@ -4,9 +4,11 @@ CUR_DIR := $(shell dirname $(realpath $(MAIN_MAKEFILE)))
|
|||||||
PROJECT_DIR := $(realpath $(CUR_DIR)/../../)
|
PROJECT_DIR := $(realpath $(CUR_DIR)/../../)
|
||||||
|
|
||||||
CC := /usr/local/occlum/bin/musl-clang
|
CC := /usr/local/occlum/bin/musl-clang
|
||||||
|
CXX := /usr/local/occlum/bin/musl-clang++
|
||||||
C_SRCS := $(wildcard *.c)
|
C_SRCS := $(wildcard *.c)
|
||||||
S_FILES := $(C_SRCS:%.c=%.S)
|
CXX_SRCS := $(wildcard *.cc)
|
||||||
C_OBJS := $(C_SRCS:%.c=%.o)
|
C_OBJS := $(C_SRCS:%.c=%.o)
|
||||||
|
CXX_OBJS := $(CXX_SRCS:%.cc=%.o)
|
||||||
FS_PATH := ../fs
|
FS_PATH := ../fs
|
||||||
BIN_NAME := $(shell basename $(CUR_DIR))
|
BIN_NAME := $(shell basename $(CUR_DIR))
|
||||||
BIN_FS_PATH := $(BIN_NAME)
|
BIN_FS_PATH := $(BIN_NAME)
|
||||||
@ -44,14 +46,18 @@ $(READELF_FILE): $(BIN_NAME)
|
|||||||
@readelf -a -d $(BIN_NAME) > $(READELF_FILE)
|
@readelf -a -d $(BIN_NAME) > $(READELF_FILE)
|
||||||
@echo "READELF => $@"
|
@echo "READELF => $@"
|
||||||
|
|
||||||
$(BIN_NAME): $(C_OBJS)
|
$(BIN_NAME): $(C_OBJS) $(CXX_OBJS)
|
||||||
@$(CC) $^ $(LINK_FLAGS) -o $(BIN_NAME)
|
@$(CXX) $^ $(LINK_FLAGS) -o $(BIN_NAME)
|
||||||
@echo "LINK => $@"
|
@echo "LINK => $@"
|
||||||
|
|
||||||
$(C_OBJS): %.o: %.c
|
$(C_OBJS): %.o: %.c
|
||||||
@$(CC) $(C_FLAGS) -c $< -o $@
|
@$(CC) $(C_FLAGS) -c $< -o $@
|
||||||
@echo "CC <= $@"
|
@echo "CC <= $@"
|
||||||
|
|
||||||
|
$(CXX_OBJS): %.o: %.cc
|
||||||
|
@$(CXX) $(C_FLAGS) -c $< -o $@
|
||||||
|
@echo "CXX <= $@"
|
||||||
|
|
||||||
#############################################################################
|
#############################################################################
|
||||||
# Test
|
# Test
|
||||||
#############################################################################
|
#############################################################################
|
||||||
|
Loading…
Reference in New Issue
Block a user