clean up makefiles a bit.

This commit is contained in:
Kelvin Sherlock 2017-10-02 15:11:28 -04:00
parent 60c4977dfa
commit e21aac4022
7 changed files with 37 additions and 72 deletions

View File

@ -1,10 +1,22 @@
set(CMAKE_C_COMPILER "clang") cmake_minimum_required(VERSION 3.1)
set(CMAKE_CXX_COMPILER "clang++") project(mpw VERSION 0.8.1 LANGUAGES CXX C)
set(CMAKE_CXX_FLAGS "-std=c++11 -stdlib=libc++ -Wall -g")
set(CMAKE_C_FLAGS " -Wall -g")
project(mpw) set(CMAKE_CXX_STANDARD 11)
cmake_minimum_required(VERSION 2.6) set(CMAKE_CXX_STANDARD_REQUIRED TRUE)
set(CMAKE_CXX_EXTENSIONS FALSE)
set(CMAKE_C_STANDARD 99)
set(CMAKE_C_STANDARD_REQUIRED TRUE)
set(CMAKE_C_EXTENSIONS FALSE)
if ("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang")
# Clang or AppleClang
set(CMAKE_CXX_FLAGS "-Wall")
set(CMAKE_C_FLAGS "-Wall")
endif()
include_directories("${CMAKE_SOURCE_DIR}")
add_subdirectory(bin) add_subdirectory(bin)
add_subdirectory(cpu) add_subdirectory(cpu)

View File

