Rework first line, add build number based on git hash, move 32/64b info to build number, add githash.h to git ignore. A better implementation of Makefile is needed (check if git is present and avoid rebuild (APP)*.c if hash is the same

This commit is contained in:
Sam Demeulemeester 2022-04-07 01:48:27 +02:00 committed by Sam Demeulemeester
parent faa0252e9c
commit 5f92ff1a64
4 changed files with 25 additions and 8 deletions

3
.gitignore vendored
View File

@ -20,3 +20,6 @@ memtest_shared.bin
grub-iso
html
latex
# hash file
githash.h

View File

@ -21,6 +21,7 @@
#include "config.h"
#include "error.h"
#include "githash.h"
#include "tests.h"
@ -76,13 +77,9 @@ void display_init(void)
set_foreground_colour(BLACK);
set_background_colour(WHITE);
clear_screen_region(0, 0, 0, 27);
#if TESTWORD_WIDTH > 32
prints(0, 0, " Memtest86+ v6.00pre (64b)");
#else
prints(0, 0, " Memtest86+ v6.00pre (32b)");
#endif
prints(0, 0, " Memtest86+ v6.00b1");
set_foreground_colour(RED);
printc(0, 11, '+');
printc(0, 14, '+');
set_foreground_colour(WHITE);
set_background_colour(BLUE);
prints(0,28, "| ");
@ -118,6 +115,13 @@ void display_init(void)
set_background_colour(WHITE);
clear_screen_region(ROW_FOOTER, 0, ROW_FOOTER, SCREEN_WIDTH - 1);
prints(ROW_FOOTER, 0, " <ESC> exit <F1> configuration <Space> scroll lock");
prints(ROW_FOOTER, 64, "6.00.");
prints(ROW_FOOTER, 69, GIT_HASH);
#if TESTWORD_WIDTH > 32
prints(ROW_FOOTER, 76, ".x64");
#else
prints(ROW_FOOTER, 76, ".x32");
#endif
set_foreground_colour(WHITE);
set_background_colour(BLUE);

View File

@ -95,10 +95,15 @@ tests/%.o: ../tests/%.c
@mkdir -p tests
$(CC) -c $(CFLAGS) -O3 $(INC_DIRS) -o $@ $< -MMD -MP -MT $@ -MF $(@:.o=.d)
app/%.o: ../app/%.c
app/%.o: ../app/%.c githash.h
@mkdir -p app
$(CC) -c $(CFLAGS) -Os $(INC_DIRS) -o $@ $< -MMD -MP -MT $@ -MF $(@:.o=.d)
githash.h:
echo -n '#ifndef GIT_HASH\n#define GIT_HASH "' > ../app/$@ && \
git rev-parse HEAD | cut -c1-7 | tr -d "\n" >> ../app/$@ && \
echo '"\n#endif' >> ../app/$@
# Link it statically once so I know I don't have undefined symbols and
# then link it dynamically so I have full relocation information.

View File

@ -94,10 +94,15 @@ tests/%.o: ../tests/%.c
@mkdir -p tests
$(CC) -c $(CFLAGS) -O3 $(INC_DIRS) -o $@ $< -MMD -MP -MT $@ -MF $(@:.o=.d)
app/%.o: ../app/%.c
app/%.o: ../app/%.c githash.h
@mkdir -p app
$(CC) -c $(CFLAGS) -Os $(INC_DIRS) -o $@ $< -MMD -MP -MT $@ -MF $(@:.o=.d)
githash.h:
echo -n '#ifndef GIT_HASH\n#define GIT_HASH "' > ../app/$@ && \
git rev-parse HEAD | cut -c1-7 | tr -d "\n" >> ../app/$@ && \
echo '"\n#endif' >> ../app/$@
# Link it statically once so I know I don't have undefined symbols and
# then link it dynamically so I have full relocation information.