# HG changeset patch # User kono # Date 1551521188 -32400 # Node ID 997c54d8912caa1ec2dad87a85151950b3e6c607 # Parent 087d7b61c86b1ddfc27eaf22b3c6a35570cc69bb fix include dir diff -r 087d7b61c86b -r 997c54d8912c src/CMakeLists.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/CMakeLists.txt Sat Mar 02 19:06:28 2019 +0900 @@ -0,0 +1,76 @@ +cmake_minimum_required(VERSION 3.8) + +set(USE_CUDA,0) +# -DUSE_CUDA +# add_definitions("-Wall -g -O") + +set(CMAKE_C_COMPILER $ENV{CBC_COMPILER}) +add_definitions("-Wall -g") + +# -DCMAKE_BUILD_TYPE=Debug +set(CMAKE_C_FLAGS_DEBUG "-O0") + +if (${USE_CUDA}) + include_directories("/usr/local/cuda/include") + set(NVCCFLAG "-std=c++11" "-g" "-O0" ) + if (UNIX AND NOT APPLE) # LINUX + set(CUDA_LINK_FLAGS "-L/usr/local/cuda/lib64 -lcuda -lcudart") + elseif (APPLE) + set(CUDA_LINK_FLAGS "-framework CUDA -lc++ -Wl,-search_paths_first -Wl,-headerpad_max_install_names /usr/local/cuda/lib/libcudart_static.a -Wl,-rpath,/usr/local/cuda/lib") + endif() + find_package(CUDA REQUIRED) + SET( CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${CUDA_LINK_FLAGS}" ) +endif() + +include_directories(".") + +macro( GearsCommand ) + set( _OPTIONS_ARGS ) + set( _ONE_VALUE_ARGS TARGET ) + set( _MULTI_VALUE_ARGS SOURCES ) + cmake_parse_arguments( _Gears "${_OPTIONS_ARGS}" "${_ONE_VALUE_ARGS}" "${_MULTI_VALUE_ARGS}" ${ARGN} ) + + set (_Gears_CSOURCES) + foreach(i ${_Gears_SOURCES}) + if (${i} MATCHES "\\.cbc") + string(REGEX REPLACE "(.*).cbc" "c/\\1.c" j ${i}) + add_custom_command ( + OUTPUT ${j} + DEPENDS ${i} + COMMAND "perl" "gearsTools/generate_stub.pl" "-o" ${j} ${i} + ) + list(APPEND _Gears_CSOURCES ${j}) + elseif (${i} MATCHES "\\.cu") + string(REGEX REPLACE "(.*).cu" "c/\\1.ptx" j ${i}) + add_custom_command ( + OUTPUT ${j} + DEPENDS ${i} + COMMAND nvcc ${NVCCFLAG} -c -ptx -o ${j} ${i} + ) + list(APPEND _Gears_CSOURCES ${j}) + else() + set(j ${i}) + endif() + endforeach(i) + + add_custom_command ( + OUTPUT c/${_Gears_TARGET}-context.c + DEPENDS ${_Gears_CSOURCES} + COMMAND "perl" "gearsTools/generate_context.pl" "-o" ${_Gears_TARGET} ${_Gears_CSOURCES} + ) + add_executable(${_Gears_TARGET} ${_Gears_CSOURCES} c/${_Gears_TARGET}-context.c) + target_link_libraries(${_Gears_TARGET} m pthread) +endmacro() + + +GearsCommand( + TARGET + kernel + SOURCES + lib/string.c arm.c asm.S bio.c buddy.c console.cbc exec.c file.c fs.c log.c main.c memide.c pipe.c proc.c spinlock.c + start.c swtch.S syscall.c sysfile.c sysproc.c trap_asm.S trap.c vm.c device/picirq.c device/timer.c device/uart.c + entry-osx.S +) + + + diff -r 087d7b61c86b -r 997c54d8912c src/Makefile --- a/src/Makefile Sat Mar 02 19:01:03 2019 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,178 +0,0 @@ -# CMAKE generated file: DO NOT EDIT! -# Generated by "Unix Makefiles" Generator, CMake Version 3.13 - -# Default target executed when no arguments are given to make. -default_target: all - -.PHONY : default_target - -# Allow only one "make -f Makefile2" at a time, but pass parallelism. -.NOTPARALLEL: - - -#============================================================================= -# Special targets provided by cmake. - -# Disable implicit rules so canonical targets will work. -.SUFFIXES: - - -# Remove some rules from gmake that .SUFFIXES does not remove. -SUFFIXES = - -.SUFFIXES: .hpux_make_needs_suffix_list - - -# Suppress display of executed commands. -$(VERBOSE).SILENT: - - -# A target that is always out of date. -cmake_force: - -.PHONY : cmake_force - -#============================================================================= -# Set environment variables for the build. - -# The shell in which to execute make rules. -SHELL = /bin/sh - -# The CMake executable. -CMAKE_COMMAND = /usr/local/Cellar/cmake/3.13.4/bin/cmake - -# The command to remove a file. -RM = /usr/local/Cellar/cmake/3.13.4/bin/cmake -E remove -f - -# Escaping for special characters. -EQUALS = = - -# The top-level source directory on which CMake was run. -CMAKE_SOURCE_DIR = /Users/one/src/xv6-gears/src - -# The top-level build directory on which CMake was run. -CMAKE_BINARY_DIR = /Users/one/src/xv6-gears/src - -#============================================================================= -# Targets provided globally by CMake. - -# Special rule for the target rebuild_cache -rebuild_cache: - @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Running CMake to regenerate build system..." - /usr/local/Cellar/cmake/3.13.4/bin/cmake -S$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) -.PHONY : rebuild_cache - -# Special rule for the target rebuild_cache -rebuild_cache/fast: rebuild_cache - -.PHONY : rebuild_cache/fast - -# Special rule for the target edit_cache -edit_cache: - @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Running CMake cache editor..." - /usr/local/Cellar/cmake/3.13.4/bin/ccmake -S$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) -.PHONY : edit_cache - -# Special rule for the target edit_cache -edit_cache/fast: edit_cache - -.PHONY : edit_cache/fast - -# The main all target -all: cmake_check_build_system - $(CMAKE_COMMAND) -E cmake_progress_start /Users/one/src/xv6-gears/src/CMakeFiles /Users/one/src/xv6-gears/src/CMakeFiles/progress.marks - $(MAKE) -f CMakeFiles/Makefile2 all - $(CMAKE_COMMAND) -E cmake_progress_start /Users/one/src/xv6-gears/src/CMakeFiles 0 -.PHONY : all - -# The main clean target -clean: - $(MAKE) -f CMakeFiles/Makefile2 clean -.PHONY : clean - -# The main clean target -clean/fast: clean - -.PHONY : clean/fast - -# Prepare targets for installation. -preinstall: all - $(MAKE) -f CMakeFiles/Makefile2 preinstall -.PHONY : preinstall - -# Prepare targets for installation. -preinstall/fast: - $(MAKE) -f CMakeFiles/Makefile2 preinstall -.PHONY : preinstall/fast - -# clear depends -depend: - $(CMAKE_COMMAND) -S$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) --check-build-system CMakeFiles/Makefile.cmake 1 -.PHONY : depend - -#============================================================================= -# Target rules for targets named kernel - -# Build rule for target. -kernel: cmake_check_build_system - $(MAKE) -f CMakeFiles/Makefile2 kernel -.PHONY : kernel - -# fast build rule for target. -kernel/fast: - $(MAKE) -f CMakeFiles/kernel.dir/build.make CMakeFiles/kernel.dir/build -.PHONY : kernel/fast - -c/kernel-context.o: c/kernel-context.c.o - -.PHONY : c/kernel-context.o - -# target to build an object file -c/kernel-context.c.o: - $(MAKE) -f CMakeFiles/kernel.dir/build.make CMakeFiles/kernel.dir/c/kernel-context.c.o -.PHONY : c/kernel-context.c.o - -c/kernel-context.i: c/kernel-context.c.i - -.PHONY : c/kernel-context.i - -# target to preprocess a source file -c/kernel-context.c.i: - $(MAKE) -f CMakeFiles/kernel.dir/build.make CMakeFiles/kernel.dir/c/kernel-context.c.i -.PHONY : c/kernel-context.c.i - -c/kernel-context.s: c/kernel-context.c.s - -.PHONY : c/kernel-context.s - -# target to generate assembly for a file -c/kernel-context.c.s: - $(MAKE) -f CMakeFiles/kernel.dir/build.make CMakeFiles/kernel.dir/c/kernel-context.c.s -.PHONY : c/kernel-context.c.s - -# Help Target -help: - @echo "The following are some of the valid targets for this Makefile:" - @echo "... all (the default if no target is provided)" - @echo "... clean" - @echo "... depend" - @echo "... rebuild_cache" - @echo "... edit_cache" - @echo "... kernel" - @echo "... c/kernel-context.o" - @echo "... c/kernel-context.i" - @echo "... c/kernel-context.s" -.PHONY : help - - - -#============================================================================= -# Special targets to cleanup operation of make. - -# Special rule to run CMake to check the build system integrity. -# No rule that depends on this can have commands that come from listfiles -# because they might be regenerated. -cmake_check_build_system: - $(CMAKE_COMMAND) -S$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) --check-build-system CMakeFiles/Makefile.cmake 0 -.PHONY : cmake_check_build_system -