feat: autotools (#10)

* start configure

* ignore some files

* wip configure

* working configure

* working with dev tools

* rename automake -> release

* update readme

* update Makefile.dev
This commit is contained in:
2025-06-05 15:06:06 +02:00
committed by GitHub
parent d63f3f5023
commit 7626f99e32
10 changed files with 5625 additions and 32 deletions
+17 -1
View File
@@ -1,4 +1,20 @@
build build
.vscode .vscode
*.bmp *.bmp
!images/* !images/*
*.cache
.deps
Makefile
*.log
*.o
.dirstamp
aclocal.m4
compile
install-sh
missing
depcomp
Makefile.in
configure~
config.status
margen
*.tar.gz
+5
View File
@@ -0,0 +1,5 @@
AUTOMAKE_OPTIONS = foreign subdir-objects -Wall
bin_PROGRAMS = margen
margen_SOURCES = src/main.c src/args.c src/bmp.c src/generator.c src/rand.c
include_HEADERS = src/main.h src/args.h src/bmp.h src/generator.h src/rand.h src/config.h src/types.h
margen_LDADD = -lm
+7 -10
View File
@@ -24,15 +24,12 @@ valgrind: build
valgrind --leak-check=full -s ./build/$(TARGET) $(TEST_ARGS) valgrind --leak-check=full -s ./build/$(TARGET) $(TEST_ARGS)
.PHONY: release .PHONY: release
release: clean build time release:
@echo -n "Version (x.y.z): " aclocal
@read VERSION; \ autoconf
sed -i "s/#define VERSION.*/#define VERSION \"v$$VERSION\"/g" ./src/const.h; \ automake --add-missing
git add ./src/const.h; \ ./configure
git diff origin/master; \ make distcheck
git commit -m "$(TARGET) v$$VERSION"; \
git tag v$$VERSION -m "$(TARGET) v$$VERSION"
@echo updated ./src/const.h and tagged version
.PHONY: gif .PHONY: gif
gif: build gif: build
@@ -41,4 +38,4 @@ gif: build
./build/margen -w=1920 -h=720 --seed=$$i$$i -o=tmp/image$$i.bmp ; \ ./build/margen -w=1920 -h=720 --seed=$$i$$i -o=tmp/image$$i.bmp ; \
done done
ffmpeg -y -f image2 -framerate 1 -i tmp/image%d.bmp -vf scale=960x360 images/sample.gif ffmpeg -y -f image2 -framerate 1 -i tmp/image%d.bmp -vf scale=960x360 images/sample.gif
rm -rf tmp rm -rf tmp
+3 -8
View File
@@ -10,13 +10,12 @@ Written in pure C without librairies.
## Install ## Install
You only need **gcc** and **make**.
```bash ```bash
git clone https://github.com/klemek/margen git clone https://github.com/klemek/margen
cd margen cd margen
make clean build install ./configure
# margen is now installed in ~/.local/bin make
make install
``` ```
## CLI arguments ## CLI arguments
@@ -41,7 +40,3 @@ options:
-r, --rotation start corner rotation [0-3] (default: random) -r, --rotation start corner rotation [0-3] (default: random)
-m, --monochrome grayscale generation -m, --monochrome grayscale generation
``` ```
## TODO
- configure, make, make install
Vendored Executable
+5564
View File
File diff suppressed because it is too large Load Diff
+11
View File
@@ -0,0 +1,11 @@
AC_INIT([margen], [1.1.0], [klemek.dev@proton.me])
AM_INIT_AUTOMAKE
AC_PROG_CC
AC_CHECK_HEADERS([stdio.h])
AC_CHECK_HEADERS([stdlib.h])
AC_CHECK_HEADERS([stdbool.h])
AC_CHECK_HEADERS([string.h])
AC_CHECK_HEADERS([time.h])
AC_CHECK_HEADERS([math.h])
AC_CONFIG_FILES([Makefile])
AC_OUTPUT
+4 -4
View File
@@ -1,5 +1,5 @@
#include "args.h" #include "args.h"
#include "const.h" #include "config.h"
#include "rand.h" #include "rand.h"
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
@@ -7,9 +7,9 @@
#include <time.h> #include <time.h>
void print_help(int status_code) { void print_help(int status_code) {
puts(NAME puts(PACKAGE
" " VERSION "\n\n" " " VERSION "\n\n"
"usage: " NAME " " "usage: " PACKAGE " "
"[--help] " "[--help] "
"[-v] " "[-v] "
"[-q] " "[-q] "
@@ -145,7 +145,7 @@ parameters parse_args(int argc, char **argv) {
} else if (is_arg(arg, "-q") || is_arg(arg, "--quiet")) { } else if (is_arg(arg, "-q") || is_arg(arg, "--quiet")) {
params.quiet = true; params.quiet = true;
} else if (is_arg(arg, "-v") || is_arg(arg, "--version")) { } else if (is_arg(arg, "-v") || is_arg(arg, "--version")) {
puts(NAME " " VERSION); puts(PACKAGE " " VERSION);
exit(0); exit(0);
} else if (is_arg(arg, "-w") || is_arg(arg, "--width")) { } else if (is_arg(arg, "-w") || is_arg(arg, "--width")) {
params.width = parse_ushort(arg, value); params.width = parse_ushort(arg, value);
+12
View File
@@ -0,0 +1,12 @@
#ifndef CONFIG_H
#define CONFIG_H
#ifndef PACKAGE
#define PACKAGE "margen"
#endif
#ifndef VERSION
#define VERSION "(dev)"
#endif
#endif
-7
View File
@@ -1,7 +0,0 @@
#ifndef CONST_H
#define CONST_H
#define NAME "margen"
#define VERSION "v1.1.0"
#endif
+2 -2
View File
@@ -1,6 +1,6 @@
#include "args.h" #include "args.h"
#include "bmp.h" #include "bmp.h"
#include "const.h" #include "config.h"
#include "rand.h" #include "rand.h"
#include <math.h> #include <math.h>
#include <stdio.h> #include <stdio.h>
@@ -104,7 +104,7 @@ void print_time(parameters params, clock_t start) {
void generate(parameters params) { void generate(parameters params) {
if (!params.quiet) { if (!params.quiet) {
puts(NAME " " VERSION); puts(PACKAGE " " VERSION);
} }
clock_t start = clock(); clock_t start = clock();
init(params); init(params);