changeset 59:8f435de13b91

fix cmakefiles
author tobaru
date Fri, 05 Jul 2019 17:06:31 +0900
parents f1b965f53d3b
children e5f099108a6e
files src/CMakeLists.txt src/tools/CMakeLists.txt src/tools/Makefile src/usr/CMakeLists.txt src/usr/Makefile
diffstat 5 files changed, 426 insertions(+), 55 deletions(-) [+]
line wrap: on
line diff
--- a/src/CMakeLists.txt	Fri Jul 05 16:39:01 2019 +0900
+++ b/src/CMakeLists.txt	Fri Jul 05 17:06:31 2019 +0900
@@ -1,5 +1,6 @@
 cmake_minimum_required(VERSION 3.8)
 project(xv6cbc C ASM)
+add_subdirectory(tools)
 
 
 set(USE_CUDA,0)
@@ -15,7 +16,6 @@
 #                   COMMAND "cd ${CMAKE_CURRENT_SOURCE_DIR}/tools && make run"
 #)
 #                   #WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/tools
-add_subdirectory(tools)
 add_subdirectory(usr)
 
 
--- a/src/tools/CMakeLists.txt	Fri Jul 05 16:39:01 2019 +0900
+++ b/src/tools/CMakeLists.txt	Fri Jul 05 17:06:31 2019 +0900
@@ -1,5 +1,6 @@
 cmake_minimum_required(VERSION 3.8)
 project(tools C)
+SET(CMAKE_C_COMPILER /usr/bin/cc)
 
 set(CMAKE_C_FLAGS "-Wall  -iquote ../")
-add_executable(TARGET mkfs SOURCE mkfs.c)
+add_executable(mkfs mkfs.c)
--- a/src/tools/Makefile	Fri Jul 05 16:39:01 2019 +0900
+++ b/src/tools/Makefile	Fri Jul 05 17:06:31 2019 +0900
@@ -1,12 +1,180 @@
-include ../makefile.inc
+# 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/bin/cmake3
 
-CFLAGS = -Wall
-CFLAGS += -iquote ../
+# The command to remove a file.
+RM = /usr/bin/cmake3 -E remove -f
+
+# Escaping for special characters.
+EQUALS = =
+
+# The top-level source directory on which CMake was run.
+CMAKE_SOURCE_DIR = /mnt/dalmore-home/one/src/cbcxv6/src
+
+# The top-level build directory on which CMake was run.
+CMAKE_BINARY_DIR = /mnt/dalmore-home/one/src/cbcxv6/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/bin/cmake3 -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/bin/ccmake3 -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
+	cd /mnt/dalmore-home/one/src/cbcxv6/src && $(CMAKE_COMMAND) -E cmake_progress_start /mnt/dalmore-home/one/src/cbcxv6/src/CMakeFiles /mnt/dalmore-home/one/src/cbcxv6/src/tools/CMakeFiles/progress.marks
+	cd /mnt/dalmore-home/one/src/cbcxv6/src && $(MAKE) -f CMakeFiles/Makefile2 tools/all
+	$(CMAKE_COMMAND) -E cmake_progress_start /mnt/dalmore-home/one/src/cbcxv6/src/CMakeFiles 0
+.PHONY : all
 
-all: mkfs
+# The main clean target
+clean:
+	cd /mnt/dalmore-home/one/src/cbcxv6/src && $(MAKE) -f CMakeFiles/Makefile2 tools/clean
+.PHONY : clean
+
+# The main clean target
+clean/fast: clean
+
+.PHONY : clean/fast
+
+# Prepare targets for installation.
+preinstall: all
+	cd /mnt/dalmore-home/one/src/cbcxv6/src && $(MAKE) -f CMakeFiles/Makefile2 tools/preinstall
+.PHONY : preinstall
+
+# Prepare targets for installation.
+preinstall/fast:
+	cd /mnt/dalmore-home/one/src/cbcxv6/src && $(MAKE) -f CMakeFiles/Makefile2 tools/preinstall
+.PHONY : preinstall/fast
+
+# clear depends
+depend:
+	cd /mnt/dalmore-home/one/src/cbcxv6/src && $(CMAKE_COMMAND) -S$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) --check-build-system CMakeFiles/Makefile.cmake 1
+.PHONY : depend
+
+# Convenience name for target.
+tools/CMakeFiles/mkfs.dir/rule:
+	cd /mnt/dalmore-home/one/src/cbcxv6/src && $(MAKE) -f CMakeFiles/Makefile2 tools/CMakeFiles/mkfs.dir/rule
+.PHONY : tools/CMakeFiles/mkfs.dir/rule
+
+# Convenience name for target.
+mkfs: tools/CMakeFiles/mkfs.dir/rule
+
+.PHONY : mkfs
+
+# fast build rule for target.
+mkfs/fast:
+	cd /mnt/dalmore-home/one/src/cbcxv6/src && $(MAKE) -f tools/CMakeFiles/mkfs.dir/build.make tools/CMakeFiles/mkfs.dir/build
+.PHONY : mkfs/fast
+
+mkfs.o: mkfs.c.o
+
+.PHONY : mkfs.o
 
