Generating a demo version from production code

Richard A. O'Keefe ok at goanna.cs.rmit.oz.au
Thu Nov 22 15:36:33 AEST 1990


In article <6734 at uceng.UC.EDU> dmocsny at minerva.che.uc.edu (Daniel Mocsny) writes:
 ->I need to create a demonstration version of a C program. This demonstration
 ->program will preserve the user-interface and screen-handling of the

There's a fairly simple way of compiling several versions of a program
without interference.  I've tried this under both 4.3 BSD and V.3 UNIX.
The idea is that you have three directories:
	$PROG/			-- holds the sources
	$PROG/production/	-- where the production version gets built
	$PROG/demo/		-- where the demo version gets built.
In your Makefile, you have entries like
	foo.o: ../foo.c
		cc -c $(CFLAGS) ../foo.c
(well, that's the effect you want to generate).  Then
	cd $PROG/production
	make -f ../Makefile CFLAGS=-Udemo program
will make the production/program version, and
	cd $PROG/demo
	make -f ../Makefile CFLAGS=-Ddemo program
will make the demo/program version.  This relies on cc -c $DIR/$BASE.c
producing a $BASE.o file in the current directory, not in $DIR, but as
I say, I tried this in something claiming to be System V as well as in
something claiming to be BSD.  Something like this may work with other
systems.

A UNIX-specific technique is to use links, so that each of the demo/
and production/ directories _thinks_ it has a copy of the sources, but
is in fact sharing the master copy.
-- 
I am not now and never have been a member of Mensa.		-- Ariadne.



More information about the Comp.lang.c mailing list