diff --git a/apps/posix_launcher.ini b/apps/posix_launcher.ini index 90f2fc0..01e1e47 100644 --- a/apps/posix_launcher.ini +++ b/apps/posix_launcher.ini @@ -7,4 +7,4 @@ needs_native_toolchain=1 [build] source=apps/posix_launcher.cpp -link_flags=-Lroot/Applications/POSIX/lib -lc bin/crtglue.o bin/crt1.o +link_flags=-Lroot/Applications/POSIX/lib -lc "bin/Object Files/crtglue.o" "bin/Object Files/crt1.o" diff --git a/desktop/api.cpp b/desktop/api.cpp index 60c24cf..52d5c95 100644 --- a/desktop/api.cpp +++ b/desktop/api.cpp @@ -41,7 +41,7 @@ #include struct EnumString { const char *cName; int value; }; -#include +#include #define DESKTOP_MSG_SET_TITLE (1) #define DESKTOP_MSG_SET_ICON (2) @@ -264,7 +264,7 @@ struct APIInstance { #ifndef NO_API_TABLE const void *const apiTable[] = { -#include +#include }; #endif diff --git a/kernel/module.h b/kernel/module.h index 483f446..4400a5e 100644 --- a/kernel/module.h +++ b/kernel/module.h @@ -533,7 +533,7 @@ void KDeviceCloseHandle(KDevice *device); // The device creator is responsible f void KDeviceRemoved(KDevice *device); // Call when a child device is removed. Must be called only once! void KDeviceSendConnectedMessage(KDevice *device, EsDeviceType type); // Send a message to Desktop to inform it the device was connected. -#include +#include struct KClockDevice : KDevice { EsError (*read)(KClockDevice *device, EsDateComponents *components, uint64_t *linearMs); diff --git a/kernel/symbols.cpp b/kernel/symbols.cpp index ba58402..847a0b0 100644 --- a/kernel/symbols.cpp +++ b/kernel/symbols.cpp @@ -15,7 +15,7 @@ struct ExportedKernelFunction { }; const ExportedKernelFunction exportedKernelFunctions[] = { -#include +#include }; static uintptr_t linkOffset; diff --git a/kernel/syscall.cpp b/kernel/syscall.cpp index 3000636..5498cff 100644 --- a/kernel/syscall.cpp +++ b/kernel/syscall.cpp @@ -1725,7 +1725,7 @@ SYSCALL_IMPLEMENT(ES_SYSCALL_DEBUG_COMMAND) { } const SyscallFunction syscallFunctions[ES_SYSCALL_COUNT + 1] { -#include +#include }; #pragma GCC diagnostic pop diff --git a/ports/freetype/build.sh b/ports/freetype/build.sh index fac7aa9..432ba53 100755 --- a/ports/freetype/build.sh +++ b/ports/freetype/build.sh @@ -2,7 +2,7 @@ if [ ! -d "bin/freetype" ]; then echo "Downloading FreeType..." if [ ! -f "bin/cache/freetype-2.9.tar" ]; then - curl https://mirrors.up.pt/pub/nongnu/freetype/freetype-2.9.tar.gz > bin/cache/freetype-2.9.tar.gz 2> bin/freetype_dl.txt + curl https://mirrors.up.pt/pub/nongnu/freetype/freetype-2.9.tar.gz > bin/cache/freetype-2.9.tar.gz 2> bin/Logs/freetype_dl.txt gunzip bin/cache/freetype-2.9.tar.gz fi @@ -21,7 +21,7 @@ if [ "$1" = "x86_64" ]; then rm -f objs/.libs/libfreetype.a ./configure --without-zlib --without-bzip2 --without-png --without-harfbuzz \ CC=x86_64-essence-gcc CFLAGS="-g -ffreestanding -Wno-unused-function -O3" \ - LDFLAGS="-nostdlib -lgcc" --host=x86_64-essence > ../freetype_configure.txt 2>&1 + LDFLAGS="-nostdlib -lgcc" --host=x86_64-essence > ../Logs/freetype_configure.txt 2>&1 make ANSIFLAGS="" > /dev/null cp objs/.libs/libfreetype.a libfreetype_x86_64.a cd ../.. @@ -38,7 +38,7 @@ if [ "$1" = "x86_32" ]; then rm -f objs/.libs/libfreetype.a ./configure --without-zlib --without-bzip2 --without-png --without-harfbuzz \ CC=i686-elf-gcc CFLAGS="-g -ffreestanding -Wno-unused-function -O3 -I$INC" \ - LDFLAGS="-nostdlib -lgcc" --host=i686-elf > ../freetype_configure.txt 2>&1 + LDFLAGS="-nostdlib -lgcc" --host=i686-elf > ../Logs/freetype_configure.txt 2>&1 sed -i '/define FT_USE_AUTOCONF_SIZEOF_TYPES/d' builds/unix/ftconfig.h make ANSIFLAGS="" > /dev/null cp objs/.libs/libfreetype.a libfreetype_x86_32.a diff --git a/ports/harfbuzz/build.sh b/ports/harfbuzz/build.sh index efb40aa..c6cf004 100755 --- a/ports/harfbuzz/build.sh +++ b/ports/harfbuzz/build.sh @@ -57,7 +57,7 @@ if [ ! -d "bin/harfbuzz" ]; then echo "Downloading Harfbuzz..." if [ ! -f "bin/cache/harfbuzz-2.6.4.tar" ]; then - curl https://www.freedesktop.org/software/harfbuzz/release/harfbuzz-2.6.4.tar.xz > bin/cache/harfbuzz-2.6.4.tar.xz 2> bin/harfbuzz_dl.txt + curl https://www.freedesktop.org/software/harfbuzz/release/harfbuzz-2.6.4.tar.xz > bin/cache/harfbuzz-2.6.4.tar.xz 2> bin/Logs/harfbuzz_dl.txt xz -d bin/cache/harfbuzz-2.6.4.tar.xz fi @@ -66,7 +66,7 @@ if [ ! -d "bin/harfbuzz" ]; then cd bin/harfbuzz ./configure --with-glib=no --with-icu=no --with-freetype=no --with-cairo=no --with-fontconfig=no --enable-shared \ - CFLAGS="-g -O3 -DHB_TINY" CXXFLAGS="-g -O3 -DHB_TINY" > ../harfbuzz_configure.txt + CFLAGS="-g -O3 -DHB_TINY" CXXFLAGS="-g -O3 -DHB_TINY" > ../Logs/harfbuzz_configure.txt cd ../.. cp ports/harfbuzz/essence-config.h bin/harfbuzz/config.h diff --git a/start.sh b/start.sh index 7afa1c3..4bd5ff9 100755 --- a/start.sh +++ b/start.sh @@ -3,8 +3,8 @@ # Set the current directory to the source root. cd "$(dirname "$0")" -# Create the bin and download cache directories. -mkdir -p bin bin/cache +# Create the bin directories. +mkdir -p bin bin/Dependency\ Files bin/Logs bin/cache # Check that we are running on a sensible platform. uname -o | grep Cygwin > /dev/null diff --git a/util/build.c b/util/build.c index 05aa4e4..d9f3619 100644 --- a/util/build.c +++ b/util/build.c @@ -144,7 +144,7 @@ int CallSystemF(const char *format, ...) { void BuildAPIDependencies() { if (CheckDependencies("API Header")) { CallSystem("bin/build_core headers"); - ParseDependencies("bin/api_header.d", "API Header", false); + ParseDependencies("bin/Dependency Files/api_header.d", "API Header", false); } CallSystem("ports/musl/build.sh " TARGET_NAME); @@ -172,7 +172,7 @@ void OutputStartOfBuildINI(FILE *f, bool forceDebugBuildOff) { "nasm=%s\n" "convert_svg=bin/render_svg\n" "linker_scripts=util/\n" - "crt_objects=bin/\n" + "crt_objects=bin/Object Files/\n" "compiler_objects=%s/../lib/gcc/" TOOLCHAIN_PREFIX "/" GCC_VERSION "\n" "\n[general]\nsystem_build=1\nminimal_rebuild=1\ncolored_output=%d\nthread_count=%d\n" "target=" TARGET_NAME "\nskip_header_generation=1\nverbose=%d\ncommon_compile_flags=", @@ -361,8 +361,8 @@ void BuildUtilities() { #define BUILD_UTILITY(x, y, z) \ if (CheckDependencies("Utilities." x)) { \ - if (!CallSystem("gcc -MMD util/" z x ".c -o bin/" x " -g " WARNING_FLAGS " " y)) { \ - ParseDependencies("bin/" x ".d", "Utilities." x, false); \ + if (!CallSystem("gcc -MMD -MF \"bin/Dependency Files/" x ".d\" " "util/" z x ".c -o bin/" x " -g " WARNING_FLAGS " " y)) { \ + ParseDependencies("bin/Dependency Files/" x ".d", "Utilities." x, false); \ } \ } @@ -373,8 +373,9 @@ void BuildUtilities() { BUILD_UTILITY("config_editor", "-lX11 -Wno-unused-parameter", ""); if (CheckDependencies("Utilities.Designer")) { - if (!CallSystem("g++ -MMD -D UI_LINUX -O3 util/designer2.cpp -o bin/designer2 -g -lX11 -Wno-unused-parameter " WARNING_FLAGS)) { - ParseDependencies("bin/designer2.d", "Utilities.Designer", false); + if (!CallSystem("g++ -MMD -MF \"bin/Dependency Files/designer2.d\" -D UI_LINUX -O3 " + "util/designer2.cpp -o bin/designer2 -g -lX11 -Wno-unused-parameter " WARNING_FLAGS)) { + ParseDependencies("bin/Dependency Files/designer2.d", "Utilities.Designer", false); } } } @@ -481,9 +482,9 @@ void Run(int emulator, int log, int debug) { } bool withAudio = IsOptionEnabled("Emulator.Audio"); - const char *audioFlags = withAudio ? "QEMU_AUDIO_DRV=wav QEMU_WAV_PATH=bin/audio.wav " : ""; + const char *audioFlags = withAudio ? "QEMU_AUDIO_DRV=wav QEMU_WAV_PATH=bin/Logs/audio.wav " : ""; const char *audioFlags2 = withAudio ? "-soundhw pcspk,hda" : ""; - unlink("bin/audio.wav"); + unlink("bin/Logs/audio.wav"); const char *secondaryDriveMB = GetOptionString("Emulator.SecondaryDriveMB"); char secondaryDriveFlags[256]; @@ -497,8 +498,8 @@ void Run(int emulator, int log, int debug) { secondaryDriveFlags[0] = 0; } - const char *logFlags = log == LOG_VERBOSE ? "-d cpu_reset,int > bin/qemu_log.txt 2>&1" - : (log == LOG_NORMAL ? " > bin/qemu_log.txt 2>&1" : " > /dev/null 2>&1"); + const char *logFlags = log == LOG_VERBOSE ? "-d cpu_reset,int > bin/Logs/qemu_log.txt 2>&1" + : (log == LOG_NORMAL ? " > bin/Logs/qemu_log.txt 2>&1" : " > /dev/null 2>&1"); int cpuCores = atoi(GetOptionString("Emulator.Cores")); @@ -511,21 +512,21 @@ void Run(int emulator, int log, int debug) { char serialFlags[256]; if (IsOptionEnabled("Emulator.SerialToFile")) { - system("mv bin/qemu_serial7.txt bin/qemu_serial8.txt 2> /dev/null"); - system("mv bin/qemu_serial6.txt bin/qemu_serial7.txt 2> /dev/null"); - system("mv bin/qemu_serial5.txt bin/qemu_serial6.txt 2> /dev/null"); - system("mv bin/qemu_serial4.txt bin/qemu_serial5.txt 2> /dev/null"); - system("mv bin/qemu_serial3.txt bin/qemu_serial4.txt 2> /dev/null"); - system("mv bin/qemu_serial2.txt bin/qemu_serial3.txt 2> /dev/null"); - system("mv bin/qemu_serial1.txt bin/qemu_serial2.txt 2> /dev/null"); - strcpy(serialFlags, "-serial file:bin/qemu_serial1.txt"); + system("mv bin/Logs/qemu_serial7.txt bin/Logs/qemu_serial8.txt 2> /dev/null"); + system("mv bin/Logs/qemu_serial6.txt bin/Logs/qemu_serial7.txt 2> /dev/null"); + system("mv bin/Logs/qemu_serial5.txt bin/Logs/qemu_serial6.txt 2> /dev/null"); + system("mv bin/Logs/qemu_serial4.txt bin/Logs/qemu_serial5.txt 2> /dev/null"); + system("mv bin/Logs/qemu_serial3.txt bin/Logs/qemu_serial4.txt 2> /dev/null"); + system("mv bin/Logs/qemu_serial2.txt bin/Logs/qemu_serial3.txt 2> /dev/null"); + system("mv bin/Logs/qemu_serial1.txt bin/Logs/qemu_serial2.txt 2> /dev/null"); + strcpy(serialFlags, "-serial file:bin/Logs/qemu_serial1.txt"); } else { serialFlags[0] = 0; } if (CallSystemF("%s %s " QEMU_EXECUTABLE " %s%s %s -m %d %s -smp cores=%d -cpu Haswell " " -device qemu-xhci,id=xhci -device usb-kbd,bus=xhci.0,id=mykeyboard -device usb-mouse,bus=xhci.0,id=mymouse " - " -netdev user,id=u1 -device e1000,netdev=u1 -object filter-dump,id=f1,netdev=u1,file=bin/net.dat " + " -netdev user,id=u1 -device e1000,netdev=u1 -object filter-dump,id=f1,netdev=u1,file=bin/Logs/net.dat " " %s %s %s %s %s %s %s ", audioFlags, IsOptionEnabled("Emulator.RunWithSudo") ? "sudo " : "", drivePrefix, driveFlags, cdromFlags, atoi(GetOptionString("Emulator.MemoryMB")), @@ -1661,7 +1662,7 @@ int main(int _argc, char **_argv) { printf(ColorHighlight "Essence Build" ColorNormal "\nPress Ctrl-C to exit.\nCross target is " ColorHighlight TARGET_NAME ColorNormal ".\n"); } - systemLog = fopen("bin/system.log", "w"); + systemLog = fopen("bin/Logs/system.log", "w"); { EsINIState s = { (char *) LoadFile("bin/build_config.ini", &s.bytes) }; @@ -1761,6 +1762,7 @@ int main(int _argc, char **_argv) { char *prev = NULL; canBuildLuigi = !CallSystem("gcc -o bin/luigi.h.gch util/luigi.h -D UI_IMPLEMENTATION -D UI_LINUX 2> /dev/null"); + unlink("bin/luigi.h.gch"); while (true) { char *l = NULL; diff --git a/util/build_core.c b/util/build_core.c index bf74bff..2622e18 100644 --- a/util/build_core.c +++ b/util/build_core.c @@ -568,13 +568,15 @@ void BuildDesktop(Application *application) { char buffer[4096]; snprintf(buffer, sizeof(buffer), "arch/%s/api.s", target); - ExecuteForApp(application, toolchainNasm, buffer, "-MD", "bin/api1.d", "-o", "bin/api1.o", ArgString(commonAssemblyFlags)); - ExecuteForApp(application, toolchainCXX, "-MD", "-c", "desktop/api.cpp", "-o", "bin/api2.o", ArgString(commonCompileFlags), ArgString(desktopProfilingFlags)); - ExecuteForApp(application, toolchainCXX, "-MD", "-c", "desktop/posix.cpp", "-o", "bin/api3.o", ArgString(commonCompileFlags)); - ExecuteForApp(application, toolchainCC, "-o", "bin/Desktop", "bin/crti.o", "bin/crtbegin.o", - "bin/api1.o", "bin/api2.o", "bin/api3.o", "bin/crtend.o", "bin/crtn.o", + ExecuteForApp(application, toolchainNasm, buffer, "-MD", "bin/Dependency Files/api1.d", "-o", "bin/Object Files/api1.o", ArgString(commonAssemblyFlags)); + ExecuteForApp(application, toolchainCXX, "-MD", "-MF", "bin/Dependency Files/api2.d", "-c", "desktop/api.cpp", "-o", "bin/Object Files/api2.o", + ArgString(commonCompileFlags), ArgString(desktopProfilingFlags)); + ExecuteForApp(application, toolchainCXX, "-MD", "-MF", "bin/Dependency Files/api3.d", "-c", "desktop/posix.cpp", "-o", "bin/Object Files/api3.o", + ArgString(commonCompileFlags)); + ExecuteForApp(application, toolchainCC, "-o", "bin/Desktop", "bin/Object Files/crti.o", "bin/Object Files/crtbegin.o", + "bin/Object Files/api1.o", "bin/Object Files/api2.o", "bin/Object Files/api3.o", "bin/Object Files/crtend.o", "bin/Object Files/crtn.o", ArgString(apiLinkFlags1), ArgString(apiLinkFlags2), ArgString(apiLinkFlags3)); - ExecuteForApp(application, toolchainStrip, "-o", "bin/Desktop.no_symbols", "--strip-all", "bin/Desktop"); + ExecuteForApp(application, toolchainStrip, "-o", "bin/Stripped Executables/Desktop", "--strip-all", "bin/Desktop"); for (uintptr_t i = 0; i < arrlenu(fontLines); i++) { if (fontLines[i].key[0] == '.' || 0 == strcmp(fontLines[i].key, "license")) { @@ -604,7 +606,7 @@ void BuildDesktop(Application *application) { ADD_BUNDLE_INPUT("res/elementary Icons.dat", "Icons.dat", 16); ADD_BUNDLE_INPUT("res/elementary Icons License.txt", "Icons License.txt", 16); ADD_BUNDLE_INPUT("res/Cursors.png", "Cursors.png", 16); - ADD_BUNDLE_INPUT("bin/Desktop.no_symbols", "$Executables/x86_64", 0x1000); // TODO Don't hardcode the target. + ADD_BUNDLE_INPUT("bin/Stripped Executables/Desktop", "$Executables/x86_64", 0x1000); // TODO Don't hardcode the target. MakeBundle("root/" SYSTEM_FOLDER_NAME "/Desktop.esx", application->bundleInputFiles, arrlenu(application->bundleInputFiles), 0); } @@ -622,7 +624,7 @@ void BuildApplication(Application *application) { size_t objectFilesPosition = 0; snprintf(symbolFile, sizeof(symbolFile), "bin/%s", application->name); - snprintf(strippedFile, sizeof(strippedFile), "bin/%s.no_symbols", application->name); + snprintf(strippedFile, sizeof(strippedFile), "bin/Stripped Executables/%s", application->name); snprintf(linkerScript, sizeof(linkerScript), "%s/linker/userland64.ld", toolchainLinkerScripts); // TODO Don't hardcode the target. snprintf(crti, sizeof(crti), "%s/crti.o", toolchainCRTObjects); snprintf(crtbegin, sizeof(crtbegin), "%s/crtbegin.o", toolchainCRTObjects); @@ -647,8 +649,9 @@ void BuildApplication(Application *application) { const char *source = application->sources[i]; size_t sourceBytes = strlen(source); - char objectFile[256]; - snprintf(objectFile, sizeof(objectFile), "bin/%s_%d.o", application->name, (int) i); + char objectFile[256], dependencyFile[256]; + snprintf(objectFile, sizeof(objectFile), "bin/Object Files/%s_%d.o", application->name, (int) i); + snprintf(dependencyFile, sizeof(dependencyFile), "bin/Dependency Files/%s_%d.d", application->name, (int) i); objectFilesPosition += sprintf(objectFiles + objectFilesPosition, "\"%s\" ", objectFile); bool isC = sourceBytes > 2 && source[sourceBytes - 1] == 'c' && source[sourceBytes - 2] == '.'; @@ -656,7 +659,7 @@ void BuildApplication(Application *application) { const char *languageFlags = isC ? cCompileFlags : cppCompileFlags; const char *compiler = isC ? toolchainCC : toolchainCXX; - ExecuteForApp(application, compiler, "-MD", "-o", objectFile, "-c", source, + ExecuteForApp(application, compiler, "-MD", "-MF", dependencyFile, "-o", objectFile, "-c", source, ArgString(languageFlags), ArgString(application->compileFlags), ArgString(cstdlibFlags)); } @@ -791,7 +794,7 @@ void ParseApplicationManifest(const char *manifestPath) { for (uintptr_t i = 0; i < arrlenu(application.sources); i++) { DependencyFile dependencyFile = {}; dependencyFile.name = application.name; - snprintf(dependencyFile.path, sizeof(dependencyFile.path), "bin/%s_%d.d", application.name, (int) i); + snprintf(dependencyFile.path, sizeof(dependencyFile.path), "bin/Dependency Files/%s_%d.d", application.name, (int) i); arrput(application.dependencyFiles, dependencyFile); } @@ -910,11 +913,12 @@ void OutputSystemConfiguration() { } void BuildModule(Application *application) { - char output[4096]; - snprintf(output, sizeof(output), "bin/%s.ekm", application->name); + char output[256], dependencyFile[256]; + snprintf(output, sizeof(output), "bin/Object Files/%s.ekm", application->name); + snprintf(dependencyFile, sizeof(dependencyFile), "bin/Dependency Files/%s.d", application->name); assert(arrlenu(application->sources) == 1); - ExecuteForApp(application, toolchainCXX, "-MD", "-c", application->sources[0], "-o", + ExecuteForApp(application, toolchainCXX, "-MD", "-MF", dependencyFile, "-c", application->sources[0], "-o", output, ArgString(cppCompileFlags), ArgString(kernelCompileFlags), ArgString(commonCompileFlags), application->builtin ? "-DBUILTIN_MODULE" : "-DKERNEL_MODULE"); @@ -946,7 +950,7 @@ void ParseKernelConfiguration() { size_t kernelConfigBytes; char *kernelConfig = (char *) LoadFile("kernel/config.ini", &kernelConfigBytes); - File f = FileOpen("bin/kernel_config.h", 'w'); + File f = FileOpen("bin/Generated Code/kernel_config.h", 'w'); EsINIState s = {}; s.buffer = (char *) kernelConfig; @@ -1029,11 +1033,11 @@ void ParseKernelConfiguration() { FilePrintFormat(f, "#endif"); FileClose(f); - f = FileOpen("bin/system_config.d", 'w'); + f = FileOpen("bin/Dependency Files/system_config.d", 'w'); FilePrintFormat(f, ": kernel/config.ini\n"); FileClose(f); - ParseDependencies("bin/system_config.d", "Kernel Config", false); - DeleteFile("bin/system_config.d"); + ParseDependencies("bin/Dependency Files/system_config.d", "Kernel Config", false); + DeleteFile("bin/Dependency Files/system_config.d"); } void LinkKernel() { @@ -1043,17 +1047,17 @@ void LinkKernel() { arrput(builtinModules, 0); - if (Execute(toolchainLD, "-r", "bin/kernel.o", "bin/kernel_arch.o", ArgString(builtinModules), "-o" "bin/kernel_all.o")) { + if (Execute(toolchainLD, "-r", "bin/Object Files/kernel.o", "bin/Object Files/kernel_arch.o", ArgString(builtinModules), "-o" "bin/Object Files/kernel_all.o")) { return; } { char *output = NULL; - if (_Execute(&output, toolchainNM, "bin/kernel_all.o", NULL, NULL)) { + if (_Execute(&output, toolchainNM, "bin/Object Files/kernel_all.o", NULL, NULL)) { return; } else { - File f = FileOpen("bin/kernel_symbols.h", 'w'); + File f = FileOpen("bin/Generated Code/kernel_symbols.h", 'w'); uintptr_t lineStart = 0, position = 0; while (position < arrlenu(output)) { @@ -1074,38 +1078,38 @@ void LinkKernel() { FileClose(f); - Execute(toolchainCXX, "-c", "kernel/symbols.cpp", "-o", "bin/kernel_symbols.o", + Execute(toolchainCXX, "-c", "kernel/symbols.cpp", "-o", "bin/Object Files/kernel_symbols.o", ArgString(cppCompileFlags), ArgString(kernelCompileFlags), ArgString(commonCompileFlags)); } } - if (Execute(toolchainCXX, "-o", "bin/Kernel", "bin/kernel_symbols.o", "bin/kernel_all.o", ArgString(kernelLinkFlags))) { + if (Execute(toolchainCXX, "-o", "bin/Kernel", "bin/Object Files/kernel_symbols.o", "bin/Object Files/kernel_all.o", ArgString(kernelLinkFlags))) { return; } - Execute(toolchainStrip, "-o", "bin/Kernel.esx", "--strip-all", "bin/Kernel"); - CopyFile("bin/Kernel.esx", "root/" SYSTEM_FOLDER_NAME "/Kernel.esx", false); + Execute(toolchainStrip, "-o", "bin/Stripped Executables/Kernel", "--strip-all", "bin/Kernel"); + CopyFile("bin/Stripped Executables/Kernel", "root/" SYSTEM_FOLDER_NAME "/Kernel.esx", false); } void BuildKernel(Application *application) { char buffer[4096]; snprintf(buffer, sizeof(buffer), "arch/%s/kernel.s", target); - ExecuteForApp(application, toolchainNasm, "-MD", "bin/kernel2.d", buffer, "-o", "bin/kernel_arch.o", ArgString(commonAssemblyFlags)); + ExecuteForApp(application, toolchainNasm, "-MD", "bin/Dependency Files/kernel2.d", buffer, "-o", "bin/Object Files/kernel_arch.o", ArgString(commonAssemblyFlags)); snprintf(buffer, sizeof(buffer), "-DARCH_KERNEL_SOURCE=", target); - ExecuteForApp(application, toolchainCXX, "-MD", "-c", "kernel/main.cpp", "-o", "bin/kernel.o", + ExecuteForApp(application, toolchainCXX, "-MD", "-MF", "bin/Dependency Files/kernel.d", "-c", "kernel/main.cpp", "-o", "bin/Object Files/kernel.o", ArgString(kernelCompileFlags), ArgString(cppCompileFlags), ArgString(commonCompileFlags), buffer); if (application->error) __sync_fetch_and_or(&encounteredErrorsInKernelModules, 1); } void BuildBootloader(Application *application) { - ExecuteForApp(application, toolchainNasm, "-MD", "bin/boot1.d", "-fbin", + ExecuteForApp(application, toolchainNasm, "-MD", "bin/Dependency Files/boot1.d", "-fbin", forEmulator ? "boot/x86/mbr.s" : "boot/x86/mbr-emu.s" , "-obin/mbr"); - ExecuteForApp(application, toolchainNasm, "-MD", "bin/boot2.d", "-fbin", + ExecuteForApp(application, toolchainNasm, "-MD", "bin/Dependency Files/boot2.d", "-fbin", "boot/x86/esfs-stage1.s", "-obin/stage1"); - ExecuteForApp(application, toolchainNasm, "-MD", "bin/boot3.d", "-fbin", + ExecuteForApp(application, toolchainNasm, "-MD", "bin/Dependency Files/boot3.d", "-fbin", "boot/x86/loader.s", "-obin/stage2", "-Pboot/x86/esfs-stage2.s", (forEmulator && !bootUseVBE) ? "" : "-D BOOT_USE_VBE"); - ExecuteForApp(application, toolchainNasm, "-MD", "bin/boot4.d", "-fbin", + ExecuteForApp(application, toolchainNasm, "-MD", "bin/Dependency Files/boot4.d", "-fbin", "boot/x86/uefi_loader.s", "-obin/uefi_loader"); } @@ -1203,7 +1207,7 @@ void Install(const char *driveFile, uint64_t partitionSize, const char *partitio FileClose(f); size_t kernelBytes; - void *kernel = LoadFile("bin/Kernel.esx", &kernelBytes); + void *kernel = LoadFile("bin/Stripped Executables/Kernel", &kernelBytes); if (truncate(driveFile, partitionSize)) { Log("Error: Could not change the file's size to %d bytes.\n", (int) partitionSize); @@ -1445,7 +1449,7 @@ int main(int argc, char **argv) { if (driverSource && *driverSource) { DependencyFile dependencyFile = {}; dependencyFile.name = driverName; - snprintf(dependencyFile.path, sizeof(dependencyFile.path), "bin/%s.d", driverName); + snprintf(dependencyFile.path, sizeof(dependencyFile.path), "bin/Dependency Files/%s.d", driverName); Application application = {}; arrput(application.sources, driverSource); @@ -1457,7 +1461,7 @@ int main(int argc, char **argv) { if (driverBuiltin) { char append[256]; - snprintf(append, sizeof(append), " bin/%s.ekm ", driverName); + snprintf(append, sizeof(append), " \"bin/Object Files/%s.ekm\" ", driverName); size_t previousLength = arrlenu(builtinModules); arrsetlen(builtinModules, previousLength + strlen(append)); memcpy(builtinModules + previousLength, append, strlen(append)); @@ -1502,6 +1506,10 @@ int main(int argc, char **argv) { } MakeDirectory("bin"); + MakeDirectory("bin/Dependency Files"); + MakeDirectory("bin/Object Files"); + MakeDirectory("bin/Stripped Executables"); + MakeDirectory("bin/Generated Code"); if (systemBuild) { MakeDirectory("root"); @@ -1524,31 +1532,32 @@ int main(int argc, char **argv) { char buffer[4096]; snprintf(buffer, sizeof(buffer), "arch/%s/crti.s", target); - Execute(toolchainNasm, buffer, "-o", "bin/crti.o", ArgString(commonAssemblyFlags)); + Execute(toolchainNasm, buffer, "-o", "bin/Object Files/crti.o", ArgString(commonAssemblyFlags)); snprintf(buffer, sizeof(buffer), "arch/%s/crtn.s", target); - Execute(toolchainNasm, buffer, "-o", "bin/crtn.o", ArgString(commonAssemblyFlags)); + Execute(toolchainNasm, buffer, "-o", "bin/Object Files/crtn.o", ArgString(commonAssemblyFlags)); snprintf(buffer, sizeof(buffer), "%s/crtbegin.o", toolchainCompilerObjects); - CopyFile(buffer, "bin/crtbegin.o", false); + CopyFile(buffer, "bin/Object Files/crtbegin.o", false); snprintf(buffer, sizeof(buffer), "%s/crtend.o", toolchainCompilerObjects); - CopyFile(buffer, "bin/crtend.o", false); + CopyFile(buffer, "bin/Object Files/crtend.o", false); - Execute(toolchainCC, "-c", "desktop/crt1.c", "-o", "bin/crt1.o", ArgString(cCompileFlags), ArgString(commonCompileFlags)); - Execute(toolchainCC, "-c", "desktop/crtglue.c", "-o" "bin/crtglue.o", ArgString(cCompileFlags), ArgString(commonCompileFlags)); - CopyFile("bin/crti.o", "root/Applications/POSIX/lib/crti.o", false); - CopyFile("bin/crtbegin.o", "root/Applications/POSIX/lib/crtbegin.o", false); - CopyFile("bin/crtend.o", "root/Applications/POSIX/lib/crtend.o", false); - CopyFile("bin/crtn.o", "root/Applications/POSIX/lib/crtn.o", false); - CopyFile("bin/crt1.o", "root/Applications/POSIX/lib/crt1.o", false); - CopyFile("bin/crtglue.o", "root/Applications/POSIX/lib/crtglue.o", false); - CopyFile("bin/crt1.o", "cross/lib/gcc/x86_64-essence/" GCC_VERSION "/crt1.o", true); // TODO Don't hardcode the target. - CopyFile("bin/crtglue.o", "cross/lib/gcc/x86_64-essence/" GCC_VERSION "/crtglue.o", true); + Execute(toolchainCC, "-c", "desktop/crt1.c", "-o", "bin/Object Files/crt1.o", ArgString(cCompileFlags), ArgString(commonCompileFlags)); + Execute(toolchainCC, "-c", "desktop/crtglue.c", "-o" "bin/Object Files/crtglue.o", ArgString(cCompileFlags), ArgString(commonCompileFlags)); + CopyFile("bin/Object Files/crti.o", "root/Applications/POSIX/lib/crti.o", false); + CopyFile("bin/Object Files/crtbegin.o", "root/Applications/POSIX/lib/crtbegin.o", false); + CopyFile("bin/Object Files/crtend.o", "root/Applications/POSIX/lib/crtend.o", false); + CopyFile("bin/Object Files/crtn.o", "root/Applications/POSIX/lib/crtn.o", false); + CopyFile("bin/Object Files/crt1.o", "root/Applications/POSIX/lib/crt1.o", false); + CopyFile("bin/Object Files/crtglue.o", "root/Applications/POSIX/lib/crtglue.o", false); + CopyFile("bin/Object Files/crt1.o", "cross/lib/gcc/x86_64-essence/" GCC_VERSION "/crt1.o", true); // TODO Don't hardcode the target. + CopyFile("bin/Object Files/crtglue.o", "cross/lib/gcc/x86_64-essence/" GCC_VERSION "/crtglue.o", true); CopyFile("util/linker/userland64.ld", "root/Applications/POSIX/lib/linker/userland64.ld", false); if (hasNativeToolchain) { snprintf(buffer, sizeof(buffer), "%s/linker/userland64.ld", toolchainLinkerScripts); // TODO Don't hardcode the target. Execute(toolchainCC, "util/build_core.c", "-o", "root/Applications/POSIX/bin/build_core", "-g", - "-nostdlib", "bin/crti.o", "bin/crtbegin.o", "bin/crtend.o", "bin/crtn.o", "-T", buffer); + "-nostdlib", "bin/Object Files/crti.o", "bin/Object Files/crtbegin.o", + "bin/Object Files/crtend.o", "bin/Object Files/crtn.o", "-T", buffer); } } @@ -1564,10 +1573,10 @@ int main(int argc, char **argv) { Application application = {}; application.name = "Bootloader"; application.buildCallback = BuildBootloader; - ADD_DEPENDENCY_FILE(application, "bin/boot1.d", "Boot1"); - ADD_DEPENDENCY_FILE(application, "bin/boot2.d", "Boot2"); - ADD_DEPENDENCY_FILE(application, "bin/boot3.d", "Boot3"); - ADD_DEPENDENCY_FILE(application, "bin/boot4.d", "Boot4"); + ADD_DEPENDENCY_FILE(application, "bin/Dependency Files/boot1.d", "Boot1"); + ADD_DEPENDENCY_FILE(application, "bin/Dependency Files/boot2.d", "Boot2"); + ADD_DEPENDENCY_FILE(application, "bin/Dependency Files/boot3.d", "Boot3"); + ADD_DEPENDENCY_FILE(application, "bin/Dependency Files/boot4.d", "Boot4"); arrput(applications, application); } @@ -1575,9 +1584,9 @@ int main(int argc, char **argv) { Application application = {}; application.name = "Desktop"; application.buildCallback = BuildDesktop; - ADD_DEPENDENCY_FILE(application, "bin/api1.d", "API1"); - ADD_DEPENDENCY_FILE(application, "bin/api2.d", "API2"); - ADD_DEPENDENCY_FILE(application, "bin/api3.d", "API3"); + ADD_DEPENDENCY_FILE(application, "bin/Dependency Files/api1.d", "API1"); + ADD_DEPENDENCY_FILE(application, "bin/Dependency Files/api2.d", "API2"); + ADD_DEPENDENCY_FILE(application, "bin/Dependency Files/api3.d", "API3"); arrput(applications, application); } @@ -1591,8 +1600,8 @@ int main(int argc, char **argv) { Application application = {}; application.name = "Kernel"; application.buildCallback = BuildKernel; - ADD_DEPENDENCY_FILE(application, "bin/kernel.d", "Kernel1"); - ADD_DEPENDENCY_FILE(application, "bin/kernel2.d", "Kernel2"); + ADD_DEPENDENCY_FILE(application, "bin/Dependency Files/kernel.d", "Kernel1"); + ADD_DEPENDENCY_FILE(application, "bin/Dependency Files/kernel2.d", "Kernel2"); arrput(applications, application); } diff --git a/util/header_generator.c b/util/header_generator.c index 775f3b3..1b20948 100644 --- a/util/header_generator.c +++ b/util/header_generator.c @@ -5,10 +5,10 @@ char *buffer; int position; #define DEST_OS "root/Applications/POSIX/include/essence.h" -#define DEST_API_ARRAY "bin/api_array.h" -#define DEST_SYSCALL_ARRAY "bin/syscall_array.h" -#define DEST_ENUM_STRINGS_ARRAY "bin/enum_strings_array.h" -#define DEST_DEPENDENCIES "bin/api_header.d" +#define DEST_API_ARRAY "bin/Generated Code/api_array.h" +#define DEST_SYSCALL_ARRAY "bin/Generated Code/syscall_array.h" +#define DEST_ENUM_STRINGS_ARRAY "bin/Generated Code/enum_strings_array.h" +#define DEST_DEPENDENCIES "bin/Dependency Files/api_header.d" typedef struct Token { #define TOKEN_IDENTIFIER (1)