summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorDanny Holman <dholman@gymli.xyz>2021-06-04 17:16:36 -0500
committerDanny Holman <dholman@gymli.xyz>2021-06-04 17:16:36 -0500
commit39b8db42c6660abaa161acb6064093fc8f00f7f5 (patch)
tree333e8da9a3abd572c2d5004f2e24e34e7e9e0a9f /Makefile
parent11e6fe504c56e47b5cb8c9937322131dd9832e76 (diff)
Makefile: clean up targets
Clean up the Makefile to be more clear and readable. Signed-off-by: Danny Holman <dholman@gymli.xyz>
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile19
1 files 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: