diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..e69de29 diff --git a/README.md b/README.md index de0c87e..98b325b 100644 --- a/README.md +++ b/README.md @@ -20,5 +20,3 @@ Rules: * Please provide an adequate entry in the Wiki for each non-trivial code contribution. For additional information, please refer to the [Wiki](https://gitea.dmz.rs/sborovic/dmzOS/wiki). - -TEST \ No newline at end of file diff --git a/TOOLCHAIN.md b/TOOLCHAIN.md new file mode 100644 index 0000000..9970aaa --- /dev/null +++ b/TOOLCHAIN.md @@ -0,0 +1,18 @@ +# Instruction on running utilities + +## c_toolchain utility docker image + +Dockerfile: `dockerfile.c_toolchain` +Run the docker-compose command to get a `bash` shell that is bound to the `dmzOS` directory: +```bash +docker-compose run --rm c_toolchain +``` + +Any changes in the container shell will be reflected in the local `dmzOS` directory. + +The image contains `ident` abd `clang-format` as `C` code formatters. A .vimrc file is automatically part of the image, and it contains a rule to make vim run the following formatting command on buffer save: +```bash +ident -kr -ts4 % +``` + +This is using the Kernighan and Ritchie code styling, as well as identations with 4 spaces. diff --git a/config/.vimrc b/config/.vimrc new file mode 100644 index 0000000..7862ea2 --- /dev/null +++ b/config/.vimrc @@ -0,0 +1,7 @@ +set nobackup +set nowritebackup +set noswapfile +set autoread + +set number relativenumber +autocmd BufWritePost *.[ch] exec "!indent -kr -nut % && rm %~" diff --git a/dmzOS/test/clang_test b/dmzOS/test/clang_test new file mode 100755 index 0000000..f465671 Binary files /dev/null and b/dmzOS/test/clang_test differ diff --git a/dmzOS/test/gcc_test b/dmzOS/test/gcc_test new file mode 100755 index 0000000..c246334 Binary files /dev/null and b/dmzOS/test/gcc_test differ diff --git a/dmzOS/test/test.c b/dmzOS/test/test.c new file mode 100644 index 0000000..4c8ec23 --- /dev/null +++ b/dmzOS/test/test.c @@ -0,0 +1,12 @@ +#include +#include + +int main(int argc, char *argv[]) +{ + if (argc < 2) { + printf("Please provide at least one argument\n"); + exit(1); + }; + printf("Hello, C!\n"); + return 0; +} diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..6caf9e9 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,12 @@ +version: '3.8' + +services: + c_toolchain: + build: + context: ./ + dockerfile: dockerfile.c_toolchain + container_name: c_toolchain + tty: true + stdin_open: true + volumes: + - ./dmzOS:/dmzOS diff --git a/dockerfile.c_toolchain b/dockerfile.c_toolchain new file mode 100644 index 0000000..85002ff --- /dev/null +++ b/dockerfile.c_toolchain @@ -0,0 +1,6 @@ +FROM ubuntu:18.04 +RUN apt-get update && apt-get install -y vim gcc indent clang clang-format gdb binutils +WORKDIR /dmzOS +#Getting prebuilt binary from llvm +COPY ./config/* /root +ENTRYPOINT [ "bash" ]