From e2a49516ec4b3edae7b8773eb915473007f67c99 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20GUEZO?= Date: Sun, 12 Oct 2025 19:21:47 +0200 Subject: [PATCH] feat: update minishell structure change rust language -> GNU Assembly add a Dockerfile to build on x64 linux also add Makefile pre config (must change) --- .github/workflows/rust.yml | 22 ---------------------- .gitignore | 31 +++++++++++++------------------ Cargo.lock | 7 ------- Cargo.toml | 6 ------ Dockerfile | 12 ++++++++++++ Makefile | 32 ++++++++++++++++++++++++++++++++ main | Bin 0 -> 8864 bytes src/main.rs | 3 --- src/main.s | 18 ++++++++++++++++++ 9 files changed, 75 insertions(+), 56 deletions(-) delete mode 100644 .github/workflows/rust.yml delete mode 100644 Cargo.lock delete mode 100644 Cargo.toml create mode 100644 Dockerfile create mode 100644 Makefile create mode 100755 main delete mode 100644 src/main.rs create mode 100644 src/main.s diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml deleted file mode 100644 index 9fd45e0..0000000 --- a/.github/workflows/rust.yml +++ /dev/null @@ -1,22 +0,0 @@ -name: Rust - -on: - push: - branches: [ "main" ] - pull_request: - branches: [ "main" ] - -env: - CARGO_TERM_COLOR: always - -jobs: - build: - - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v4 - - name: Build - run: cargo build --verbose - - name: Run tests - run: cargo test --verbose diff --git a/.gitignore b/.gitignore index ad67955..0267011 100644 --- a/.gitignore +++ b/.gitignore @@ -1,21 +1,16 @@ -# Generated by Cargo -# will have compiled files and executables -debug -target +*.o +*.out +*.bin +*.elf +*.exe +a.out -# These are backup files generated by rustfmt -**/*.rs.bk +*~ +*.swp -# MSVC Windows builds of rustc generate these, which store debugging information -*.pdb +.vscode/ +.idea/ +.env/ +.DS_Store -# Generated by cargo mutants -# Contains mutation testing data -**/mutants.out*/ - -# RustRover -# JetBrains specific template is maintained in a separate JetBrains.gitignore that can -# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore -# and can be added to the global gitignore or merged into this file. For a more nuclear -# option (not recommended) you can uncomment the following to ignore the entire idea folder. -#.idea/ +*.log \ No newline at end of file diff --git a/Cargo.lock b/Cargo.lock deleted file mode 100644 index f71a9b9..0000000 --- a/Cargo.lock +++ /dev/null @@ -1,7 +0,0 @@ -# This file is automatically @generated by Cargo. -# It is not intended for manual editing. -version = 4 - -[[package]] -name = "minishell" -version = "0.1.0" diff --git a/Cargo.toml b/Cargo.toml deleted file mode 100644 index 19eb27d..0000000 --- a/Cargo.toml +++ /dev/null @@ -1,6 +0,0 @@ -[package] -name = "minishell" -version = "0.1.0" -edition = "2024" - -[dependencies] diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..17691a2 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,12 @@ +# x86_64 build +FROM --platform=linux/amd64 debian:bookworm-slim + +RUN apt-get update -y \ + && apt-get install -y \ + binutils \ + make \ + && rm -rf /var/lib/apt/lists/* + +WORKDIR /app + +CMD ["make"] \ No newline at end of file diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..b07ac53 --- /dev/null +++ b/Makefile @@ -0,0 +1,32 @@ +TARGET ?= main + +SRC := $(wildcard src/*.s src/*.asm) +OBJ := $(SRC:.s=.o) +OBJ := $(OBJ:.asm=.o) + +AS = as +LD = ld +NASM = nasm + +ASFLAGS = +NASMFLAGS = -f elf64 +LDFLAGS = + +all: $(TARGET) run + +%.o: %.s + $(AS) $(ASFLAGS) -o $@ $< + +%.o: %.asm + $(NASM) $(NASMFLAGS) -o $@ $< + +$(TARGET): $(OBJ) + $(LD) $(LDFLAGS) -o $@ $^ + +clean: + rm -f $(OBJ) $(TARGET) + +re: clean all + +run: $(TARGET) + ./$(TARGET) diff --git a/main b/main new file mode 100755 index 0000000000000000000000000000000000000000..e2b17c09381683c6245886688511ced531820258 GIT binary patch literal 8864 zcmeI2Jxc>Y5QZn04^#{}3qjCggN0%dun;Un(kLnHEsqO1RJbINyFx2}f&VGkr1fVA zR_W~G%Tu)@$nnBd1Q>t>` zpt{YiEkiug3a76=rb?kRWR1EE{ha)Isz)x3R5efP8WJjs!cZ|RjuEx{?vuAmKZq+$@Ceh#fCHc!N>s;T=m&M5OO*UOxr&X*P%XH9)X?r_M*Jx`(?@2|5KYkN=R#kk3#lcF!L Tzr~U7>fenkIVdXKpj`g}J#0Mw literal 0 HcmV?d00001 diff --git a/src/main.rs b/src/main.rs deleted file mode 100644 index 2fe40a1..0000000 --- a/src/main.rs +++ /dev/null @@ -1,3 +0,0 @@ -fn main() { - println!("hello world!"); -} diff --git a/src/main.s b/src/main.s new file mode 100644 index 0000000..3361513 --- /dev/null +++ b/src/main.s @@ -0,0 +1,18 @@ +.global _start + +.section .data +msg: + .ascii "Hello World!\n" +len = . - msg + +.section .text +_start: + mov $1, %rax + mov $1, %rdi + lea msg(%rip), %rsi + mov $len, %rdx + syscall + + mov $60, %rax + xor %rdi, %rdi + syscall