diff options
Diffstat (limited to 'apps/codecs/dumb/make')
-rw-r--r-- | apps/codecs/dumb/make/Makefile.inc | 34 | ||||
-rw-r--r-- | apps/codecs/dumb/make/config.bat | 33 | ||||
-rwxr-xr-x | apps/codecs/dumb/make/config.sh | 35 | ||||
-rw-r--r-- | apps/codecs/dumb/make/config.txt | 3 | ||||
-rw-r--r-- | apps/codecs/dumb/make/djgpp.inc | 28 | ||||
-rwxr-xr-x | apps/codecs/dumb/make/dumbask | bin | 0 -> 12700 bytes | |||
-rw-r--r-- | apps/codecs/dumb/make/dumbask.c | 30 | ||||
-rw-r--r-- | apps/codecs/dumb/make/mingw.inc | 28 | ||||
-rw-r--r-- | apps/codecs/dumb/make/unix.inc | 20 |
9 files changed, 211 insertions, 0 deletions
diff --git a/apps/codecs/dumb/make/Makefile.inc b/apps/codecs/dumb/make/Makefile.inc new file mode 100644 index 0000000000..4137b04804 --- /dev/null +++ b/apps/codecs/dumb/make/Makefile.inc | |||
@@ -0,0 +1,34 @@ | |||
1 | # This file contains the main rules for compiling the library. It is included | ||
2 | # twice with different values for CFLAGS and OBJDIR, so the optimised and | ||
3 | # debugging libraries are both built. | ||
4 | |||
5 | CORE_OBJECTS := $(addprefix $(OBJDIR)/, $(notdir $(patsubst %.c, %.o, $(CORE_MODULES)))) | ||
6 | ALLEGRO_OBJECTS := $(addprefix $(OBJDIR)/, $(notdir $(patsubst %.c, %.o, $(ALLEGRO_MODULES)))) | ||
7 | |||
8 | |||
9 | # Pass the current value of CFLAGS through to the commands. Or, more | ||
10 | # accurately, create a local copy of the current CFLAGS variable. This is | ||
11 | # necessary because Make doesn't expand variables in commands until they are | ||
12 | # executed. | ||
13 | $(CORE_LIB_FILE): CFLAGS := $(CFLAGS) | ||
14 | $(ALLEGRO_LIB_FILE): CFLAGS := $(CFLAGS) | ||
15 | |||
16 | |||
17 | $(OBJDIR)/%.o: src/core/%.c include/dumb.h include/internal/dumb.h | ||
18 | $(CC) -c -o $@ $< $(CFLAGS) | ||
19 | |||
20 | $(OBJDIR)/%.o: src/helpers/%.c include/dumb.h | ||
21 | $(CC) -c -o $@ $< $(CFLAGS) | ||
22 | |||
23 | $(OBJDIR)/%.o: src/it/%.c include/dumb.h include/internal/it.h | ||
24 | $(CC) -c -o $@ $< $(CFLAGS) | ||
25 | |||
26 | $(OBJDIR)/%.o: src/allegro/%.c include/aldumb.h include/dumb.h \ | ||
27 | include/internal/aldumb.h include/internal/dumb.h | ||
28 | $(CC) -c -o $@ $< $(CFLAGS) $(WFLAGS_ALLEGRO) | ||
29 | |||
30 | $(CORE_LIB_FILE): $(CORE_OBJECTS) | ||
31 | $(AR) rs $@ $^ | ||
32 | |||
33 | $(ALLEGRO_LIB_FILE): $(ALLEGRO_OBJECTS) | ||
34 | $(AR) rs $@ $^ | ||
diff --git a/apps/codecs/dumb/make/config.bat b/apps/codecs/dumb/make/config.bat new file mode 100644 index 0000000000..2d33a61511 --- /dev/null +++ b/apps/codecs/dumb/make/config.bat | |||
@@ -0,0 +1,33 @@ | |||
1 | @ECHO OFF | ||
2 | |||
3 | REM This file does an interactive configuration for users of DOS and Windows. | ||
4 | REM It creates a config.txt file for inclusion in the Makefile. This batch | ||
5 | REM file should be run indirectly through the 'make config' target (or the | ||
6 | REM 'make' target the first time). | ||
7 | |||
8 | IF EXIST make\dumbask.exe GOTO dumbaskok | ||
9 | ECHO You should not be running this directly! Use 'make' or 'make config'. | ||
10 | GOTO end | ||
11 | :dumbaskok | ||
12 | |||
13 | make\dumbask.exe "Would you like to compile DUMB for DJGPP or MinGW (D/M)? " DM | ||
14 | IF ERRORLEVEL 1 GOTO mingw | ||
15 | ECHO include make/djgpp.inc>make\config.tmp | ||
16 | GOTO djgpp | ||
17 | :mingw | ||
18 | ECHO include make/mingw.inc>make\config.tmp | ||
19 | :djgpp | ||
20 | |||
21 | ECHO ALL_TARGETS := core core-examples core-headers>>make\config.tmp | ||
22 | |||
23 | make\dumbask.exe "Would you like support for Allegro (Y/N)? " | ||
24 | IF NOT ERRORLEVEL 1 ECHO ALL_TARGETS += allegro allegro-examples allegro-headers>>make\config.tmp | ||
25 | |||
26 | IF EXIST make\config.txt DEL make\config.txt | ||
27 | REN make\config.tmp config.txt | ||
28 | |||
29 | ECHO Configuration complete. | ||
30 | ECHO Run 'make config' to change it in the future. | ||
31 | PAUSE | ||
32 | |||
33 | :end | ||
diff --git a/apps/codecs/dumb/make/config.sh b/apps/codecs/dumb/make/config.sh new file mode 100755 index 0000000000..f42e141176 --- /dev/null +++ b/apps/codecs/dumb/make/config.sh | |||
@@ -0,0 +1,35 @@ | |||
1 | #!/bin/sh | ||
2 | |||
3 | # This file does an interactive configuration for users of Unix-like systems. | ||
4 | # It creates a config.txt file for inclusion in the Makefile. This script | ||
5 | # should be run indirectly through the 'make config' target (or the 'make' | ||
6 | # target the first time). | ||
7 | |||
8 | if [ ! -e make/dumbask ]; then | ||
9 | echo "You should not be running this directly! Use 'make' or 'make config'." | ||
10 | exit | ||
11 | fi | ||
12 | |||
13 | echo 'include make/unix.inc' > make/config.tmp | ||
14 | |||
15 | echo 'ALL_TARGETS := core core-examples core-headers' >> make/config.tmp | ||
16 | |||
17 | if make/dumbask 'Would you like support for Allegro (Y/N)? ' YN; then | ||
18 | echo 'ALL_TARGETS += allegro allegro-examples allegro-headers' >> make/config.tmp | ||
19 | fi | ||
20 | |||
21 | |||
22 | if [ ! -z $DEFAULT_PREFIX ]; then | ||
23 | echo "Please specify an installation prefix (default $DEFAULT_PREFIX)." | ||
24 | echo -n '> ' | ||
25 | read PREFIX | ||
26 | if [ -z $PREFIX ]; then PREFIX=$DEFAULT_PREFIX; fi | ||
27 | echo "PREFIX := $PREFIX" >> make/config.tmp | ||
28 | fi | ||
29 | |||
30 | mv -f make/config.tmp make/config.txt | ||
31 | |||
32 | echo 'Configuration complete.' | ||
33 | echo "Run 'make config' to change it in the future." | ||
34 | echo -n 'Press Enter to continue ... ' | ||
35 | read | ||
diff --git a/apps/codecs/dumb/make/config.txt b/apps/codecs/dumb/make/config.txt new file mode 100644 index 0000000000..abe4397216 --- /dev/null +++ b/apps/codecs/dumb/make/config.txt | |||
@@ -0,0 +1,3 @@ | |||
1 | include make/unix.inc | ||
2 | ALL_TARGETS := core | ||
3 | PREFIX := /usr | ||
diff --git a/apps/codecs/dumb/make/djgpp.inc b/apps/codecs/dumb/make/djgpp.inc new file mode 100644 index 0000000000..4147ab26a4 --- /dev/null +++ b/apps/codecs/dumb/make/djgpp.inc | |||
@@ -0,0 +1,28 @@ | |||
1 | # This file contains DJGPP-specific definitions. It will be included by the | ||
2 | # main Makefile when you compile with DJGPP. | ||
3 | |||
4 | PLATFORM := djgpp | ||
5 | |||
6 | APOST := \' | ||
7 | |||
8 | # Macro for replacing / with \ where necessary. Usage: $(call FIX,path) | ||
9 | FIX = $(subst /,\,$(subst /*,\\\*,$(1))) | ||
10 | |||
11 | ECHO = @$(COMSPEC) /C ECHO $(1) | ||
12 | # Note: the following two macros only work for single files! | ||
13 | DELETE = $(COMSPEC) /C DEL $(call FIX,$(1)) | ||
14 | COPY = $(COMSPEC) /C COPY $(call FIX,$(1)) $(call FIX,$(2)) | ||
15 | |||
16 | EXE_SUFFIX := .exe | ||
17 | |||
18 | LINK_MATH := | ||
19 | LINK_ALLEGRO := -lalleg | ||
20 | |||
21 | ifndef DJDIR | ||
22 | .PHONY: error | ||
23 | error: | ||
24 | $(call ECHO,Your DJDIR environment variable is not set!) | ||
25 | $(call ECHO,Please refer to DJGPP's documentation and install it properly.) | ||
26 | endif | ||
27 | |||
28 | PREFIX := $(DJDIR) | ||
diff --git a/apps/codecs/dumb/make/dumbask b/apps/codecs/dumb/make/dumbask new file mode 100755 index 0000000000..ee6f5f7ecd --- /dev/null +++ b/apps/codecs/dumb/make/dumbask | |||
Binary files differ | |||
diff --git a/apps/codecs/dumb/make/dumbask.c b/apps/codecs/dumb/make/dumbask.c new file mode 100644 index 0000000000..da89fab97b --- /dev/null +++ b/apps/codecs/dumb/make/dumbask.c | |||
@@ -0,0 +1,30 @@ | |||
1 | #include <stdio.h> | ||
2 | #include <ctype.h> | ||
3 | |||
4 | |||
5 | int main(int argc, const char *const argv[]) | ||
6 | { | ||
7 | const char *message = argv[1]; | ||
8 | const char *options; | ||
9 | |||
10 | if (!message) { | ||
11 | fprintf(stderr, | ||
12 | "dumbask: asks the user a question.\n" | ||
13 | "Specify a message as the first argument (quoted!).\n" | ||
14 | "You may optionally specify the choices as the second argument.\n" | ||
15 | "Default choices are YN. Exit code is 0 for first, 1 for second, etc.\n"); | ||
16 | return 0; | ||
17 | } | ||
18 | |||
19 | options = argv[2] ? : "YN"; /* I _had_ to use a GNU Extension _somewhere_! */ | ||
20 | |||
21 | printf("%s", argv[1]); | ||
22 | |||
23 | for (;;) { | ||
24 | char c = toupper(getchar()); | ||
25 | int i; | ||
26 | for (i = 0; options[i]; i++) | ||
27 | if (c == toupper(options[i])) | ||
28 | return i; | ||
29 | } | ||
30 | } | ||
diff --git a/apps/codecs/dumb/make/mingw.inc b/apps/codecs/dumb/make/mingw.inc new file mode 100644 index 0000000000..e58de58788 --- /dev/null +++ b/apps/codecs/dumb/make/mingw.inc | |||
@@ -0,0 +1,28 @@ | |||
1 | # This file contains MinGW-specific definitions. It will be included by the | ||
2 | # main Makefile when you compile with MinGW. | ||
3 | |||
4 | PLATFORM := mingw | ||
5 | |||
6 | APOST := \' | ||
7 | |||
8 | # Macro for replacing / with \ where necessary. Usage: $(call FIX,path) | ||
9 | FIX = $(subst /,\,$(subst /*,\\\*,$(1))) | ||
10 | |||
11 | ECHO = @$(COMSPEC) /C ECHO $(1) | ||
12 | # Note: the following two macros only work for single files! | ||
13 | DELETE = $(COMSPEC) /C DEL $(call FIX,$(1)) | ||
14 | COPY = $(COMSPEC) /C COPY $(call FIX,$(1)) $(call FIX,$(2)) | ||
15 | |||
16 | EXE_SUFFIX := .exe | ||
17 | |||
18 | LINK_MATH := | ||
19 | LINK_ALLEGRO := -lalleg | ||
20 | |||
21 | ifndef MINGDIR | ||
22 | .PHONY: error | ||
23 | error: | ||
24 | $(call ECHO,Your MINGDIR environment variable is not set!) | ||
25 | $(call ECHO,Please set it to point to the directory containing your MinGW installation.) | ||
26 | endif | ||
27 | |||
28 | PREFIX := $(MINGDIR) | ||
diff --git a/apps/codecs/dumb/make/unix.inc b/apps/codecs/dumb/make/unix.inc new file mode 100644 index 0000000000..89d47c0997 --- /dev/null +++ b/apps/codecs/dumb/make/unix.inc | |||
@@ -0,0 +1,20 @@ | |||
1 | # This file contains definitions suitable for Unix-compatible systems. It will | ||
2 | # be included by the main Makefile when you compile on such a system. | ||
3 | |||
4 | PLATFORM := unix | ||
5 | |||
6 | APOST := \' | ||
7 | |||
8 | # Macro that on DOS and Windows would replace / with \. Usage: $(call FIX,path) | ||
9 | FIX = $(1) | ||
10 | |||
11 | ECHO = @echo $(1) | ||
12 | DELETE = rm -f $(1) | ||
13 | COPY = cp $(1) $(2) | ||
14 | |||
15 | EXE_SUFFIX := | ||
16 | |||
17 | LINK_MATH := -lm | ||
18 | LINK_ALLEGRO := `allegro-config --libs` | ||
19 | |||
20 | # PREFIX is set by config.sh. | ||