From 6cdfbcdd28d774ed2126c8f09513727400c91fda Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20Hord=C3=A9?= Date: Wed, 12 Dec 2018 12:31:30 +0100 Subject: [PATCH] =?UTF-8?q?build:=20mise=20=C3=A0=20jour=20des=20makefile?= =?UTF-8?q?=20pour=20indent=20correct=20et=20permissions/format=20harmonis?= =?UTF-8?q?=C3=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/makefile | 31 +++++++++++++++++++++++-------- makefile | 9 +++++++++ programs/lib/makefile | 24 ++++++++++++++++++------ programs/makefile | 25 +++++++++++++++++++------ system/makefile | 30 ++++++++++++++++++++---------- 5 files changed, 89 insertions(+), 30 deletions(-) diff --git a/lib/makefile b/lib/makefile index e76ea7e..4856148 100755 --- a/lib/makefile +++ b/lib/makefile @@ -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 SRCS= $(wildcard *.c) 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) $(LINK) libs.o $(OBJS) @@ -14,10 +19,20 @@ libs.o:$(OBJS) $(CC) $^ clean: - rm -f *.o - rm -f *.c~ - rm -f ./VGA/*.c~ + $(REMOVE) *.o + $(REMOVE) *.c~ + $(REMOVE) */*.c~ + $(REMOVE) ../include/*.h~ + sync -indent: - indent -linux -i8 -ts8 *.c - indent -linux -i8 -ts8 ./VGA/*.c +indent: + $(CHANGEPERM) *.c + $(CONVERT) *.c + $(INDENT) *.c + $(CHANGEPERM) ./*/*.c + $(CONVERT) ./*/*.c + $(INDENT) ./*/*.c + $(CHANGEPERM) ../include/*.h + $(CONVERT) ../include/*.h + $(INDENT) ../include/*.h + sync diff --git a/makefile b/makefile index bda55a4..084484b 100755 --- a/makefile +++ b/makefile @@ -21,6 +21,14 @@ uefi: final/harddiskuefi.img.final install: (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: make -C system clean make -C lib clean @@ -38,6 +46,7 @@ littleclean: indent: make -C system indent make -C lib indent + make -C programs indent sync backup: clean diff --git a/programs/lib/makefile b/programs/lib/makefile index 4b08c3c..64c2a95 100644 --- a/programs/lib/makefile +++ b/programs/lib/makefile @@ -3,10 +3,15 @@ LINK=ld -m elf_i386 -r -o SRCS= $(wildcard *.c) OBJS= $(SRCS:.c=.o) 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 $(ARCH) $@ $^ @@ -18,9 +23,16 @@ libs.o:$(OBJS) $(CC) $^ clean: - rm -f *.o - rm -f *.c~ - rm -f *.a + $(REMOVE) *.o + $(REMOVE) *.c~ + $(REMOVE) *.a + sync indent: - indent -linux -i8 -ts8 *.c + $(CHANGEPERM) *.c + $(CONVERT) *.c + $(INDENT) *.c + $(CHANGEPERM) ../include/*.h + $(CONVERT) ../include/*.h + $(INDENT) ../include/*.h + sync diff --git a/programs/makefile b/programs/makefile index 610d29b..5fbbb1e 100755 --- a/programs/makefile +++ b/programs/makefile @@ -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 SRCS= $(wildcard *.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) + sync + +togit: clean indent clean lib/libs.a: make -C lib @@ -11,14 +19,19 @@ lib/libs.a: %: %.c $(CC) $@.o $< $(LINK) $@ $@.o lib/libs.a - chmod 644 $@ - elfedit --output-osabi FenixOS $@ + $(CHANGEPERM) $@ + $(CHANGELF) $@ clean: make -C lib clean - rm -f *.o - rm -f *.c~ - find . -type f ! -perm /u=x -maxdepth 1 -regex '.+/\.?[^\.]+' -exec rm {} \; + $(REMOVE) *.o + $(REMOVE) *.c~ + find . -type f ! -perm /u=x -maxdepth 1 -regex '.+/\.?[^\.]+' -exec $(REMOVE) {} \; + sync indent: - indent -linux -i8 -ts8 *.c + make -C lib indent + $(CHANGEPERM) *.c + $(CONVERT) *.c + $(INDENT) *.c + sync diff --git a/system/makefile b/system/makefile index da424b4..90dfa82 100755 --- a/system/makefile +++ b/system/makefile @@ -1,10 +1,16 @@ 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 +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 sync +togit: clean indent clean + 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 multiboot.o: - $(ASM) -f elf -o multiboot.o multiboot.asm -dVESA=$(VESA) + $(ASM) multiboot.o multiboot.asm -dVESA=$(VESA) clean: - rm -f *.o - rm -f *.out - rm -f *.bin - rm -f *.sys - rm -f *.s - rm -f *.c~ + $(REMOVE) *.o + $(REMOVE) *.out + $(REMOVE) *.bin + $(REMOVE) *.sys + $(REMOVE) *.s + $(REMOVE) *.c~ + sync -indent: - indent -linux -i8 -ts8 *.c +indent: + $(CHANGEPERM) *.c + $(CONVERT) *.c + $(INDENT) *.c + sync