-mkfs: mkfs.c
-	$(HOSTCC) $(CFLAGS) -o $@ $^
+# target to build an object file
+mkfs.c.o:
+	cd /mnt/dalmore-home/one/src/cbcxv6/src && $(MAKE) -f tools/CMakeFiles/mkfs.dir/build.make tools/CMakeFiles/mkfs.dir/mkfs.c.o
+.PHONY : mkfs.c.o
+
+mkfs.i: mkfs.c.i
+
+.PHONY : mkfs.i
+
+# target to preprocess a source file
+mkfs.c.i:
+	cd /mnt/dalmore-home/one/src/cbcxv6/src && $(MAKE) -f tools/CMakeFiles/mkfs.dir/build.make tools/CMakeFiles/mkfs.dir/mkfs.c.i
+.PHONY : mkfs.c.i
+
+mkfs.s: mkfs.c.s
+
+.PHONY : mkfs.s
+
+# target to generate assembly for a file
+mkfs.c.s:
+	cd /mnt/dalmore-home/one/src/cbcxv6/src && $(MAKE) -f tools/CMakeFiles/mkfs.dir/build.make tools/CMakeFiles/mkfs.dir/mkfs.c.s
+.PHONY : mkfs.c.s
 
-clean:
-	rm -f mkfs	
+# 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 "... mkfs"
+	@echo "... mkfs.o"
+	@echo "... mkfs.i"
+	@echo "... mkfs.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:
+	cd /mnt/dalmore-home/one/src/cbcxv6/src && $(CMAKE_COMMAND) -S$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) --check-build-system CMakeFiles/Makefile.cmake 0
+.PHONY : cmake_check_build_system
+
--- a/src/usr/CMakeLists.txt	Fri Jul 05 16:39:01 2019 +0900
+++ b/src/usr/CMakeLists.txt	Fri Jul 05 17:06:31 2019 +0900
@@ -1,4 +1,5 @@
 cmake_minimum_required(VERSION 3.8)
+set(CMAKE_C_COMPILER "/usr/bin/cc")
 project(usr C ASM)
 
 
@@ -48,13 +49,13 @@
     target_link_libraries(${_Gears_TARGET} ulib)
 endmacro()
 
-add_library(ulib STATIC  ulib.c usys.c printf.c umalloc.c)
+add_library(ulib STATIC  ulib.c usys.S printf.c umalloc.c)
 
-set(USR_COMMANDS _cat _echo _grep _init _kill _ln _ls _mkdir _rm _sh _stressfs _usertests _wc _zombie _hello)
+set(USRCOMMANDS cat echo grep init kill ln ls mkdir rm sh stressfs usertests wc zombie hello)
 