@ -1,18 +1,11 @@
#set(CMAKE_C_COMPILER "clang")
#set(CMAKE_CXX_COMPILER "clang++")
set(CMAKE_CXX_FLAGS "-std=c++11 -stdlib=libc++ -Wall -Wno-deprecated-declarations -g")
SET(CMAKE_EXE_LINKER_FLAGS "-framework Carbon")
set(CMAKE_INCLUDE_CURRENT_DIR ON)
add_definitions(-I ${CMAKE_SOURCE_DIR}/)
# add_custom_command( if ("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang")
# OUTPUT lexer.cpp # Clang or AppleClang
# COMMAND re2c -b -i -o lexer.cpp "${CMAKE_CURRENT_SOURCE_DIR}/lexer.re.cpp" set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-deprecated-declarations -Wno-unused-variable")
# MAIN_DEPENDENCY lexer.re.cpp endif()
# DEPENDS debugger.h parser.h
# ) include_directories("${CMAKE_CURRENT_SOURCE_DIR}")
add_custom_command( add_custom_command(
OUTPUT lexer.cpp OUTPUT lexer.cpp
@ -24,8 +17,6 @@ add_custom_command(
OUTPUT parser.cpp parser.h OUTPUT parser.cpp parser.h
COMMAND cp -f "${CMAKE_CURRENT_SOURCE_DIR}/parser.lemon" "parser.lemon" COMMAND cp -f "${CMAKE_CURRENT_SOURCE_DIR}/parser.lemon" "parser.lemon"
COMMAND lemon parser.lemon COMMAND lemon parser.lemon
COMMAND cp -f parser.h "${CMAKE_CURRENT_SOURCE_DIR}/"
COMMAND cp -f parser.out "${CMAKE_CURRENT_SOURCE_DIR}/"
COMMAND mv -f parser.c parser.cpp COMMAND mv -f parser.c parser.cpp
MAIN_DEPENDENCY parser.lemon MAIN_DEPENDENCY parser.lemon
DEPENDS debugger.h DEPENDS debugger.h
@ -36,8 +27,6 @@ add_custom_command(
OUTPUT template_parser.cpp template_parser.h OUTPUT template_parser.cpp template_parser.h
COMMAND cp -f "${CMAKE_CURRENT_SOURCE_DIR}/template_parser.lemon" "template_parser.lemon" COMMAND cp -f "${CMAKE_CURRENT_SOURCE_DIR}/template_parser.lemon" "template_parser.lemon"
COMMAND lemon template_parser.lemon COMMAND lemon template_parser.lemon
COMMAND cp -f template_parser.h "${CMAKE_CURRENT_SOURCE_DIR}/"
COMMAND cp -f template_parser.out "${CMAKE_CURRENT_SOURCE_DIR}/"
COMMAND mv -f template_parser.c template_parser.cpp COMMAND mv -f template_parser.c template_parser.cpp
MAIN_DEPENDENCY template_parser.lemon MAIN_DEPENDENCY template_parser.lemon
DEPENDS debugger.h DEPENDS debugger.h
@ -61,14 +50,6 @@ add_custom_command(
) )
set_source_files_properties(
loadtrap.cpp lexer.cpp template_loader.cpp
PROPERTIES
COMPILE_FLAGS
"${CMAKE_CXX_FLAGS} -Wno-unused-variable"
)
add_executable(mpw loader.cpp debugger.cpp debugger_internal.cpp add_executable(mpw loader.cpp debugger.cpp debugger_internal.cpp
address_map.cpp lexer.cpp parser.cpp loadtrap.cpp address_map.cpp lexer.cpp parser.cpp loadtrap.cpp
commands.cpp commands.cpp
@ -80,12 +61,14 @@ target_link_libraries(mpw TOOLBOX_LIB)
target_link_libraries(mpw MPW_LIB) target_link_libraries(mpw MPW_LIB)
target_link_libraries(mpw MPLITE_LIB) target_link_libraries(mpw MPLITE_LIB)
target_link_libraries(mpw MACOS_LIB) target_link_libraries(mpw MACOS_LIB)
set_target_properties(mpw PROPERTIES LINK_FLAGS "-ledit")
target_link_libraries(mpw -ledit)
target_link_libraries(mpw "-framework Carbon")
add_executable(disasm disasm.cpp) add_executable(disasm disasm.cpp)
target_link_libraries(disasm CPU_LIB) target_link_libraries(disasm CPU_LIB)
target_link_libraries(disasm MACOS_LIB) target_link_libraries(disasm MACOS_LIB)
target_link_libraries(disasm "-framework Carbon")
install( install(
PROGRAMS PROGRAMS

View File

@ -1,6 +1,7 @@
set(CMAKE_INCLUDE_CURRENT_DIR ON) if ("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang")
# Clang or AppleClang
set(CMAKE_C_FLAGS " -Wall -Wno-unused-function -g") set(CMAKE_CXX_FLAGS "-Wall -Wno-unused-function")
endif()
set(CPU_SRC set(CPU_SRC
CpuModule.c CpuModule.c

View File

@ -1,10 +1,3 @@
set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(CMAKE_CXX_FLAGS "-std=c++11 -stdlib=libc++ -Wall -g")
add_definitions(-I ${CMAKE_SOURCE_DIR}/)
set(MACOS_SRC traps.c sysequ.c errors.cpp) set(MACOS_SRC traps.c sysequ.c errors.cpp)
add_library(MACOS_LIB ${MACOS_SRC}) add_library(MACOS_LIB ${MACOS_SRC})

View File

@ -1,5 +1,3 @@
set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(MPLITE_SRC mplite.c) set(MPLITE_SRC mplite.c)
add_library(MPLITE_LIB ${MPLITE_SRC}) add_library(MPLITE_LIB ${MPLITE_SRC})

View File

@ -1,17 +1,9 @@
set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(CMAKE_CXX_FLAGS "-std=c++11 -stdlib=libc++ -Wall -g") include_directories("${CMAKE_CURRENT_SOURCE_DIR}")
add_definitions(-I ${CMAKE_SOURCE_DIR}/)
set(MPW_SRC mpw.cpp mpw_io.cpp mpw_close.cpp mpw_access.cpp mpw_ioctl.cpp mpw_errno.cpp set(MPW_SRC mpw.cpp mpw_io.cpp mpw_close.cpp mpw_access.cpp mpw_ioctl.cpp mpw_errno.cpp
environment.cpp) environment.cpp)
# add_custom_command(
# OUTPUT environ.cpp
# COMMAND ragel -p -G2 -o environ.cpp "${CMAKE_CURRENT_SOURCE_DIR}/environ.rl"
# MAIN_DEPENDENCY environ.rl
# )
add_custom_command( add_custom_command(
OUTPUT environment.cpp OUTPUT environment.cpp
@ -20,22 +12,6 @@ add_custom_command(
) )
# add_custom_command(
# OUTPUT epv.cpp
# COMMAND ragel -p -G2 -o epv.cpp "${CMAKE_CURRENT_SOURCE_DIR}/epv.rl"
# MAIN_DEPENDENCY epv.rl
# )
# add_custom_command(
# OUTPUT ep.cpp
# COMMAND ragel -p -G2 -o ep.cpp "${CMAKE_CURRENT_SOURCE_DIR}/ep.rl"
# MAIN_DEPENDENCY ep.rl
# )
set_source_files_properties( set_source_files_properties(
environment.cpp # environ.cpp ep.cpp epv.cpp environment.cpp # environ.cpp ep.cpp epv.cpp
PROPERTIES PROPERTIES

View File

@ -1,8 +1,10 @@
set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(CMAKE_CXX_FLAGS "-std=c++11 -stdlib=libc++ -Wall -Wno-deprecated-declarations -g") if ("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang")
# Clang or AppleClang
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-deprecated-declarations")
endif()
add_definitions(-I ${CMAKE_SOURCE_DIR}/) include_directories("${CMAKE_CURRENT_SOURCE_DIR}")
set(TOOLBOX_SRC set(TOOLBOX_SRC
toolbox.cpp toolbox.cpp