2019-07-24 19:19:49 +00:00
|
|
|
import os
|
|
|
|
import subprocess
|
|
|
|
|
|
|
|
CurrentPath = os.getcwd()
|
|
|
|
print(CurrentPath)
|
|
|
|
|
|
|
|
# Here goes the absolute path to your x86_64-mingw-w64 folder.
|
|
|
|
# There should be a \bin\gcc.exe relative to that folder.
|
|
|
|
GCC_FOLDER = ""
|
|
|
|
|
|
|
|
if os.path.exists('objects.list'):
|
|
|
|
os.remove("objects.list")
|
|
|
|
|
|
|
|
HFILES = "-Iinclude/ -Iinclude/reqs/ -Iinclude/bitfont/"
|
|
|
|
OBJECTS = ""
|
|
|
|
|
|
|
|
with open('c_files.txt') as file:
|
2019-07-24 20:50:26 +00:00
|
|
|
line = file.readline().strip()
|
2019-07-24 19:19:49 +00:00
|
|
|
while line:
|
2019-07-24 20:50:26 +00:00
|
|
|
line = line[:-2]
|
2019-07-24 19:19:49 +00:00
|
|
|
if line == "kernel\interrupts":
|
|
|
|
print(f'{HFILES}')
|
2019-07-24 20:50:26 +00:00
|
|
|
subprocess.run([f'{GCC_FOLDER}/bin/gcc.exe', '-ffreestanding', '-march=skylake', '-mgeneral-regs-only', '-fno-exceptions', '-fno-stack-protector', '-fno-stack-check', '-fno-strict-aliasing', '-fno-merge-all-constants', '-mno-stack-arg-probe', '-m64', '-mno-red-zone', '-maccumulate-outgoing-args', '--std=gnu11', '-Iinclude/', '-Iinclude/reqs', '-Iinclude/bitfont', '-Og', '-g3', '-Wall', '-Wextra', '-Wdouble-promotion', '-Wpedantic', '-fmessage-length=0', '-ffunction-sections', '-c', '-MMD', '-MP', f'-Wa,-adghlmns={line}.out', f'-MT{line}.o', '-o', f'{line}.o', f'{line}.c'], shell=True)
|
2019-07-24 19:19:49 +00:00
|
|
|
else:
|
|
|
|
print(f'{HFILES}')
|
2019-07-24 20:50:26 +00:00
|
|
|
subprocess.run([f'{GCC_FOLDER}/bin/gcc.exe', '-ffreestanding', '-march=skylake', '-mavx2', '-fno-exceptions', '-fno-stack-protector', '-fno-stack-check', '-fno-strict-aliasing', '-fno-merge-all-constants', '-mno-stack-arg-probe', '-m64', '-mno-red-zone', '-maccumulate-outgoing-args', '--std=gnu11', '-Iinclude/', '-Iinclude/reqs', '-Iinclude/bitfont', '-Og', '-g3', '-Wall', '-Wextra', '-Wdouble-promotion', '-Wpedantic', '-fmessage-length=0', '-ffunction-sections', '-c', '-MMD', '-MP', f'-Wa,-adghlmns={line}.out', f'-MT{line}.o', '-o', f'{line}.o', f'{line}.c'], shell=True)
|
|
|
|
OBJECTS = line + ".o "
|
|
|
|
|
|
|
|
os.path.normpath(OBJECTS)
|
|
|
|
|
2019-07-24 19:19:49 +00:00
|
|
|
|
|
|
|
with open('objects.list', 'a') as objectsfile:
|
2019-07-24 20:50:26 +00:00
|
|
|
ofile = OBJECTS.replace('\\', '/')
|
|
|
|
objectsfile.write(ofile + "\n")
|
2019-07-24 19:19:49 +00:00
|
|
|
|
2019-07-24 20:50:26 +00:00
|
|
|
line = file.readline().strip()
|
2019-07-24 19:19:49 +00:00
|
|
|
|
2019-07-24 20:50:26 +00:00
|
|
|
subprocess.run([f'{GCC_FOLDER}/bin/gcc.exe', "-march=skylake", "-mavx2", "-s", "-nostdlib", "-static-pie", "-Wl,--allow-multiple-definition", "-Wl,-e,kernel_main", "-Wl,--dynamicbase,--export-all-symbols", "-Wl,--subsystem,10", "-Wl,-Map=output.map", "-Wl,--gc-sections", "-o Sync.exe", "@objects.list"])
|