Added Makefile exports for metadata, and import header that creates better-useable C types from them

Fortune for naka's current commit: Half blessing − 半吉
generic-project-skeleton
Avril 3 years ago
parent 56870bde45
commit 66f9b0ad55
Signed by: flanchan
GPG Key ID: 284488987C31F630

@ -2,15 +2,28 @@
# Contains targets for `release', `debug', and `clean'. # Contains targets for `release', `debug', and `clean'.
PROJECT=naka PROJECT=naka
DESCRIPTION="Find a file within another file" DESCRIPTION=Find a file within another file(s)
AUTHOR=Avril (Flanchan) <flanchan@cumallover.me> AUTHOR=Avril (Flanchan) <flanchan@cumallover.me>
LICENSE=GPL3+
VERSION_MAJ=0
VERSION_MIN=0
VERSION_BF=0
VERSION_REV=0
VERSION:=$(VERSION_MAJ).$(VERSION_MIN).$(VERSION_BF).$(VERSION_REV)
SRC_C = $(wildcard src/*.c) $(wildcard src/tests/*.c) SRC_C = $(wildcard src/*.c) $(wildcard src/tests/*.c)
SRC_CXX = $(wildcard src/*.cpp) SRC_CXX = $(wildcard src/*.cpp)
INCLUDE=include INCLUDE=include
COMMON_FLAGS+= -W -Wall -fno-strict-aliasing $(addprefix -I,$(INCLUDE)) META_FLAGS:=-D_PROJECT_AUTHOR="\"$(AUTHOR)\"" -D_PROJECT_DESCRIPTION="\"$(DESCRIPTION)\"" -D_PROJECT_NAME="\"$(PROJECT)\"" \
-D_PROJECT_LICENSE="\"$(LICENSE)\"" \
-D_VERSION_MAJOR=$(VERSION_MAJ) -D_VERSION_MINOR=$(VERSION_MIN) \
-D_VERSION_BUGFIX=$(VERSION_BF) -D_VERSION_REVISION=$(VERSION_REV)
COMMON_FLAGS+= -W -Wall -fno-strict-aliasing $(addprefix -I,$(INCLUDE)) $(META_FLAGS)
ARCH?=native ARCH?=native
OPT_FLAGS+= -fgraphite -fopenmp -floop-parallelize-all -ftree-parallelize-loops=4 \ OPT_FLAGS+= -fgraphite -fopenmp -floop-parallelize-all -ftree-parallelize-loops=4 \

@ -0,0 +1,23 @@
//! Re-exports Makefile defines as more usable types
#ifndef _PROJECT_H
#define _PROJECT_H
#include "version.h"
/// Project version, as a raw version identifier (u32).
/// Use `v_rawtoc()` to convert to `version_t`.
#define PROG_VERSION VERSION(_VERSION_MAJOR, \
_VERSION_MINOR, \
_VERSION_BUGFIX, \
_VERSION_REVISION)
/// Project name. Output binary name
#define PROG_NAME _PROJECT_NAME
/// Project description
#define PROG_DESCRIPTION _PROJECT_DESCRIPTION
/// Project authour(s)
#define PROG_AUTHOUR _PROJECT_AUTHOR
/// Project license
#define PROG_LICENSE _PROJECT_LICENSE
#endif /* _PROJECT_H */

@ -8,14 +8,9 @@
#include <macros.h> #include <macros.h>
#include <version.h> #include <version.h>
#include <tests.h> #include <project.h>
// TODO: Have Makefile define these, or import them from Makefile defines. #include <tests.h>
#define PROG_NAME "naka"
#define PROG_DESCRIPTION "find a file within other file(s)"
#define PROG_AUTHOUR "Avril <flanchan@cumallover.me>"
#define PROG_LICENSE "GPL3+"
#define PROG_VERSION VERSION(0,0,0,0)
void prog_info(FILE* out) void prog_info(FILE* out)
{ {
@ -44,11 +39,11 @@ noreturn void usage_then_exit(int err, int argc, char** argv)
int main(int argc, char** argv) int main(int argc, char** argv)
{ {
INFO("main start"); TRACE("main start");
usage_then_exit(0, argc, argv); usage_then_exit(0, argc, argv);
INFO("main end"); TRACE("main end");
return 0; return 0;
} }

Loading…
Cancel
Save