aboutsummaryrefslogtreecommitdiffstats
path: root/src/glutt-o-logique/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'src/glutt-o-logique/Makefile')
-rw-r--r--src/glutt-o-logique/Makefile20
1 files changed, 15 insertions, 5 deletions
diff --git a/src/glutt-o-logique/Makefile b/src/glutt-o-logique/Makefile
index ddfd4fd..0febb9c 100644
--- a/src/glutt-o-logique/Makefile
+++ b/src/glutt-o-logique/Makefile
@@ -14,8 +14,8 @@ BINDIR=bin
SRCDIR=.
ASOURCES=$(shell find -L $(SRCDIR) -name '*.s')
-CSOURCES+=$(shell find -L $(SRCDIR) -name '*.c')
-HEADERS=$(shell find -L $(SRCDIR) -name '*.h')
+CSOURCES+=$(shell find -L $(SRCDIR) -name '*.c' -not -name 'vc.c')
+HEADERS=$(shell find -L $(SRCDIR) -name '*.h' -not -name 'vc.h')
COMMON_DIR=../common
COMMON_SOURCE_LIST=$(shell cat ../common/sourcelist.txt)
@@ -29,6 +29,8 @@ INCLUDES=$(INC:%=-I%)
OBJECTS=$(CSOURCES:%.c=obj/%.o)
OBJECTS+=$(ASOURCES:%.s=obj/%.o)
+OBJECTS+=obj/vc.o
+
# Define output files ELF & IHEX
BINELF=outp.elf
BINHEX=outp.hex
@@ -124,13 +126,18 @@ $(BINDIR)/$(BINHEX): $(BINDIR)/$(BINELF)
@echo "[CP] $@"
@echo "[:)] Happiness :)"
-$(BINDIR)/$(BINELF): vc.h $(OBJECTS)
+$(BINDIR)/$(BINELF): $(OBJECTS)
@$(CC) $(LDFLAGS) $(OBJECTS) -o $@ -lm
- @echo "[CC] $@"
+ @echo "[LINK] $@"
@$(SIZE) $(BINDIR)/$(BINELF)
dir_guard=@mkdir -p $(@D)
+obj/vc.o: vc.c vc.h $(HEADERS)
+ $(dir_guard)
+ @echo "[CC] version information vc.c"
+ @$(CC) $(CFLAGS) vc.c -o obj/vc.o
+
obj/%.o: %.c $(HEADERS)
$(dir_guard)
@echo "[CC] $<"
@@ -141,13 +148,16 @@ obj/%.o: %.s $(HEADERS)
@echo [AS] $<
@$(CC) $(CFLAGS) $< -o $@
+.PHONY: vc.h
vc.h: ../../.git/logs/HEAD
@echo "// This file is generated by Makefile." > vc.h
@echo "// Do not edit this file!" >> vc.h
+ @echo "const char* vc_get_version(void);" >> vc.h
+ @echo >> vc.h
@git log -1 --format="format:#define GIT_VERSION \"%h\"" >> vc.h
@echo >> vc.h
@echo >> vc.h
- @echo [EC] vc.h
+ @echo [GEN] vc.h
clean:
@rm -f $(OBJECTS) $(BINDIR)/$(BINELF) $(BINDIR)/$(BINHEX)