build: mise à jour des makefile pour indent correct et permissions/format harmonisé

This commit is contained in:
Nicolas Hordé 2018-12-12 12:31:30 +01:00
parent 524af1729c
commit 6cdfbcdd28
5 changed files with 89 additions and 30 deletions

View File

@ -2,10 +2,15 @@ CC=gcc -O0 -g -nostdinc -ffreestanding -fno-builtin -Wall -w -m32 -F elf_i386 -f
LINK=ld -m elf_i386 -r -o LINK=ld -m elf_i386 -r -o
SRCS= $(wildcard *.c) SRCS= $(wildcard *.c)
OBJS= $(SRCS:.c=.o) OBJS= $(SRCS:.c=.o)
CONVERT=dos2unix
INDENT=indent -nhnl -l75 -ppi3 -ts8 -bls -nbc -di8 -nbad -nbap -nsob -i8 -bl -bli0 -ncdw -nce -cli8 -cbi0 -npcs -cs -saf -sai -saw -nprs -lp -npsl
REMOVE=rm -f
CHANGEPERM=chmod 644
all: makeall all: libs.o
sync
makeall: libs.o togit: clean indent clean
libs.o:$(OBJS) libs.o:$(OBJS)
$(LINK) libs.o $(OBJS) $(LINK) libs.o $(OBJS)
@ -14,10 +19,20 @@ libs.o:$(OBJS)
$(CC) $^ $(CC) $^
clean: clean:
rm -f *.o $(REMOVE) *.o
rm -f *.c~ $(REMOVE) *.c~
rm -f ./VGA/*.c~ $(REMOVE) */*.c~
$(REMOVE) ../include/*.h~
sync
indent: indent:
indent -linux -i8 -ts8 *.c $(CHANGEPERM) *.c
indent -linux -i8 -ts8 ./VGA/*.c $(CONVERT) *.c
$(INDENT) *.c
$(CHANGEPERM) ./*/*.c
$(CONVERT) ./*/*.c
$(INDENT) ./*/*.c
$(CHANGEPERM) ../include/*.h
$(CONVERT) ../include/*.h
$(INDENT) ../include/*.h
sync

View File

@ -21,6 +21,14 @@ uefi: final/harddiskuefi.img.final
install: install:
(sudo apt-get install nasm gcc qemu fusefat fuseext2 cgdb ovmf bsdmainutils tar bsdmainutils indent binutils bochs bochs-x bochsbios) (sudo apt-get install nasm gcc qemu fusefat fuseext2 cgdb ovmf bsdmainutils tar bsdmainutils indent binutils bochs bochs-x bochsbios)
togit:
make -C system togit
make -C lib togit
make -C final togit
make -C programs togit
git status
sync
clean: clean:
make -C system clean make -C system clean
make -C lib clean make -C lib clean
@ -38,6 +46,7 @@ littleclean:
indent: indent:
make -C system indent make -C system indent
make -C lib indent make -C lib indent
make -C programs indent
sync sync
backup: clean backup: clean

View File

@ -3,10 +3,15 @@ LINK=ld -m elf_i386 -r -o
SRCS= $(wildcard *.c) SRCS= $(wildcard *.c)
OBJS= $(SRCS:.c=.o) OBJS= $(SRCS:.c=.o)
ARCH=ar rcs ARCH=ar rcs
CONVERT=dos2unix
INDENT=indent -nhnl -l75 -ppi3 -ts8 -bls -nbc -di8 -nbad -nbap -nsob -i8 -bl -bli0 -ncdw -nce -cli8 -cbi0 -npcs -cs -saf -sai -saw -nprs -lp -npsl
REMOVE=rm -f
CHANGEPERM=chmod 644
all: makeall all: libs.a
sync
makeall: libs.a togit: clean indent clean
libs.a:libs.o libs.a:libs.o
$(ARCH) $@ $^ $(ARCH) $@ $^
@ -18,9 +23,16 @@ libs.o:$(OBJS)
$(CC) $^ $(CC) $^
clean: clean:
rm -f *.o $(REMOVE) *.o
rm -f *.c~ $(REMOVE) *.c~
rm -f *.a $(REMOVE) *.a
sync
indent: indent:
indent -linux -i8 -ts8 *.c $(CHANGEPERM) *.c
$(CONVERT) *.c
$(INDENT) *.c
$(CHANGEPERM) ../include/*.h
$(CONVERT) ../include/*.h
$(INDENT) ../include/*.h
sync

View File

@ -2,8 +2,16 @@ CC=gcc -O0 -g -nostdinc -ffreestanding -fno-builtin -Wall -w -m32 -I ./include -
LINK=ld -m elf_i386 -T linker.lds -n -o LINK=ld -m elf_i386 -T linker.lds -n -o
SRCS= $(wildcard *.c) SRCS= $(wildcard *.c)
EXECS= $(SRCS:.c=) EXECS= $(SRCS:.c=)
CONVERT=dos2unix
INDENT=indent -nhnl -l75 -ppi3 -ts8 -bls -nbc -di8 -nbad -nbap -nsob -i8 -bl -bli0 -ncdw -nce -cli8 -cbi0 -npcs -cs -saf -sai -saw -nprs -lp -npsl
REMOVE=rm -f
CHANGELF=elfedit --output-osabi FenixOS
CHANGEPERM=chmod 644
all: lib/libs.a $(EXECS) all: lib/libs.a $(EXECS)
sync
togit: clean indent clean
lib/libs.a: lib/libs.a:
make -C lib make -C lib
@ -11,14 +19,19 @@ lib/libs.a:
%: %.c %: %.c
$(CC) $@.o $< $(CC) $@.o $<
$(LINK) $@ $@.o lib/libs.a $(LINK) $@ $@.o lib/libs.a
chmod 644 $@ $(CHANGEPERM) $@
elfedit --output-osabi FenixOS $@ $(CHANGELF) $@
clean: clean:
make -C lib clean make -C lib clean
rm -f *.o $(REMOVE) *.o
rm -f *.c~ $(REMOVE) *.c~
find . -type f ! -perm /u=x -maxdepth 1 -regex '.+/\.?[^\.]+' -exec rm {} \; find . -type f ! -perm /u=x -maxdepth 1 -regex '.+/\.?[^\.]+' -exec $(REMOVE) {} \;
sync
indent: indent:
indent -linux -i8 -ts8 *.c make -C lib indent
$(CHANGEPERM) *.c
$(CONVERT) *.c
$(INDENT) *.c
sync

View File

@ -1,10 +1,16 @@
GCC=gcc -O0 -g -nostdinc -ffreestanding -fno-builtin -Wall -w -I ../include -m32 -fno-pie -no-pie -c -o GCC=gcc -O0 -g -nostdinc -ffreestanding -fno-builtin -Wall -w -I ../include -m32 -fno-pie -no-pie -c -o
ASM=nasm ASM=nasm -f elf -o
LINK=ld -m elf_i386 -T linker.lds -n -o LINK=ld -m elf_i386 -T linker.lds -n -o
CONVERT=dos2unix
INDENT=indent -nhnl -l75 -ppi3 -ts8 -bls -nbc -di8 -nbad -nbap -nsob -i8 -bl -bli0 -ncdw -nce -cli8 -cbi0 -npcs -cs -saf -sai -saw -nprs -lp -npsl
REMOVE=rm -f
CHANGEPERM=chmod 644
all: system.sys all: system.sys
sync sync
togit: clean indent clean
system.sys: multiboot.o system.o ../lib/libs.o system.sys: multiboot.o system.o ../lib/libs.o
$(LINK) system.sys multiboot.o system.o ../lib/libs.o $(LINK) system.sys multiboot.o system.o ../lib/libs.o
@ -12,15 +18,19 @@ system.o:
$(GCC) system.o system.c $(GCC) system.o system.c
multiboot.o: multiboot.o:
$(ASM) -f elf -o multiboot.o multiboot.asm -dVESA=$(VESA) $(ASM) multiboot.o multiboot.asm -dVESA=$(VESA)
clean: clean:
rm -f *.o $(REMOVE) *.o
rm -f *.out $(REMOVE) *.out
rm -f *.bin $(REMOVE) *.bin
rm -f *.sys $(REMOVE) *.sys
rm -f *.s $(REMOVE) *.s
rm -f *.c~ $(REMOVE) *.c~
sync
indent: indent:
indent -linux -i8 -ts8 *.c $(CHANGEPERM) *.c
$(CONVERT) *.c
$(INDENT) *.c
sync