-foreach(cmd ${USR_COMMANDS) 
-    GearsCommand (TARGET ${cmd} SOURCES ${cmd}.c) 
-end foreach(cmd)
+foreach(cmd ${USR_COMMANDS}) 
+    GearsCommand (TARGET _${cmd} SOURCES ${cmd}.c) 
+endforeach(cmd)
 
 add_custom_command(OUTPUT fs.img
   COMMAND ./mkfs fs.img ${USR_COMMAND} UNIX
--- a/src/usr/Makefile	Fri Jul 05 16:39:01 2019 +0900
+++ b/src/usr/Makefile	Fri Jul 05 17:06:31 2019 +0900
@@ -1,49 +1,250 @@
-include ../makefile.inc
+# 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
 
-CFLAGS += -iquote ../
-ASFLAGS += -I ../
-ULIB = ulib.o usys.o printf.o umalloc.o
+.PHONY : default_target
 
-MKFS = ../tools/mkfs
-FS_IMAGE = ../build/fs.img
+# Allow only one "make -f Makefile2" at a time, but pass parallelism.
+.NOTPARALLEL:
+
 
-UPROGS=\
-	_cat\
-	_echo\
-	_grep\
-	_init\
-	_kill\
-	_ln\
-	_ls\
-	_mkdir\
-	_rm\
-	_sh\
-	_stressfs\
-	_usertests\
-	_wc\
-	_zombie\
-	_hello\
-	_forktest\
+#=============================================================================
+# 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:
 
 
-all: $(FS_IMAGE)
+# 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/bin/cmake3
+
+# The command to remove a file.
+RM = /usr/bin/cmake3 -E remove -f
+
+# Escaping for special characters.
+EQUALS = =
+
+# The top-level source directory on which CMake was run.
+CMAKE_SOURCE_DIR = /mnt/dalmore-home/one/src/cbcxv6/src
+
+# The top-level build directory on which CMake was run.
+CMAKE_BINARY_DIR = /mnt/dalmore-home/one/src/cbcxv6/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/bin/cmake3 -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/bin/ccmake3 -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
 
-_%: %.o $(ULIB)
-	$(LD) $(LDFLAGS) -N -e main -Ttext 0 -o $@ $^  -L ../ $(LIBGCC)
-	$(OBJDUMP) -S $@ > $*.asm
-	$(OBJDUMP) -t $@ | sed '1,/SYMBOL TABLE/d; s/ .* / /; /^$$/d' > $*.sym
+# The main all target
+all: cmake_check_build_system
+	cd /mnt/dalmore-home/one/src/cbcxv6/src && $(CMAKE_COMMAND) -E cmake_progress_start /mnt/dalmore-home/one/src/cbcxv6/src/CMakeFiles /mnt/dalmore-home/one/src/cbcxv6/src/usr/CMakeFiles/progress.marks
+	cd /mnt/dalmore-home/one/src/cbcxv6/src && $(MAKE) -f CMakeFiles/Makefile2 usr/all
+	$(CMAKE_COMMAND) -E cmake_progress_start /mnt/dalmore-home/one/src/cbcxv6/src/CMakeFiles 0
+.PHONY : all
+
+# The main clean target
+clean:
+	cd /mnt/dalmore-home/one/src/cbcxv6/src && $(MAKE) -f CMakeFiles/Makefile2 usr/clean
+.PHONY : clean
+
+# The main clean target
+clean/fast: clean
+
+.PHONY : clean/fast
+
+# Prepare targets for installation.
+preinstall: all
+	cd /mnt/dalmore-home/one/src/cbcxv6/src && $(MAKE) -f CMakeFiles/Makefile2 usr/preinstall
+.PHONY : preinstall
+
+# Prepare targets for installation.
+preinstall/fast:
+	cd /mnt/dalmore-home/one/src/cbcxv6/src && $(MAKE) -f CMakeFiles/Makefile2 usr/preinstall
+.PHONY : preinstall/fast
+
+# clear depends
+depend:
+	cd /mnt/dalmore-home/one/src/cbcxv6/src && $(CMAKE_COMMAND) -S$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) --check-build-system CMakeFiles/Makefile.cmake 1
+.PHONY : depend
+
+# Convenience name for target.
+usr/CMakeFiles/ulib.dir/rule:
+	cd /mnt/dalmore-home/one/src/cbcxv6/src && $(MAKE) -f CMakeFiles/Makefile2 usr/CMakeFiles/ulib.dir/rule
+.PHONY : usr/CMakeFiles/ulib.dir/rule
+
+# Convenience name for target.
+ulib: usr/CMakeFiles/ulib.dir/rule
+
+.PHONY : ulib
+
+# fast build rule for target.
+ulib/fast:
+	cd /mnt/dalmore-home/one/src/cbcxv6/src && $(MAKE) -f usr/CMakeFiles/ulib.dir/build.make usr/CMakeFiles/ulib.dir/build
+.PHONY : ulib/fast
+
+printf.o: printf.c.o
+
+.PHONY : printf.o
+
+# target to build an object file
+printf.c.o:
+	cd /mnt/dalmore-home/one/src/cbcxv6/src && $(MAKE) -f usr/CMakeFiles/ulib.dir/build.make usr/CMakeFiles/ulib.dir/printf.c.o
+.PHONY : printf.c.o
+
+printf.i: printf.c.i
+
+.PHONY : printf.i
 
-_forktest: forktest.o $(ULIB)
-	# forktest has less library code linked in - needs to be small
-	# in order to be able to max out the proc table.
-	$(LD) $(LDFLAGS) -N -e main -Ttext 0 -o _forktest forktest.o ulib.o usys.o
-	$(OBJDUMP) -S _forktest > forktest.asm
+# target to preprocess a source file
+printf.c.i:
+	cd /mnt/dalmore-home/one/src/cbcxv6/src && $(MAKE) -f usr/CMakeFiles/ulib.dir/build.make usr/CMakeFiles/ulib.dir/printf.c.i
+.PHONY : printf.c.i
+
+printf.s: printf.c.s
+
+.PHONY : printf.s
+
+# target to generate assembly for a file
+printf.c.s:
+	cd /mnt/dalmore-home/one/src/cbcxv6/src && $(MAKE) -f usr/CMakeFiles/ulib.dir/build.make usr/CMakeFiles/ulib.dir/printf.c.s
+.PHONY : printf.c.s
+
+ulib.o: ulib.c.o
+
+.PHONY : ulib.o
+
+# target to build an object file
+ulib.c.o:
+	cd /mnt/dalmore-home/one/src/cbcxv6/src && $(MAKE) -f usr/CMakeFiles/ulib.dir/build.make usr/CMakeFiles/ulib.dir/ulib.c.o
+.PHONY : ulib.c.o
+
+ulib.i: ulib.c.i
+
+.PHONY : ulib.i
+
+# target to preprocess a source file
+ulib.c.i:
+	cd /mnt/dalmore-home/one/src/cbcxv6/src && $(MAKE) -f usr/CMakeFiles/ulib.dir/build.make usr/CMakeFiles/ulib.dir/ulib.c.i
+.PHONY : ulib.c.i
+
+ulib.s: ulib.c.s
+
+.PHONY : ulib.s
+
+# target to generate assembly for a file
+ulib.c.s:
+	cd /mnt/dalmore-home/one/src/cbcxv6/src && $(MAKE) -f usr/CMakeFiles/ulib.dir/build.make usr/CMakeFiles/ulib.dir/ulib.c.s
+.PHONY : ulib.c.s
+
+umalloc.o: umalloc.c.o
+
+.PHONY : umalloc.o
+
+# target to build an object file
+umalloc.c.o:
+	cd /mnt/dalmore-home/one/src/cbcxv6/src && $(MAKE) -f usr/CMakeFiles/ulib.dir/build.make usr/CMakeFiles/ulib.dir/umalloc.c.o
+.PHONY : umalloc.c.o
+
+umalloc.i: umalloc.c.i
+
+.PHONY : umalloc.i
 
-$(FS_IMAGE): $(MKFS)  $(UPROGS)
-	$(MKFS) $@  $(UPROGS) UNIX
-	$(OBJDUMP) -S usys.o > usys.asm
+# target to preprocess a source file
+umalloc.c.i:
+	cd /mnt/dalmore-home/one/src/cbcxv6/src && $(MAKE) -f usr/CMakeFiles/ulib.dir/build.make usr/CMakeFiles/ulib.dir/umalloc.c.i
+.PHONY : umalloc.c.i
+
+umalloc.s: umalloc.c.s
+
+.PHONY : umalloc.s
+
+# target to generate assembly for a file
+umalloc.c.s:
+	cd /mnt/dalmore-home/one/src/cbcxv6/src && $(MAKE) -f usr/CMakeFiles/ulib.dir/build.make usr/CMakeFiles/ulib.dir/umalloc.c.s
+.PHONY : umalloc.c.s
+
+usys.o: usys.S.o
+
+.PHONY : usys.o
+
+# target to build an object file
+usys.S.o:
+	cd /mnt/dalmore-home/one/src/cbcxv6/src && $(MAKE) -f usr/CMakeFiles/ulib.dir/build.make usr/CMakeFiles/ulib.dir/usys.S.o
+.PHONY : usys.S.o
 
-clean: 
-	rm -f *.o *.d *.asm *.sym $(FS_IMAGE) \
-	.gdbinit \
-	$(UPROGS)
+# 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 "... ulib"
+	@echo "... printf.o"
+	@echo "... printf.i"
+	@echo "... printf.s"
+	@echo "... ulib.o"
+	@echo "... ulib.i"
+	@echo "... ulib.s"
+	@echo "... umalloc.o"
+	@echo "... umalloc.i"
+	@echo "... umalloc.s"
+	@echo "... usys.o"
+.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:
+	cd /mnt/dalmore-home/one/src/cbcxv6/src && $(CMAKE_COMMAND) -S$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) --check-build-system CMakeFiles/Makefile.cmake 0
+.PHONY : cmake_check_build_system
+