Compare commits
2 Commits
57e8c4a499
...
b24d97213e
Author | SHA1 | Date | |
---|---|---|---|
b24d97213e | |||
97af579397
|
3
.gitignore
vendored
3
.gitignore
vendored
@@ -1,2 +1,5 @@
|
|||||||
bbs
|
bbs
|
||||||
build/
|
build/
|
||||||
|
|
||||||
|
# Machine generated files:
|
||||||
|
src/version.c
|
||||||
|
13
Makefile
13
Makefile
@@ -3,7 +3,10 @@
|
|||||||
# Makefile for Amber's BBS Interface
|
# Makefile for Amber's BBS Interface
|
||||||
# Buildsys by Gale Faraday
|
# Buildsys by Gale Faraday
|
||||||
|
|
||||||
.PHONY: all clean run
|
# `generate` must be called before `all` to build version information and other
|
||||||
|
# machine generated files.
|
||||||
|
|
||||||
|
.PHONY: all clean run generate
|
||||||
.SUFFIXES:
|
.SUFFIXES:
|
||||||
|
|
||||||
.DEFAULT_GOAL := all
|
.DEFAULT_GOAL := all
|
||||||
@@ -11,6 +14,7 @@
|
|||||||
TARGET := $(shell basename $(CURDIR))
|
TARGET := $(shell basename $(CURDIR))
|
||||||
SOURCES := src/
|
SOURCES := src/
|
||||||
BUILD := build/
|
BUILD := build/
|
||||||
|
GENABLES := $(SOURCES)version.c
|
||||||
OBJS := $(patsubst $(SOURCES)%.c,$(BUILD)%.o,$(wildcard $(SOURCES)*.c))
|
OBJS := $(patsubst $(SOURCES)%.c,$(BUILD)%.o,$(wildcard $(SOURCES)*.c))
|
||||||
EXECUTABLE := $(TARGET)
|
EXECUTABLE := $(TARGET)
|
||||||
|
|
||||||
@@ -27,7 +31,12 @@ run: $(EXECUTABLE)
|
|||||||
|
|
||||||
.IGNORE: clean
|
.IGNORE: clean
|
||||||
clean:
|
clean:
|
||||||
@rm -rvf $(BUILD) $(EXECUTABLE)
|
@rm -rvf $(BUILD) $(EXECUTABLE) $(GENABLES)
|
||||||
|
|
||||||
|
generate: $(GENABLES)
|
||||||
|
|
||||||
|
$(GENABLES): genver.sh
|
||||||
|
./genver.sh
|
||||||
|
|
||||||
$(EXECUTABLE): $(OBJS)
|
$(EXECUTABLE): $(OBJS)
|
||||||
$(LD) $(LDFLAGS) -o $@ $^
|
$(LD) $(LDFLAGS) -o $@ $^
|
||||||
|
17
genver.sh
Executable file
17
genver.sh
Executable file
@@ -0,0 +1,17 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
# Script to generate version information file
|
||||||
|
|
||||||
|
# Current git tag
|
||||||
|
TAG="$(git describe --always --dirty --tags)"
|
||||||
|
|
||||||
|
# Output filename
|
||||||
|
OUTFILE='src/version.c'
|
||||||
|
|
||||||
|
sed -e "s/<HASH>/$TAG/g" <<EOF > "$OUTFILE"
|
||||||
|
/* Build version information. This file generated by genver.sh */
|
||||||
|
|
||||||
|
const char GIT_HASH[] = "<HASH>";
|
||||||
|
const char CC_VERSION[] = __VERSION__;
|
||||||
|
const char BUILD_DATE[] = __DATE__;
|
||||||
|
EOF
|
5
src/version.h
Normal file
5
src/version.h
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
/* Header for version information constants */
|
||||||
|
|
||||||
|
extern const char GIT_HASH[];
|
||||||
|
extern const char CC_VERSION[];
|
||||||
|
extern const char BUILD_DATE[];
|
Reference in New Issue
Block a user