From 39b8db42c6660abaa161acb6064093fc8f00f7f5 Mon Sep 17 00:00:00 2001 From: Danny Holman Date: Fri, 4 Jun 2021 17:16:36 -0500 Subject: Makefile: clean up targets Clean up the Makefile to be more clear and readable. Signed-off-by: Danny Holman --- Makefile | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/Makefile b/Makefile index 9008374..9ce287d 100644 --- a/Makefile +++ b/Makefile @@ -1,13 +1,16 @@ CC=i686-elf-gcc -INCLUDE?=include -CFLAGS?=-O2 -g -LDFLAGS?= -LIBS?= +INCLUDE?=-Iinclude +CFLAGS?=-O2 -ffreestanding -std=gnu11 +LDFLAGS?=-nostdlib +LIBS?=-lgcc +# -- Do not edit below this line -- + +VERSION:="$(shell git describe --abbrev=4 --dirty --always --tags)" INCLUDE:=$(INCLUDE) -CFLAGS:=$(CFLAGS) -ffreestanding -Wall -Wextra -I$(INCLUDE) +CFLAGS:=$(CFLAGS) -Wall -Wextra -DVERSION=\"$(VERSION)\" -ggdb LDFLAGS:=$(LDFLAGS) -LIBS:=$(LIBS) -nostdlib -lgcc +LIBS:=$(LIBS) ARCHDIR=arch/i386 @@ -51,11 +54,11 @@ $(ARCHDIR)/crtbegin.o $(ARCHDIR)/crtend.o: @OBJ=`$(CC) $(CFLAGS) $(LDFLAGS) -print-file-name=$(@F)` && cp "$$OBJ" $@ .c.o: - @$(CC) -MD -c $< -o $@ -std=gnu11 $(CFLAGS) + @$(CC) -MD -c $< -o $@ $(CFLAGS) $(INCLUDE) @echo [CC] $@ .s.o: - @$(CC) -MD -c $< -o $@ $(CFLAGS) + @$(CC) -MD -c $< -o $@ $(CFLAGS) $(INCLUDE) @echo [AS] $@ clean: -- cgit v1.2.3