@ -1,5 +1,13 @@
# S e e t h e e n d o f t h i s f i l e f o r c o p y r i g h t a n d l i c e n s e t e r m s .
# L o o k , i h a v e a b s o l u t e l y z e r o p a t i e n c e w h e n i t c o m e s t o f u c k i n g a r o u n d w i t h
# b u i l d t o o l s . T h i s i s m o s t p r o b a b l y n o t t h e c o r r e c t w a y t o d o it ( especially
# w i t h t h e c r o s s c o m p i l e r s e t u p i n a r c h / < a r c h > / c o n f i g / t o o l c h a i n . c m a k e ) , b u t i
# l i t e r a l l y d o n o t c a r e . A f t e r h o u r s o f D u c k D u c k G o o g l i n g r a n d o m s h i t , i
# f i n a l l y g o t t h i s t o work ( kind of ) . I f y o u k n o w y o u r w a y a r o u n d C M a k e , y o u
# a r e m o r e t h a n w e l c o m e t o s u b m i t a P R t h a t f i x e s t h i s m e s s , i w o u l d a p p r e c i a t e
# i t v e r y m u c h . B u t i c e r t a i n l y d o n ' t h a v e t h e e n e r g y f o r i t .
cmake_minimum_required ( VERSION 3.14.0 )
project ( gaybsd VERSION 0.1.0 LANGUAGES C ASM )
@ -20,7 +28,7 @@ configure_file(
include ( "arch/${ARCH}/config/toolchain.cmake" )
set ( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -ffreestanding ")
set ( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -ffreestanding -fno-stack-protector ")
set ( CMAKE_ASM_FLAGS "${CMAKE_ASM_FLAGS} -D_ASM_SOURCE" )
if ( DEBUG )
# - O g o n g c c o p t i m i z e s f o r t h e b e s t d e b u g g i n g e x p e r i e n c e , b u t a p p a r e n t l y t h i s
@ -38,8 +46,8 @@ endif()
# - - w h o l e - a r c h i v e e n s u r e s no ( seemingly ) u n u s e d s y m b o l s
# l i k e t h e m u l t i b o o t t a b l e a r e o m i t t e d f r o m t h e a r c h i v e
set ( CMAKE_LINKER_FLAGS "${CMAKE_LINKER_FLAGS} - nodefaultlibs -static --whole-archive")
set ( CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} - nostdlib -nodefaultlibs -static")
set ( CMAKE_LINKER_FLAGS "${CMAKE_LINKER_FLAGS} - ffreestanding -static --whole-archive")
set ( CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} - ffreestanding -nostdlib -static")
set ( GAY_INCLUDE_DIRS
" $ { C M A K E _ S O U R C E _ D I R } / i n c l u d e "
@ -67,6 +75,10 @@ target_sources(gaybsd_image.elf PRIVATE "${CMAKE_CURRENT_BINARY_DIR}/_empty.c")
target_link_libraries ( gaybsd_image.elf PRIVATE
g a y _ a r c h
g a y _ k e r n e l
# l i b g c c i s n e e d e d f o r s o m e i n t e r n a l s t u f f l i k e 6 4 - b i t d i v i s i o n w h i c h
# i s n ' t n a t i v e l y s u p p o r t e d b y t h e C P U i n s t r u c t i o n set ( on i686 ) .
# A p p a r e n t l y , c l a n g u s e s t h a t t o o .
g c c
)
add_custom_target ( gaybsd_image DEPENDS gaybsd_image.elf )