diff --git a/Makefile b/Makefile index ea2437e..0238253 100644 --- a/Makefile +++ b/Makefile @@ -1,3 +1,5 @@ +include Makefile.cfg + target=fx9860g CONFIG.TARGET = fx @@ -12,7 +14,7 @@ machine := -m3 -mb # Compiler flags, assembler flags, dependency generation, archiving cflags := $(machine) -ffreestanding -nostdlib -Wall -Wextra -std=c11 -Os \ -fstrict-volatile-bitfields -I include $(CONFIG.MACROS) \ - $(CONFIG.CFLAGS) + $(CONFIG.CFLAGS) $(PROFILING) sflags := $(CONFIG.MACROS) dflags = -MMD -MT $@ -MF $(@:.o=.d) -MP arflags := diff --git a/configure b/configure new file mode 100755 index 0000000..be39aa3 --- /dev/null +++ b/configure @@ -0,0 +1,86 @@ +#! /bin/bash + +# +# Basic configuration +# + + + +output="Makefile.cfg" + +# +# Help screen +# + +help() +{ + cat << EOF +Configuration script for the fxengine library. +Usage: $0 [options...] + +You should build out-of-tree by creating a build directory and configuring from +there. + + +Build option: + + --enable-profiling + + By default, profiling is disabled, tht means you will not have access to fps. :( + + This option enables fps count, but you need to have libprof (by Lephenixnoir) installed + + +EOF + exit 0 +} + +if [[ "$@" == "--help" ]]; then + help + exit 1 +fi + +# +# Parsing arguments +# + +add_cflags= + +fail=false +for arg; do case "$arg" in + -h | -? | --help) + help;; + + + --enable-profiling) + add_cflags=-DUSE_LIBPROF;; + + *) + echo "error: unrecognized argument '$arg'"; + fail=true;; +esac; done + +# +# Checking mandatory arguments +# + +if $fail; then + echo "Oops ! Maybe a wrong option..." + exit 1 +fi + + +# +# Output config +# + +output_config() +{ + echo -n "PROFILING =" + echo -n " $(echo $add_cflags)" + echo "" +} + +output_config > $output + +echo "Configuration saved in $output, ready to make!"