summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLudovic Pouzenc <ludovic@pouzenc.fr>2019-09-14 19:51:37 +0200
committerLudovic Pouzenc <ludovic@pouzenc.fr>2019-09-14 19:51:37 +0200
commit1b0c8fb53a4f3335dc9132e4beabe6602f682ea5 (patch)
treefd1c70e8ec56e61019c8720f127146c710867d68
parentfa84dfb895d5f3965b2c791b477a1dcc6b4eef7b (diff)
downloaddemoscene-eo-1b0c8fb53a4f3335dc9132e4beabe6602f682ea5.tar.gz
demoscene-eo-1b0c8fb53a4f3335dc9132e4beabe6602f682ea5.tar.bz2
demoscene-eo-1b0c8fb53a4f3335dc9132e4beabe6602f682ea5.zip
Use autotools instead of hand-written Makefile
-rw-r--r--.gitignore27
-rw-r--r--Makefile18
-rw-r--r--Makefile.am2
-rw-r--r--README20
-rwxr-xr-xautogen.sh4
-rw-r--r--configure.ac39
-rw-r--r--src/Makefile.am6
-rw-r--r--src/demoscene-eo.c (renamed from src/main.c)0
-rw-r--r--src/main.h1
9 files changed, 98 insertions, 19 deletions
diff --git a/.gitignore b/.gitignore
index 3d1317d..a31b808 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1 +1,28 @@
demoscene-eo
+*.la
+*.lo
+*.o
+*~
+.deps
+.libs
+Makefile
+Makefile.in
+aclocal.m4
+autom4te.cache
+autoscan.log
+compile
+config.guess
+config.h
+config.h.in
+config.log
+config.status
+config.sub
+configure
+depcomp
+install-sh
+libtool
+ltmain.sh
+m4/*.m4
+missing
+obj*
+stamp-*
diff --git a/Makefile b/Makefile
deleted file mode 100644
index 6aebd5e..0000000
--- a/Makefile
+++ /dev/null
@@ -1,18 +0,0 @@
-CFLAGS := -Wall $(CFLAGS)
-#CFLAGS := -Wall -Werror -g -DDEBUG $(CFLAGS)
-PKGLIBS:= caca sdl2 glu
-
-all: demoscene-eo
-
-server: demoscene-eo
- xterm -e $(SHELL) -c "sleep 1; nc -v localhost 51914; exec $(SHELL)" &
- CACA_DRIVER=raw CACA_GEOMETRY=80x24 ./demoscene-eo | cacaserver
-
-demoscene-eo: src/main.c src/main.h $(wildcard src/scene*.[ch]) Makefile
- pkg-config --libs --cflags $(PKGLIBS)
- gcc $(CFLAGS) `pkg-config --libs --cflags $(PKGLIBS)` src/main.c $(wildcard src/scene*.c) -pthread -o $@
-
-clean:
- rm -f demoscene-eo
-
-.PHONY=all clean run
diff --git a/Makefile.am b/Makefile.am
new file mode 100644
index 0000000..bfd4c58
--- /dev/null
+++ b/Makefile.am
@@ -0,0 +1,2 @@
+SUBDIRS = src
+#dist_man_MANS = demoscene-eo.1
diff --git a/README b/README
index aa92423..3966b66 100644
--- a/README
+++ b/README
@@ -1,3 +1,21 @@
+# Build dependencies
+- linux and glibc (pthreads, mmap...), CACA, SDL2, GL, GLU, autotools, a decent C compiler
+- mainly tested on Debian 10.1 amd64
+- sudo apt install automake autoconf-archive autotools-dev build-essential libcaca-dev libsdl2-dev libglu1-mesa-dev
-apt install libcaca-dev libsdl2-dev libglu1-mesa-dev
+# To enjoy it :
+git clone https://www.pouzenc.fr/cgit/demoscene-eo/
+cd demoscene-eo
+./autogen.sh
+./configure
+make
+src/demoscene-eo
+
+# To improve it :
+git clone git@pouzenc.fr:demoscene-eo
+cd demoscene-eo
+./autogen.sh
+CFLAGS="-Wall -Werror -DDEBUG -g" ./configure
+make
+src/demoscene-eo
diff --git a/autogen.sh b/autogen.sh
new file mode 100755
index 0000000..0a2ae13
--- /dev/null
+++ b/autogen.sh
@@ -0,0 +1,4 @@
+#!/bin/sh
+srcdir=`dirname "$0"`
+test -z "$srcdir" || cd "$srcdir"
+autoreconf -v --install
diff --git a/configure.ac b/configure.ac
new file mode 100644
index 0000000..d9721db
--- /dev/null
+++ b/configure.ac
@@ -0,0 +1,39 @@
+AC_PREREQ([2.65])
+AC_INIT([demoscene-eo], 0.1, [https://www.pouzenc.fr/cgit/demoscene-eo], demoscene-eo)
+AM_INIT_AUTOMAKE([foreign dist-bzip2])
+AM_EXTRA_RECURSIVE_TARGETS([server])
+
+AC_CONFIG_SRCDIR([src/demoscene-eo.c])
+AC_CONFIG_HEADERS([config.h])
+AC_CONFIG_MACRO_DIR([m4])
+
+# Checks for programs.
+AC_PROG_CC
+AC_PROG_INSTALL
+
+# Checks for libraries.
+AC_SEARCH_LIBS(caca_create_display, [caca])
+AC_SEARCH_LIBS(SDL_Init, [SDL2])
+AC_SEARCH_LIBS(glCompileShader, [GL])
+AC_SEARCH_LIBS(gluLookAt, [glu])
+
+# Checks for header files.
+AC_CHECK_HEADERS([stdlib.h strings.h sys/mman.h semaphore.h unistd.h sys/wait.h errno.h stdint.h stdio.h signal.h])
+
+# Checks for typedefs, structures, and compiler characteristics.
+AC_C_INLINE
+AC_TYPE_UINT32_T
+
+# Checks for library functions.
+AC_FUNC_FORK
+AC_FUNC_MMAP
+AC_CHECK_FUNCS([alarm atexit bzero])
+
+ACX_PTHREAD
+LIBS="$PTHREAD_LIBS $LIBS"
+CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
+CC="$PTHREAD_CC"
+
+AC_CONFIG_FILES([Makefile src/Makefile])
+AC_OUTPUT
+
diff --git a/src/Makefile.am b/src/Makefile.am
new file mode 100644
index 0000000..d9f8a72
--- /dev/null
+++ b/src/Makefile.am
@@ -0,0 +1,6 @@
+bin_PROGRAMS = demoscene-eo
+demoscene_eo_SOURCES = demoscene-eo.c scene00.c scene01.c scene02.c
+
+server-local: demoscene-eo
+ xterm -e $(SHELL) -c "sleep 1; nc -v localhost 51914; exec $(SHELL)" &
+ CACA_DRIVER=raw CACA_GEOMETRY=80x24 ./demoscene-eo | cacaserver
diff --git a/src/main.c b/src/demoscene-eo.c
index 94db4e5..94db4e5 100644
--- a/src/main.c
+++ b/src/demoscene-eo.c
diff --git a/src/main.h b/src/main.h
index 3af6815..bf622ed 100644
--- a/src/main.h
+++ b/src/main.h
@@ -3,6 +3,7 @@
#define GL_GLEXT_PROTOTYPES
+#include "config.h"
#include <caca.h>
#include <SDL2/SDL.h>
#include <SDL2/SDL_opengl.h>