summaryrefslogtreecommitdiff
path: root/plugins/dumb/dumb-kode54/make
diff options
context:
space:
mode:
authorGravatar Alexey Yakovenko <wakeroid@gmail.com>2010-04-11 15:01:21 +0200
committerGravatar Alexey Yakovenko <wakeroid@gmail.com>2010-04-11 15:01:21 +0200
commite763dfa3ddf5c499875a6e1e9ec91d7fc154c076 (patch)
tree8fddc5ecbb1d867afa4690cfdde245929cafb21c /plugins/dumb/dumb-kode54/make
parentdc0b9121ff16d57f92f4ab2b16bf78518d3a8b9b (diff)
moved DUMB to dynamic plugin
Diffstat (limited to 'plugins/dumb/dumb-kode54/make')
-rw-r--r--plugins/dumb/dumb-kode54/make/Makefile.am8
-rw-r--r--plugins/dumb/dumb-kode54/make/Makefile.inc39
-rw-r--r--plugins/dumb/dumb-kode54/make/config.bat33
-rw-r--r--plugins/dumb/dumb-kode54/make/config.sh35
-rw-r--r--plugins/dumb/dumb-kode54/make/djgpp.inc28
-rw-r--r--plugins/dumb/dumb-kode54/make/dumbask.c30
-rw-r--r--plugins/dumb/dumb-kode54/make/mingw.inc28
-rw-r--r--plugins/dumb/dumb-kode54/make/unix.inc20
8 files changed, 221 insertions, 0 deletions
diff --git a/plugins/dumb/dumb-kode54/make/Makefile.am b/plugins/dumb/dumb-kode54/make/Makefile.am
new file mode 100644
index 00000000..b82e0847
--- /dev/null
+++ b/plugins/dumb/dumb-kode54/make/Makefile.am
@@ -0,0 +1,8 @@
+EXTRA_DIST = \
+ config.bat \
+ config.sh \
+ djgpp.inc \
+ dumbask.c \
+ Makefile.inc \
+ mingw.inc \
+ unix.inc
diff --git a/plugins/dumb/dumb-kode54/make/Makefile.inc b/plugins/dumb/dumb-kode54/make/Makefile.inc
new file mode 100644
index 00000000..d7e276cd
--- /dev/null
+++ b/plugins/dumb/dumb-kode54/make/Makefile.inc
@@ -0,0 +1,39 @@
+# This file contains the main rules for compiling the library. It is included
+# twice with different values for CFLAGS and OBJDIR, so the optimised and
+# debugging libraries are both built.
+
+CORE_OBJECTS := $(addprefix $(OBJDIR)/, $(notdir $(patsubst %.c, %.o, $(CORE_MODULES))))
+ALLEGRO_OBJECTS := $(addprefix $(OBJDIR)/, $(notdir $(patsubst %.c, %.o, $(ALLEGRO_MODULES))))
+
+
+# Pass the current value of CFLAGS through to the commands. Or, more
+# accurately, create a local copy of the current CFLAGS variable. This is
+# necessary because Make doesn't expand variables in commands until they are
+# executed.
+$(CORE_LIB_FILE): CFLAGS := $(CFLAGS)
+$(ALLEGRO_LIB_FILE): CFLAGS := $(CFLAGS)
+
+
+$(OBJDIR)/%.o: src/core/%.c include/dumb.h include/internal/dumb.h
+ $(CC) $(CFLAGS) -c -o $@ $<
+
+$(OBJDIR)/%.o: src/helpers/%.c include/dumb.h
+ $(CC) $(CFLAGS) -c -o $@ $<
+
+$(OBJDIR)/resample.o: src/helpers/resample.inc
+
+$(OBJDIR)/%.o: src/it/%.c include/dumb.h include/internal/it.h
+ $(CC) $(CFLAGS) -c -o $@ $<
+
+$(OBJDIR)/%.o: src/sigtypes/%.c include/dumb.h
+ $(CC) $(CFLAGS) -c -o $@ $<
+
+$(OBJDIR)/%.o: src/allegro/%.c include/aldumb.h include/dumb.h \
+ include/internal/aldumb.h include/internal/dumb.h
+ $(CC) $(CFLAGS) $(WFLAGS_ALLEGRO) -c -o $@ $<
+
+$(CORE_LIB_FILE): $(CORE_OBJECTS)
+ $(AR) rs $@ $^
+
+$(ALLEGRO_LIB_FILE): $(ALLEGRO_OBJECTS)
+ $(AR) rs $@ $^
diff --git a/plugins/dumb/dumb-kode54/make/config.bat b/plugins/dumb/dumb-kode54/make/config.bat
new file mode 100644
index 00000000..5c5f3272
--- /dev/null
+++ b/plugins/dumb/dumb-kode54/make/config.bat
@@ -0,0 +1,33 @@
+@ECHO OFF
+
+REM This file does an interactive configuration for users of DOS and Windows.
+REM It creates a config.txt file for inclusion in the Makefile. This batch
+REM file should be run indirectly through the 'make config' target (or the
+REM 'make' target the first time).
+
+IF EXIST make\dumbask.exe GOTO dumbaskok
+ECHO You should not be running this directly! Use 'make' or 'make config'.
+GOTO end
+:dumbaskok
+
+make\dumbask.exe "Would you like to compile DUMB for DJGPP or MinGW (D/M)? " DM
+IF ERRORLEVEL 1 GOTO mingw
+ECHO include make/djgpp.inc>make\config.tmp
+GOTO djgpp
+:mingw
+ECHO include make/mingw.inc>make\config.tmp
+:djgpp
+
+ECHO ALL_TARGETS := core core-examples core-headers>>make\config.tmp
+
+make\dumbask.exe "Would you like support for Allegro (Y/N)? "
+IF NOT ERRORLEVEL 1 ECHO ALL_TARGETS += allegro allegro-examples allegro-headers>>make\config.tmp
+
+IF EXIST make\config.txt DEL make\config.txt
+REN make\config.tmp config.txt
+
+ECHO Configuration complete.
+ECHO Run 'make config' to change it in the future.
+PAUSE
+
+:end
diff --git a/plugins/dumb/dumb-kode54/make/config.sh b/plugins/dumb/dumb-kode54/make/config.sh
new file mode 100644
index 00000000..923b3ccc
--- /dev/null
+++ b/plugins/dumb/dumb-kode54/make/config.sh
@@ -0,0 +1,35 @@
+#!/bin/sh
+
+# This file does an interactive configuration for users of Unix-like systems.
+# It creates a config.txt file for inclusion in the Makefile. This script
+# should be run indirectly through the 'make config' target (or the 'make'
+# target the first time).
+
+if [ ! -e make/dumbask ]; then
+ echo "You should not be running this directly! Use 'make' or 'make config'."
+ exit
+fi
+
+echo 'include make/unix.inc' > make/config.tmp
+
+echo 'ALL_TARGETS := core core-examples core-headers' >> make/config.tmp
+
+if make/dumbask 'Would you like support for Allegro (Y/N)? ' YN; then
+ echo 'ALL_TARGETS += allegro allegro-examples allegro-headers' >> make/config.tmp
+fi
+
+
+if [ ! -z $DEFAULT_PREFIX ]; then
+echo "Please specify an installation prefix (default $DEFAULT_PREFIX)."
+echo -n '> '
+read PREFIX
+if [ -z $PREFIX ]; then PREFIX=$DEFAULT_PREFIX; fi
+echo "PREFIX := $PREFIX" >> make/config.tmp
+fi
+
+mv -f make/config.tmp make/config.txt
+
+echo 'Configuration complete.'
+echo "Run 'make config' to change it in the future."
+echo -n 'Press Enter to continue ... '
+read dummy
diff --git a/plugins/dumb/dumb-kode54/make/djgpp.inc b/plugins/dumb/dumb-kode54/make/djgpp.inc
new file mode 100644
index 00000000..009533ce
--- /dev/null
+++ b/plugins/dumb/dumb-kode54/make/djgpp.inc
@@ -0,0 +1,28 @@
+# This file contains DJGPP-specific definitions. It will be included by the
+# main Makefile when you compile with DJGPP.
+
+PLATFORM := djgpp
+
+APOST := \'
+
+# Macro for replacing / with \ where necessary. Usage: $(call FIX,path)
+FIX = $(subst /,\,$(subst /*,\\\*,$(1)))
+
+ECHO = @$(COMSPEC) /C ECHO $(1)
+# Note: the following two macros only work for single files!
+DELETE = $(COMSPEC) /C DEL $(call FIX,$(1))
+COPY = $(COMSPEC) /C COPY $(call FIX,$(1)) $(call FIX,$(2))
+
+EXE_SUFFIX := .exe
+
+LINK_MATH :=
+LINK_ALLEGRO := -lalleg
+
+ifndef DJDIR
+.PHONY: error
+error:
+ $(call ECHO,Your DJDIR environment variable is not set!)
+ $(call ECHO,Please refer to DJGPP's documentation and install it properly.)
+endif
+
+PREFIX := $(DJDIR)
diff --git a/plugins/dumb/dumb-kode54/make/dumbask.c b/plugins/dumb/dumb-kode54/make/dumbask.c
new file mode 100644
index 00000000..8c1b3757
--- /dev/null
+++ b/plugins/dumb/dumb-kode54/make/dumbask.c
@@ -0,0 +1,30 @@
+#include <stdio.h>
+#include <ctype.h>
+
+
+int main(int argc, const char *const argv[])
+{
+ const char *message = argv[1];
+ const char *options;
+
+ if (!message) {
+ fprintf(stderr,
+ "dumbask: asks the user a question.\n"
+ "Specify a message as the first argument (quoted!).\n"
+ "You may optionally specify the choices as the second argument.\n"
+ "Default choices are YN. Exit code is 0 for first, 1 for second, etc.\n");
+ return 0;
+ }
+
+ options = argv[2] ? : "YN"; /* I _had_ to use a GNU Extension _somewhere_! */
+
+ printf("%s", argv[1]);
+
+ for (;;) {
+ char c = toupper(getchar());
+ int i;
+ for (i = 0; options[i]; i++)
+ if (c == toupper(options[i]))
+ return i;
+ }
+}
diff --git a/plugins/dumb/dumb-kode54/make/mingw.inc b/plugins/dumb/dumb-kode54/make/mingw.inc
new file mode 100644
index 00000000..065f2e5f
--- /dev/null
+++ b/plugins/dumb/dumb-kode54/make/mingw.inc
@@ -0,0 +1,28 @@
+# This file contains MinGW-specific definitions. It will be included by the
+# main Makefile when you compile with MinGW.
+
+PLATFORM := mingw
+
+APOST := \'
+
+# Macro for replacing / with \ where necessary. Usage: $(call FIX,path)
+FIX = $(subst /,\,$(subst /*,\\\*,$(1)))
+
+ECHO = @$(COMSPEC) /C ECHO $(1)
+# Note: the following two macros only work for single files!
+DELETE = $(COMSPEC) /C DEL $(call FIX,$(1))
+COPY = $(COMSPEC) /C COPY $(call FIX,$(1)) $(call FIX,$(2))
+
+EXE_SUFFIX := .exe
+
+LINK_MATH :=
+LINK_ALLEGRO := -lalleg
+
+ifndef MINGDIR
+.PHONY: error
+error:
+ $(call ECHO,Your MINGDIR environment variable is not set!)
+ $(call ECHO,Please set it to point to the directory containing your MinGW installation.)
+endif
+
+PREFIX := $(MINGDIR)
diff --git a/plugins/dumb/dumb-kode54/make/unix.inc b/plugins/dumb/dumb-kode54/make/unix.inc
new file mode 100644
index 00000000..2ab5259a
--- /dev/null
+++ b/plugins/dumb/dumb-kode54/make/unix.inc
@@ -0,0 +1,20 @@
+# This file contains definitions suitable for Unix-compatible systems. It will
+# be included by the main Makefile when you compile on such a system.
+
+PLATFORM := unix
+
+APOST := \'
+
+# Macro that on DOS and Windows would replace / with \. Usage: $(call FIX,path)
+FIX = $(1)
+
+ECHO = @echo $(1)
+DELETE = rm -f $(1)
+COPY = cp $(1) $(2)
+
+EXE_SUFFIX :=
+
+LINK_MATH := -lm
+LINK_ALLEGRO := `allegro-config --libs`
+
+# PREFIX is set by config.sh.