Browse Source

bincows programs

master
Mathieu Serandour 9 months ago
parent
commit
b134099a9e
  1. 21
      programs/Makefile
  2. 14
      programs/prog0.c

21
programs/Makefile

@ -0,0 +1,21 @@
.PHONY: all
CC := x86_64-elf-gcc
CFLAGS := -O0 -fno-inline -mno-red-zone -mgeneral-regs-only \
-ffreestanding
CFILES :=$(shell find -name "*.c")
EFILES := $(CFILES:.c=.elf)
all: $(EFILES)
cp *.elf ../disk_root/bin/
%.elf: %.c
$(CC) $(CFLAGS) -c $< -o $@
clean:
rm -rf *.s *.elf

14
programs/prog0.c

@ -0,0 +1,14 @@
int x = 8;
int fibo(int v) {
if(v < 2)
return v;
else
return fibo(v - 1);
}
int main(int argc, char** argv) {
return fibo(x);
}
Loading…
Cancel
Save