@@ -40,9 +40,6 @@ INC_NEWLIB=$(INSTALL)/newlib/include
4040CC = $(shell command -v clang-3.8 || command -v clang-3.6)
4141CPP = $(shell command -v clang++-3.8 || command -v clang++-3.6 || command -v clang++)
4242# Set defaults if not defined
43- ifndef LD_INC
44- LD_INC = ld
45- endif
4643ifndef AR_INC
4744 AR_INC = ar
4845endif
@@ -54,12 +51,11 @@ endif
5451CCOPTS = -target i686-elf
5552CPPOPTS = -target i686-elf
5653
57- INCLUDES = -I../api/sys -I$(INSTALL ) /libcxx/include -I$(INC_NEWLIB ) -Iinclude -I../api -I../mod/GSL
54+ INCLUDES = -I../api/sys -I$(INSTALL ) /libcxx/include -I$(INC_NEWLIB ) -Iinclude -I../api -I../mod/GSL -I../mod/fiber/include
5855CINCLUDES = -I../api/sys -I$(INC_NEWLIB ) -Iinclude -I../api
5956
6057CCOPTS += $(CAPABS ) $(WARNS ) -c -m32 -march=i686 $(CINCLUDES )
6158CPPOPTS += $(CAPABS ) $(WARNS ) -c -m32 -std=c++14 $(INCLUDES ) -D_LIBCPP_HAS_NO_THREADS=1 -DOS_VERSION="\"$(shell git describe --dirty) \""
62- LDOPTS = -nostdlib -melf_i386 -N --eh-frame-hdr --script=linker.ld
6359
6460# Objects
6561# ##################################################
@@ -70,7 +66,7 @@ OS_OBJECTS = kernel/start.o kernel/kernel_start.o kernel/syscalls.o \
7066 kernel/interrupts.o kernel/os.o kernel/os_stdout.o kernel/cpuid.o \
7167 kernel/memmap.o kernel/irq_manager.o kernel/pci_manager.o \
7268 kernel/elf.o kernel/terminal.o kernel/terminal_disk.o \
73- kernel/vga.o kernel/debug_new.o \
69+ kernel/vga.o kernel/debug_new.o kernel/context.o kernel/context_asm.o \
7470 kernel/profile.o kernel/profile_intr.o \
7571 kernel/timers.o kernel/rtc.o util/memstream.o util/async.o util/statman.o \
7672 crt/c_abi.o crt/string.o crt/quick_exit.o crt/cxx_abi.o crt/mman.o \
@@ -88,7 +84,10 @@ OS_OBJECTS = kernel/start.o kernel/kernel_start.o kernel/syscalls.o \
8884 net/buffer_store.o net/inet4.o \
8985 fs/disk.o fs/filesystem.o fs/mbr.o fs/path.o \
9086 fs/ext4.o fs/fat.o fs/fat_async.o fs/fat_sync.o fs/memdisk.o
91- # virtio/console.o
87+ # ../mod/fiber/src/barrier.o ../mod/fiber/src/context.o ../mod/fiber/src/condition_variable.o \
88+ #../mod/fiber/src/fiber.o ../mod/fiber/src/future.o ../mod/fiber/src/properties.o ../mod/fiber/src/mutex.o \
89+ # ../mod/fiber/src/recursive_mutex.o ../mod/fiber/src/recursive_timed_mutex.o \
90+ #../mod/fiber/src/recursive_mutex.o ../mod/fiber/src/scheduler.o ../mod/fiber/src/timed_mutex.o
9291
9392DRIVERS = drivers/virtioblk.o drivers/virtionet.o
9493DRIVERS_DEPS = $(DRIVERS:.o=.d )
@@ -103,7 +102,7 @@ CRTN_OBJ = crt/crtn.o
103102# ##################################################
104103OS_DEPS = $(OS_OBJECTS:.o=.d )
105104
106- .PHONY : memdisk all debug stripped minimal clean
105+ .PHONY : all stripped minimal debug silent clean
107106
108107# Complete OS build
109108# ##################################################
@@ -115,10 +114,12 @@ all: CAPABS += -O2
115114all : includeos
116115 @echo " \n>>> Built OS-library. Install to '" $(INSTALL ) " ' using 'make install'"
117116
118- stripped : CAPABS += -Os
119- stripped : LDOPTS += -s
117+ stripped : CAPABS += -O2
120118stripped : includeos
121119
120+ minimal : CAPABS += -Os
121+ minimal : includeos
122+
122123# Build like "all" but with debugging output (i.e. the 'debug'-macro) enabled
123124debug-info : CAPABS += -UNO_DEBUG
124125debug-info : CAPABS += -DGSL_THROW_ON_CONTRACT_VIOLATION
@@ -141,31 +142,8 @@ debug-all: includeos test
141142silent : CPPOPTS += -DNO_INFO=1
142143silent : includeos
143144
144- minimal : CPPOPTS += -ffunction-sections -fdata-sections
145- minimal : LDOPTS += --gc-sections
146- minimal : stripped
147-
148145includeos : bootloader multiboot libc++abi.a os.a drivers platforms
149146
150- # Test service
151- # ##################################################
152- LIBS_OBJ = os.a $(LIBCXX ) os.a $(LIBC_OBJ ) $(LIBM_OBJ ) $(LIBGCC )
153-
154-
155- CRTBEGIN_OBJ = $(CRTI_OBJ ) $(INSTALL ) /crt/crtbegin.o
156- CRTEND_OBJ = $(INSTALL ) /crt/crtend.o $(CRTN_OBJ )
157-
158- TEST_OBJ = debug/test_service.o util/service_name.o
159-
160- test_service : CPPOPTS += -DSERVICE_NAME="\"Test Service\""
161- test_service : $(TEST_OBJ ) $(CRTI_OBJ ) $(CRTN_OBJ )
162- @echo " \n>> Linking test service"
163- @echo " \n>> LDOPTS = $( LDOPTS) "
164- touch smalldisk
165- $(LD_INC ) -v $(LDOPTS ) $(CRTBEGIN_OBJ ) $(TEST_OBJ ) $(LIBS_OBJ ) $(CRTEND_OBJ ) -o debug/$@
166-
167- test : test_service
168-
169147# OS libraries
170148# ##################################################
171149# OS
@@ -249,10 +227,7 @@ etags:
249227
250228# Cleanup
251229# ##################################################
252- clean_tests :
253- $(RM ) debug/* .o debug/* .d debug/* .img debug/test_service debug/test_ipv6 debug/test_tcp
254-
255- clean : clean_tests
230+ clean :
256231 $(RM ) $(OS_OBJECTS ) $(CXXABI_OBJ ) $(OS_DEPS ) $(DRIVERS ) $(DRIVERS_DEPS ) $(PLATFORMS ) $(PLATFORMS_DEPS )
257232 $(RM ) os.a libc++abi.a
258233 $(RM ) bootloader apic_boot apic_boot.o boot/multiboot.o
0 commit comments