First build system
First draft of a build system. This will run the hello function from our library.
This commit is contained in:
23
quantum/build.sh
Executable file
23
quantum/build.sh
Executable file
@@ -0,0 +1,23 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# Build script for quantum
|
||||
|
||||
set echo on
|
||||
|
||||
mkdir -p build/
|
||||
|
||||
# Get a list of all the .c files.
|
||||
cFilenames=$(find . -type f -name "*.c")
|
||||
|
||||
assembly="quantum"
|
||||
objLocation="build/libquantum.o"
|
||||
compilerFlags="-g -c -fpic"
|
||||
includeFlags="-Isrc"
|
||||
|
||||
echo "Building $assembly..."
|
||||
|
||||
# First we need to compile down to .o files
|
||||
gcc $cFilenames $compilerFlags -o $objLocation $includeFlags
|
||||
|
||||
compilerFlags="-g -shared"
|
||||
gcc $objLocation $compilerFlags -o ../bin/libquantum.so $includeFlags
|
||||
5
quantum/src/test.c
Normal file
5
quantum/src/test.c
Normal file
@@ -0,0 +1,5 @@
|
||||
#include <stdio.h>
|
||||
|
||||
#include "test.h"
|
||||
|
||||
void hello_quantum() { printf("Hello from Quantum!\n"); }
|
||||
1
quantum/src/test.h
Normal file
1
quantum/src/test.h
Normal file
@@ -0,0 +1 @@
|
||||
void hello_quantum();
|
||||
Reference in New Issue
Block a user