mirror of
https://github.com/guezoloic/minishell.git
synced 2026-01-25 09:34:22 +00:00
feat: update minishell structure
change rust language -> GNU Assembly add a Dockerfile to build on x64 linux also add Makefile pre config (must change)
This commit is contained in:
22
.github/workflows/rust.yml
vendored
22
.github/workflows/rust.yml
vendored
@@ -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
|
||||
31
.gitignore
vendored
31
.gitignore
vendored
@@ -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
|
||||
7
Cargo.lock
generated
7
Cargo.lock
generated
@@ -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"
|
||||
@@ -1,6 +0,0 @@
|
||||
[package]
|
||||
name = "minishell"
|
||||
version = "0.1.0"
|
||||
edition = "2024"
|
||||
|
||||
[dependencies]
|
||||
12
Dockerfile
Normal file
12
Dockerfile
Normal file
@@ -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"]
|
||||
32
Makefile
Normal file
32
Makefile
Normal file
@@ -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)
|
||||
@@ -1,3 +0,0 @@
|
||||
fn main() {
|
||||
println!("hello world!");
|
||||
}
|
||||
18
src/main.s
Normal file
18
src/main.s
Normal file
@@ -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
|
||||
Reference in New Issue
Block a user