2018-12-12 10:14:31 +01:00
|
|
|
CC=gcc -O0 -g -nostdinc -ffreestanding -fno-builtin -Wall -w -m32 -I ./include -fno-pie -no-pie -c -o
|
2018-12-09 13:44:32 +01:00
|
|
|
LINK=ld -m elf_i386 -T linker.lds -n -o
|
|
|
|
SRCS= $(wildcard *.c)
|
|
|
|
EXECS= $(SRCS:.c=)
|
2018-12-12 12:31:30 +01:00
|
|
|
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
|
2020-09-17 16:37:16 +02:00
|
|
|
CHANGEEXE=chmod 755
|
2019-01-19 16:23:57 +01:00
|
|
|
MOVE=mv
|
2020-09-17 09:52:56 +02:00
|
|
|
SYNC=sync
|
|
|
|
MAKE=make -C
|
2018-12-09 13:44:32 +01:00
|
|
|
|
2019-01-19 16:23:57 +01:00
|
|
|
all: lib/libs.a ../final/initram.img
|
2020-09-17 09:52:56 +02:00
|
|
|
$(SYNC)
|
2018-12-12 12:31:30 +01:00
|
|
|
|
2018-12-12 12:37:19 +01:00
|
|
|
togit: clean indent
|
2018-12-09 13:44:32 +01:00
|
|
|
|
2019-01-19 16:23:57 +01:00
|
|
|
../final/initram.img: $(EXECS)
|
2020-09-17 16:37:16 +02:00
|
|
|
(find . -maxdepth 1 -type f ! -name makefile -perm /u=x -exec $(MOVE) {} ../final/cramfs/executables/ \;;true)
|
2019-01-19 16:23:57 +01:00
|
|
|
mkcramfs ../final/cramfs/ ../final/initram.img
|
|
|
|
|
2018-12-09 13:44:32 +01:00
|
|
|
lib/libs.a:
|
2020-09-17 09:52:56 +02:00
|
|
|
$(MAKE) lib
|
2018-12-09 13:44:32 +01:00
|
|
|
|
|
|
|
%: %.c
|
|
|
|
$(CC) $@.o $<
|
|
|
|
$(LINK) $@ $@.o lib/libs.a
|
2020-09-17 16:37:16 +02:00
|
|
|
$(CHANGEEXE) $@
|
2018-12-12 12:31:30 +01:00
|
|
|
$(CHANGELF) $@
|
2018-12-09 13:44:32 +01:00
|
|
|
|
|
|
|
clean:
|
|
|
|
make -C lib clean
|
2018-12-12 12:31:30 +01:00
|
|
|
$(REMOVE) *.o
|
|
|
|
$(REMOVE) *.c~
|
2020-09-17 16:37:16 +02:00
|
|
|
(find ../final/cramfs/executables -maxdepth 1 -type f ! -name makefile -perm /u=x -exec $(REMOVE) {} \;;true)
|
|
|
|
(find . -maxdepth 1-type f ! -name makefile -perm /u=x -exec $(REMOVE) {} \;;true)
|
2020-09-17 09:52:56 +02:00
|
|
|
$(SYNC)
|
2018-12-09 13:44:32 +01:00
|
|
|
|
|
|
|
indent:
|
2020-09-17 09:52:56 +02:00
|
|
|
$(MAKE) lib indent
|
2018-12-12 12:31:30 +01:00
|
|
|
$(CHANGEPERM) *.c
|
|
|
|
$(CONVERT) *.c
|
|
|
|
$(INDENT) *.c
|
2018-12-12 12:37:19 +01:00
|
|
|
$(REMOVE) *.c~
|
2020-09-17 09:52:56 +02:00
|
|
|
$(SYNC)
|
|
|
|
|