Moved away from plain make to autotools

I'm really glad I know a bit about how to use them now with pkg-config (so
much nicer than cmake or that python like thing in my opinion)
This commit is contained in:
Warwick 2021-02-05 12:12:51 +00:00
parent 3652cd82d4
commit 7d40aa29c6
4 changed files with 46 additions and 16 deletions

12
.gitignore vendored
View file

@ -1,2 +1,14 @@
# Ignore Builds # Ignore Builds
build/ build/
# Ignore autoconf cruft for now
Makefile.in
aclocal.m4
autom4te.cache/
autoscan.log
compile
config.h.in
configure
depcomp
install-sh
missing

View file

@ -1,16 +0,0 @@
# Set default options
CC = clang++
CFLAGS = -g -Wall -lSDL2 -lSDL2main -lGLEW -lGL
TARGET = Game
SRCDIR = src/
BUILDDIR = build/
all: $(TARGET)
$(TARGET): $(SRCDIR)main.cpp $(BUILDDIR)
$(CC) $(CFLAGS) -o $(BUILDDIR)$(TARGET) $(SRCDIR)main.cpp
$(BUILDDIR):
mkdir -p $(BUILDDIR)

8
Makefile.am Normal file
View file

@ -0,0 +1,8 @@
AUTOMAKE_OPTIONS = subdir-objects
bin_PROGRAMS = Game
Game_SOURCES = \
src/main.cpp
Game_CPPFLAGS = @sdl2_CFLAGS@ @glew_CFLAGS@ @opengl_CFLAGS@
Game_LDFLAGS = @sdl2_LIBS@ @glew_LIBS@ @opengl_LIBS@

26
configure.ac Normal file
View file

@ -0,0 +1,26 @@
# -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.
AC_PREREQ([2.69])
AC_INIT([Game], [0.0.1], [wytau@sdf.org])
AC_CONFIG_SRCDIR([src/main.cpp])
AC_CONFIG_HEADERS([config.h])
AM_INIT_AUTOMAKE([-Wall -Werror foreign])
# Checks for programs.
AC_PROG_CXX
# Checks for libraries.
PKG_CHECK_MODULES([sdl2], sdl2, [], AC_MSG_ERROR([Failed to find sdl2]))
PKG_CHECK_MODULES([glew], glew, [], AC_MSG_ERROR([Failed to find glew]))
PKG_CHECK_MODULES([opengl], gl, [], AC_MSG_ERROR([Failed to find OpenGL]))
# Checks for header files.
# Checks for typedefs, structures, and compiler characteristics.
AC_CHECK_HEADER_STDBOOL
# Checks for library functions.
AC_CONFIG_FILES([Makefile])
AC_OUTPUT