COMMON_DIR = $(SRCDIR)/common
COMMON_LIB = $(COMMON_DIR)/frotz_common.a
-COMMON_DEFINES = $(COMMON_DIR)/defines.h
+COMMON_DEFINES = $(COMMON_DIR)/version.c
HASH = $(COMMON_DIR)/git_hash.h
CURSES_DIR = $(SRCDIR)/curses
$(MAKE) -C $@
$(SUB_CLEAN):
- $(MAKE) -C $(@:%-clean=%) clean
+ -$(MAKE) -C $(@:%-clean=%) clean
# Main programs
-frotz: $(COMMON_LIB) $(CURSES_LIB) $(BLORB_LIB)
- $(CC) $(CFLAGS) $^ -o $@$(EXTENSION) $(CURSES) $(LDFLAGS)
+frotz: $(COMMON_LIB) $(CURSES_LIB) $(BLORB_LIB) $(COMMON_LIB)
+ $(CC) $(CFLAGS) $+ -o $@$(EXTENSION) $(CURSES) $(LDFLAGS)
-dfrotz: $(COMMON_LIB) $(DUMB_LIB) $(BLORB_LIB)
- $(CC) $(CFLAGS) $^ -o $@$(EXTENSION)
+dfrotz: $(COMMON_LIB) $(DUMB_LIB) $(BLORB_LIB) $(COMMON_LIB)
+ $(CC) $(CFLAGS) $+ -o $@$(EXTENSION)
-sfrotz: $(COMMON_LIB) $(SDL_LIB) $(BLORB_LIB)
- $(CC) $(CFLAGS) $^ -o $@$(EXTENSION) $(LDFLAGS) $(SDL_LDFLAGS)
+sfrotz: $(COMMON_LIB) $(SDL_LIB) $(BLORB_LIB) $(COMMON_LIB)
+ $(CC) $(CFLAGS) $+ -o $@$(EXTENSION) $(LDFLAGS) $(SDL_LDFLAGS)
# Libs
$(CC) $(CFLAGS) -fPIC -fpic -o $@ -c $<
common_lib: $(COMMON_LIB)
-$(COMMON_LIB):
curses_lib: $(CURSES_LIB)
-$(CURSES_LIB):
dumb_lib: $(DUMB_LIB)
-$(DUMB_LIB):
blorb_lib: $(BLORB_LIB)
-$(BLORB_LIB):
# Defines
common_defines: $(COMMON_DEFINES)
$(COMMON_DEFINES):
@echo "Generating $@"
- @echo "#define VERSION \"$(VERSION)\"" > $@
- @echo "#define VERSION_MAJOR \"$(MAJOR)\"" >> $@
- @echo "#define VERSION_MINOR \"$(MINOR)\"" >> $@
- @echo "#define BUILD_DATE_TIME \"$(BUILD_DATE_TIME)\"" >> $@
+ @echo "#include \"frotz.h\"" > $@
+ @echo "const char frotz_version[] = \"$(VERSION)\";" >> $@
+ @echo "const char frotz_v_major[] = \"$(MAJOR)\";" >> $@
+ @echo "const char frotz_v_minor[] = \"$(MINOR)\";" >> $@
+ @echo "const char frotz_v_build[] = \"$(BUILD_DATE_TIME)\";" >> $@
curses_defines: $(CURSES_DEFINES)
$(CURSES_DEFINES):
git archive --format=tar.gz -o "frotz-$(GIT_TAG).tar.gz" "$(GIT_TAG)"
clean: $(SUB_CLEAN)
- rm -f $(SRCDIR)/*.h $(SRCDIR)/*.a $(COMMON_DIR)/defines.h \
- $(COMMON_DIR)/git_hash.h $(CURSES_DIR)/defines.h \
+ rm -f $(SRCDIR)/*.h $(SRCDIR)/*.a $(COMMON_DEFINES) \
+ $(COMMON_DIR)/git_hash.h $(CURSES_DEFINES) \
$(OBJECTS) frotz*.tar.gz
help:
blorb_lib common_lib curses_lib dumb_lib \
install install_dfrotz install_dumb \
uninstall uninstall_dfrotz uninstall_dumb $(SUBDIRS) $(SUB_CLEAN) \
- $(COMMON_DIR)/defines.h $(CURSES_DIR)/defines.h
+ $(COMMON_DIR)/version.c $(CURSES_DIR)/defines.h
SOURCES = buffer.c err.c fastmem.c files.c getopt.c hotkey.c input.c \
main.c math.c object.c process.c quetzal.c random.c redirect.c \
- screen.c sound.c stream.c table.c text.c variable.c
+ screen.c sound.c stream.c table.c text.c variable.c version.c
HEADERS = frotz.h setup.h unused.h
#define STACK_SIZE 1024
#endif
+extern const char
+ frotz_version[], frotz_v_major[], frotz_v_minor[], frotz_v_build[];
+
/* Assorted filename extensions */
#define EXT_SAVE ".qzl"
#include "ux_frotz.h"
#include "ux_blorb.h"
-#include "../common/defines.h"
-
volatile sig_atomic_t terminal_resized = 0;
static void sigwinch_handler(int);
} while (c != EOF);
if (zoptind != argc - 1) {
- printf("FROTZ V%s\t", VERSION);
+ printf("FROTZ V%s\t", frotz_version);
#ifndef NO_SOUND
printf("Audio output enabled.");
static void print_version(void)
{
- printf("FROTZ V%s\t", VERSION);
+ printf("FROTZ V%s\t", frotz_version);
#ifndef NO_SOUND
printf("Audio output enabled.");
#else
printf("\nGit commit:\t%s\n", GIT_HASH);
printf("Git tag:\t%s\n", GIT_TAG);
printf("Git branch:\t%s\n", GIT_BRANCH);
- printf("Build:\t\t%s\n", BUILD_DATE_TIME);
+ printf("Build:\t\t%s\n", frotz_v_build);
printf(" Frotz was originally written by Stefan Jokisch.\n");
printf(" It complies with standard 1.0 of Graham Nelson's specification.\n");
printf(" It was ported to Unix by Galen Hazelwood.\n");
#include "dumb_frotz.h"
#include "dumb_blorb.h"
-#include "../common/defines.h"
-
f_setup_t f_setup;
static char *my_strdup(char *);
} while (c != EOF);
if (((argc - zoptind) != 1) && ((argc - zoptind) != 2)) {
- printf("FROTZ V%s\tDumb interface.\n", VERSION);
+ printf("FROTZ V%s\tDumb interface.\n", frotz_version);
puts(INFORMATION);
printf("\t-Z # error checking mode (default = %d)\n"
"\t %d = don't report errors %d = report first error\n"
static void print_version(void)
{
- printf("FROTZ V%s\t", VERSION);
+ printf("FROTZ V%s\t", frotz_version);
printf("Dumb interface.\n");
printf("Git commit:\t%s\n", GIT_HASH);
printf("Git tag:\t%s\n", GIT_TAG);
#include <io.h>
#endif
-#include "../common/defines.h"
#include "sf_frotz.h"
f_setup_t f_setup;
static void usage()
{
char **p = infos; int i=0,len=0;
- printf(info1,VERSION,BUILD_DATE_TIME);
+ printf(info1, frotz_version, frotz_v_build);
while (*p)
{
if (i)
#include "generic.h"
-#include "../common/defines.h"
#include "sf_frotz.h"
static SDL_Rect blitrect = {0,0,0,0};
Uint32 initflags = SDL_INIT_VIDEO | SDL_INIT_NOPARACHUTE | SDL_INIT_TIMER |
SDL_INIT_AUDIO;
- sprintf(banner,"SDL Frotz v%s - %s (z%d)",VERSION,
- f_setup.story_name,h_version);
+ sprintf(banner, "SDL Frotz v%s - %s (z%d)",
+ frotz_version, f_setup.story_name, h_version);
desired_bpp = 32;
video_flags = 0;