From: Yann Dirson Date: Sun, 20 Oct 2013 19:29:45 +0000 (+0200) Subject: Use configure --enable-minishogi to select build of gnuminishogi. X-Git-Url: http://winboard.nl/cgi-bin?a=commitdiff_plain;h=cb4ec411aa1c818e5e8ac14e8cc31b3d4b87a546;p=gnushogi.git Use configure --enable-minishogi to select build of gnuminishogi. At the same time, provide an empty gnuminishogi.tbk so things work more as they should. Only the patterns are still necessary to specify manually at this point. --- diff --git a/.gitignore b/.gitignore index f11da0b..046ccbc 100644 --- a/.gitignore +++ b/.gitignore @@ -15,6 +15,8 @@ /gnushogi/pattern.inc /gnushogi/gnushogi /gnushogi/gnushogi.bbk +/gnushogi/gnuminishogi +/gnushogi/gnuminishogi.bbk /xshogi/scanner.c /xshogi/parser.c diff --git a/Makefile.in b/Makefile.in index 93b5f1d..2d89bad 100644 --- a/Makefile.in +++ b/Makefile.in @@ -30,11 +30,13 @@ BUILDROOT = @top_builddir@ GNUSHOGIDIR = $(BUILDROOT)/gnushogi XSHOGIDIR = $(BUILDROOT)/xshogi +PROGNAME = @PROGNAME@ + # # Default targets. # -all : gnushogi_compile pat2inc gnushogi.bbk @XSHOGI@ +all : gnushogi_compile pat2inc bbk @XSHOGI@ # @@ -42,7 +44,7 @@ all : gnushogi_compile pat2inc gnushogi.bbk @XSHOGI@ # gnushogi_compile: - -cd $(GNUSHOGIDIR) && $(MAKE) gnushogi + -cd $(GNUSHOGIDIR) && $(MAKE) $(PROGNAME) pat2inc: -cd $(GNUSHOGIDIR) && $(MAKE) pat2inc @@ -53,8 +55,8 @@ sizetest: xshogi_compile: -cd $(XSHOGIDIR) && $(MAKE) -gnushogi.bbk: - -cd $(GNUSHOGIDIR) && $(MAKE) gnushogi.bbk +bbk: + -cd $(GNUSHOGIDIR) && $(MAKE) $(PROGNAME).bbk # diff --git a/configure.ac b/configure.ac index 2f21d60..926f7f1 100644 --- a/configure.ac +++ b/configure.ac @@ -114,15 +114,15 @@ AC_CHECK_FUNCS(setlinebuf setvbuf) # # Set various user-definable options. # -# Valid OPT settings: -# --with-top-part-bitmaps -# -# Other settings: -# --with-first-shogi-program=PROGNAME -# --with-second-shogi-program=PROGNAME -# --with-first-host=HOSTNAME -# --with-second-host=HOSTNAME -# + +AC_ARG_ENABLE(minishogi, +[ --enable-minishogi + Build gnuminishogi instead of gnushogi (default: no)], +[AC_DEFINE([MINISHOGI], [], [Define to build gnuminishogi instead of gnushogi]) +AC_SUBST([PROGNAME], [gnuminishogi]) +], +[AC_SUBST([PROGNAME], [gnushogi]) +]) OPT= FIRST_SHOGI_PROGRAM=gnushogi diff --git a/gnushogi/Makefile.in b/gnushogi/Makefile.in index 05168ad..9ceb4e9 100644 --- a/gnushogi/Makefile.in +++ b/gnushogi/Makefile.in @@ -26,6 +26,7 @@ # # gnushogi is GNU shogi, for raw text, curses, or x output. +# gnuminishogi is GNU minishogi, for raw text, curses, or x output. # pat2inc converts pattern textfile to "pattern.inc" include file. # sizetest shows the memory usage of the main data structures. # @@ -40,6 +41,8 @@ SRCDIR = @srcdir@ VPATH=$(SRCDIR) +PROGNAME=@PROGNAME@ + # Installation directory. prefix = @prefix@ @@ -48,7 +51,7 @@ BINDIR = $(prefix)/bin # Where the language description, the book, and the # persistent hashtable live. -LIBDIR = $(prefix)/lib/gnushogi +LIBDIR = $(prefix)/lib/$(PROGNAME) # Where the man page goes. MANDIR = $(prefix)/man/man6 @@ -76,22 +79,22 @@ LDFLAGS = @LDFLAGS@ # The hashfile is a record of positions seen. It is used by # GNU Shogi to avoid making the same mistakes, a form of learning. -HASH = -DHASHFILE=\"$(LIBDIR)/gnushogi.hsh\" +HASH = -DHASHFILE=\"$(LIBDIR)/$(PROGNAME).hsh\" # The "book" is a record of the first few moves, for playing good # moves easily and quickly, saving time, and irritating the human # opponent. -TEXTBOOK = -DBOOK=\"$(LIBDIR)/gnushogi.tbk\" -BINBOOK = -DBINBOOK=\"$(LIBDIR)/gnushogi.bbk\" +TEXTBOOK = -DBOOK=\"$(LIBDIR)/$(PROGNAME).tbk\" +BINBOOK = -DBINBOOK=\"$(LIBDIR)/$(PROGNAME).bbk\" # The pattern file contains various opening patterns. The program tries to # obtain such a pattern in the opening stage. Sequences of opening # patterns may be described in order to support the correct order of moves. -PATTERNFILE=$(ROOT)/misc/gnushogi.pat +PATTERNFILE=$(ROOT)/misc/$(PROGNAME).pat PATTERN = -DPATTERNFILE=\"$(PATTERNFILE)\" @@ -133,8 +136,8 @@ PAT2INCFILES = $(COMMONFILES) makepattern.o pat2inc.o # Primary targets. # -gnushogi: - $(CC) $(CFLAGS) -o gnushogi $(GNUSHOGI_FILES) $(LDFLAGS) $(LCURSES) $(LIBS) +$(PROGNAME): + $(CC) $(CFLAGS) -o $(PROGNAME) $(GNUSHOGI_FILES) $(LDFLAGS) $(LCURSES) $(LIBS) pat2inc: $(CC) $(CFLAGS) -o pat2inc $(PAT2INCFILES) $(LDFLAGS) $(LCURSES) $(LIBS) @@ -224,11 +227,11 @@ pattern.inc: $(PATTERNFILE) pat2inc # Other targets. # -gnushogi.bbk: - @if [ -f ./gnushogi.bbk ]; then rm ./gnushogi.bbk; fi +$(PROGNAME).bbk: + @if [ -f ./$(PROGNAME).bbk ]; then rm ./$(PROGNAME).bbk; fi echo quit > test - cat $(ROOT)/misc/gnushogi.tbk > _tmp_t - cat test | ./gnushogi -R -b _tmp_t -B ./gnushogi.bbk -S 8000 -P 40 3 0 + cat $(ROOT)/misc/$(PROGNAME).tbk > _tmp_t + cat test | ./$(PROGNAME) -R -b _tmp_t -B ./$(PROGNAME).bbk -S 8000 -P 40 3 0 rm test _tmp_t @echo @@ -237,23 +240,23 @@ gnushogi.bbk: # Installation. # -install: gnushogi - strip gnushogi +install: $(PROGNAME) + strip $(PROGNAME) $(INSTALL_PROGRAM) -d $(BINDIR) $(INSTALL_PROGRAM) -d $(LIBDIR) $(INSTALL_PROGRAM) -d $(MANDIR) $(INSTALL_PROGRAM) -d $(INFODIR) - $(INSTALL_PROGRAM) gnushogi $(BINDIR) + $(INSTALL_PROGRAM) $(PROGNAME) $(BINDIR) $(INSTALL_DATA) $(ROOT)/doc/gnushogi.6 $(MANDIR) $(INSTALL_DATA) $(ROOT)/doc/gnushogi.info* $(INFODIR) - $(INSTALL_DATA) gnushogi.bbk $(LIBDIR)/gnushogi.bbk + $(INSTALL_DATA) $(PROGNAME).bbk $(LIBDIR)/$(PROGNAME).bbk # # Cleanup. # -CLEANFILES = *.o gnushogi sizetest pat2inc CLp* *.bbk +CLEANFILES = *.o gnushogi gnuminishogi sizetest pat2inc CLp* *.bbk clean: @for file in $(CLEANFILES); do \ @@ -265,7 +268,7 @@ clean: # Dependencies. # -gnushogi: $(GNUSHOGI_FILES) +$(PROGNAME): $(GNUSHOGI_FILES) pat2inc: $(PAT2INCFILES) sizetest: sizetest.o attacks.o: attacks.c gnushogi.h @@ -286,5 +289,5 @@ tcontrl.o: tcontrl.c gnushogi.h util.o: util.c gnushogi.h pat2inc.o: pat2inc.c $(SRCDIR)/pattern.h $(SRCDIR)/gnushogi.h sizetest.o: sizetest.c $(SRCDIR)/gnushogi.h $(SRCDIR)/eval.h -gnushogi.bbk: gnushogi +$(PROGNAME).bbk: $(PROGNAME) diff --git a/misc/gnuminishogi.tbk b/misc/gnuminishogi.tbk new file mode 100644 index 0000000..e69de29