XCOMM
XCOMM MiXViews - a sound editor and processor
XCOMM

XCOMM Note:  You must '#define HasGcc2 YES' in config/gcc.def to get the
XCOMM correct flags for the Gnu C and C++ compilers.
XCOMM If you cannot do that, then add that line immediately below this line.

CCSUFFIX = C

#ifdef InObjectCodeDir

XCOMM Set this to whichever you use for linking fortran code

APP_FORTLIBS = -lf2c

#if defined(SunArchitecture)

/* define one of the following on a Sparc system depending on your converter */

/* #define USE_SPARC */
/* #define USE_ADR   */
/* #define USR_PROPORT */

APP_FORTLIBS = -lf2c

#if HasGcc2
ARCH_NEWFLAG = -DUSE_CUSTOM_NEW
#else
ARCH_NEWFLAG =
#endif

/* flags for system with the native Sparc only */

#ifdef USE_SPARC
ARCH_CCDEFINES = $(ARCH_NEWFLAG) -DSPARC_DACS
ARCH_CCLDFLAGS = -L/usr/demo/SOUND
ARCH_CCINCLUDES = -I/usr/demo/SOUND
ARCH_CCLDLIBS = -laudio $(APP_FORTLIBS) -lm
DAC_OBJS = conv_config.o conv_device.o sun_dac.o
#endif

/* flags for system with the Analog Digital converter */

#ifdef USE_ADR
ARCH_CCDEFINES = $(ARCH_NEWFLAG) -DADC_DACS
ARCH_CCLDFLAGS = -L/usr/demo/SOUND -L/usr/local/src/adc
ARCH_CCINCLUDES =  -I/usr/demo/SOUND -I/usr/local/src/adc
ARCH_CCLDLIBS = -laudio -ladc $(APP_FORTLIBS) -lm 
DAC_OBJS = conv_config.o adc_dac.o
#endif

/* flags for system with the Ariel S56x converter */

#ifdef USE_PROPORT
S56DIR = ../s56x
ARCH_CCDEFINES = $(ARCH_NEWFLAG) -DSPARC_DACS -DPROPORT_DACS
ARCH_CCLDFLAGS = -L/usr/demo/SOUND -L$(S56DIR)/lib
ARCH_CCINCLUDES = -I/usr/demo/SOUND -I$(S56DIR)/include
ARCH_CCLDLIBS = -laudio -ldrp -lqckMon $(APP_FORTLIBS) -lm
DAC_OBJS = conv_config.o conv_device.o sun_dac.o proport_dac.o
#endif

ARCH_OBJS =

DEBUG_CCFLAGS = # -Ddebug
PURIFY_OPTIONS=\
-always-use-cache-dir \
-suppression-file-names=.purify,.purify.sunos4,./.purify \
-collector=/usr/local/lib/gcc-lib/'sparc-sun-sunos4.1'/2.6.3/ld \
-fds-inuse-at-exit=no -chain-length=12

PURECOV_OPTIONS=\
-always-use-cache-dir \
-collector=/usr/local/lib/gcc-lib/'sparc-sun-sunos4.1'/2.6.3/ld

#if defined(UseDebug)
DEBUG_CCLDLIBS = /usr/lib/debug/malloc.o
#endif
#endif

#if defined(NeXTArchitecture)
ARCH_CCFLAGS = -pipe
ARCH_CCDEFINES = -DINLINE_MATH -DUSE_CUSTOM_NEW
ARCH_CCINCLUDES =
ARCH_CCLDFLAGS =
ARCH_CCLDLIBS = $(APP_FORTLIBS)

DAC_OBJS = conv_config.o next_dac.o
ARCH_OBJS =

DEBUG_CCFLAGS = -Ddebug
#if defined(UseDebug)
DEBUG_CCLDLIBS = -lMallocDebug
#endif
#endif

#if defined(SGIArchitecture)

XCOMM The ARCH flags are set based on whether or not a Gnu compiler is used

#if !HasGcc2
ARCH_CCFLAGS = -O -w -signed
ARCH_CCDEFINES = -DNO_NEW_HANDLER -DNO_TEMPLATES -DAIFF_AUDIO -DSGI_DACS
ARCH_CCINCLUDES = -I../g++
ARCH_OBJS = sgi-channelview.o String.o Complex.o Regex.o regex.o error.o
#else
ARCH_CCDEFINES = -DAIFF_AUDIO -DSGI_DACS
ARCH_CCFLAGS=
ARCH_OBJS =
#endif

ARCH_CCLDFLAGS = -L/usr/local/lib
ARCH_CCLDLIBS = -laudio -laudiofile -laudioutil $(APP_FORTLIBS) -lm

DAC_OBJS = conv_config.o sgi_dac.o
APP_FORTLIBS = -lftn

DEBUG_CCFLAGS = -Ddebug
#if defined(UseDebug)
DEBUG_CCLDLIBS =
#endif
#endif

#if defined(LinuxArchitecture)
XCOMM Extra defines, include directories, loading flags, and libraries needed
XCOMM for the Linux version.  The assumption is that you are using Gnu gcc/g++

ARCH_CCDEFINES = -DVOXWARE -DXDisplay=_XDisplay
ARCH_CCFLAGS = -fkeep-inline-functions -mieee-fp
ARCH_CCINCLUDES =
ARCH_CCLDFLAGS =
ARCH_CCLDLIBS = $(APP_FORTLIBS) -lm -lieee
DEBUG_CCFLAGS = -Ddebug

DAC_OBJS = conv_config.o conv_device.o vw_converter.o
ARCH_OBJS = utils.o
#endif

#if defined(i386SVR4Architecture)
XCOMM This assumes you have the SoundBlaster card on your machine
ARCH_CCDEFINES = -DSOUNDBLASTER
ARCH_CCINCLUDES =
ARCH_CCLDFLAGS =
ARCH_CCLDLIBS = -lm -lPW -lmalloc
DEBUG_CCFLAGS = -Ddebug
#if defined(UseDebug)
DEBUG_CCLDLIBS =
#endif
#endif

XCOMM These flags may need to be edited depending on your system

#if HasGcc2
CC = gcc -pipe -Wall $(OPTIMIZE_CCFLAGS) -finline-functions
GNU_CCFLAGS = $(OPTIMIZE_CCFLAGS) -Wall -Wno-unused -Wno-import -Wno-extern-inline
#else
CC = cc -O
GNU_CCFLAGS = $(OPTIMIZE_CCFLAGS)
#endif

XCOMM Be sure to remove the -DIV_IS_PATCHED flag if using InterViews 3.1

APP_CCFLAGS = $(GNU_CCFLAGS) $(ARCH_CCFLAGS)
APP_CCDEFINES = $(ARCH_CCDEFINES) -DIV_IS_PATCHED -DNDEBUG
APP_CCINCLUDES = -I$(SRC) $(ARCH_CCINCLUDES)
APP_CCLDFLAGS = -L. $(ARCH_CCLDFLAGS)
APP_CCLDLIBS = $(DEBUG_CCLDLIBS) -lcfuns $(ARCH_CCLDLIBS)
APP_CCDEPLIBS = libcfuns.a

FLAGS = $(ARCH_CCDEFINES) $(EXTRA_CCFLAGS)

BINDIR = /usr/local/bin

AOUT = mxv

Use_libInterViews()
Use_2_6()

FUTURE_OBJS = contscroller.o adjtext.o editcommand.o commandlookup.o

OBJS = application.o main.o format.o selector.o graphplot.o vmessage.o \
rubbertext.o numberlabel.o scaledarea.o graph.o channelgraph.o framegraph.o \
scale.o dataview.o channelview.o frameview.o viewchanger.o framedwindow.o \
datawindow.o textwindow.o scroller.o menus.o editor.o edit_menus.o \
edit_request.o soundeditor.o pvoceditor.o controller.o version.o \
buttonarray.o dialogbox.o fileselector.o optionsetter.o \
dialog_ctor.o comment.o commenteditor.o filename.o controller_conv.o \
statuspanel.o textinput.o testit.o buffer.o queue.o wavetable.o \
windowtable.o requester.o modifier.o datamodifier.o processfun.o \
outputfunction.o iofunction.o interpolater.o synthfunction.o pitchconv.o \
combfilter.o rescaler.o filecommand.o analysisfun.o \
lowpassfilter.o phraser.o reson.o delay.o array.o arrayfunction.o iallpole.o \
lpcfilter.o formantfilter.o formantsynth.o pitchtracker.o pulsegen.o fftfun.o \
pvocmodifier.o crossfader.o curvegen.o ellipfilt.o phasevocoder.o \
pvanalyzer.o pvsynthesizer.o new.o diskfile.o datafile.o diskstruct.o header.o \
soundheader.o aiff_header.o wavheader.o pvocheader.o cs_pvocheader.o ieee_float.o \
repclone.o datarep.o data.o framedata.o lpcdata.o pchdata.o pvocdata.o \
sound.o fftdata.o envelope.o query.o request.o header_config.o smpte.o \
compressor.o $(ARCH_OBJS) converter.o $(DAC_OBJS)

ComplexProgramTarget(mxv)

MakeObjectFromSrc(converter)
MakeObjectFromSrc(conv_config)

XCOMM The following are system-dependent objects

#if defined(SunArchitecture)
MakeObjectFromSrc(conv_device)
MakeObjectFromSrc(sun_dac)
#ifdef USE_ADR
MakeObjectFromSrc(adc_dac)
#endif
#ifdef USE_PROPORT
MakeObjectFromSrc(proport_dac)
#endif
#endif
#if defined(NeXTArchitecture)
MakeObjectFromSrc(next_dac)
#endif
#if defined(SGIArchitecture)
MakeObjectFromSrc(sgi_dac)
#endif
#if defined(LinuxArchitecture)
MakeObjectFromSrc(utils)
MakeObjectFromSrc(conv_device)
MakeObjectFromSrc(vw_converter)
#endif
#if defined(i386SVR3Architecture)
MakeObjectFromSrc(conv_device)
MakeObjectFromSrc(soundblaster)
#endif

XCOMM End of system-dependent objects

MakeObjectFromSrc(new)
MakeObjectFromSrc(diskstruct)
MakeObjectFromSrc(ieee_float)
MakeObjectFromSrc(header)
MakeObjectFromSrc(header_config)
MakeObjectFromSrc(soundheader)
MakeObjectFromSrc(aiff_header)
MakeObjectFromSrc(wavheader)
MakeObjectFromSrc(pvocheader)
MakeObjectFromSrc(cs_pvocheader)
MakeObjectFromSrc(diskfile)
MakeObjectFromSrc(datafile)
MakeObjectFromSrc(compressor)
MakeObjectFromSrc(datarep)
MakeObjectFromSrc(repclone)
MakeObjectFromSrc(data)
MakeObjectFromSrc(envelope)
MakeObjectFromSrc(framedata)
MakeObjectFromSrc(fftdata)
MakeObjectFromSrc(lpcdata)
MakeObjectFromSrc(pchdata)
MakeObjectFromSrc(pvocdata)
MakeObjectFromSrc(sound)
MakeObjectFromSrc(query)
MakeObjectFromSrc(request)

MakeObjectFromSrc(buffer)
MakeObjectFromSrc(queue)
MakeObjectFromSrc(array)
MakeObjectFromSrc(wavetable)
MakeObjectFromSrc(windowtable)
MakeObjectFromSrc(pitchconv)
MakeObjectFromSrc(requester)
MakeObjectFromSrc(modifier)
MakeObjectFromSrc(datamodifier)
MakeObjectFromSrc(filecommand)
MakeObjectFromSrc(editcommand)
MakeObjectFromSrc(optionsetter)
MakeObjectFromSrc(crossfader)
MakeObjectFromSrc(pvocmodifier)
MakeObjectFromSrc(processfun)
MakeObjectFromSrc(lowpassfilter)
MakeObjectFromSrc(phraser)
MakeObjectFromSrc(rescaler)
MakeObjectFromSrc(reson)
MakeObjectFromSrc(outputfunction)
MakeObjectFromSrc(synthfunction)
MakeObjectFromSrc(curvegen)
MakeObjectFromSrc(iofunction)
MakeObjectFromSrc(interpolater)
MakeObjectFromSrc(combfilter)
MakeObjectFromSrc(delay)
MakeObjectFromSrc(pulsegen)
MakeObjectFromSrc(analysisfun)
MakeObjectFromSrc(arrayfunction)
MakeObjectFromSrc(iallpole)
MakeObjectFromSrc(lpcfilter)
MakeObjectFromSrc(formantfilter)
MakeObjectFromSrc(formantsynth)
MakeObjectFromSrc(pitchtracker)
MakeObjectFromSrc(fftfun)
MakeObjectFromSrc(phasevocoder)
MakeObjectFromSrc(pvanalyzer)
MakeObjectFromSrc(pvsynthesizer)
MakeObjectFromSrc(ellipfilt)

MakeObjectFromSrc(application)
MakeObjectFromSrc(controller_conv)
MakeObjectFromSrc(menus)
MakeObjectFromSrc(scaledarea)
MakeObjectFromSrc(scale)
MakeObjectFromSrc(graphplot)
MakeObjectFromSrc(graph)
MakeObjectFromSrc(channelgraph)
MakeObjectFromSrc(framegraph)
MakeObjectFromSrc(selector)
MakeObjectFromSrc(rubbertext)
MakeObjectFromSrc(dataview)
MakeObjectFromSrc(viewchanger)
MakeObjectFromSrc(channelview)
MakeObjectFromSrc(frameview)
MakeObjectFromSrc(framedwindow)
MakeObjectFromSrc(comment)
MakeObjectFromSrc(commenteditor)
MakeObjectFromSrc(textwindow)
MakeObjectFromSrc(datawindow)
MakeObjectFromSrc(statuspanel)
MakeObjectFromSrc(version)
MakeObjectFromSrc(controller)
MakeObjectFromSrc(scroller)
MakeObjectFromSrc(contscroller)
MakeObjectFromSrc(textinput)
MakeObjectFromSrc(adjtext)
MakeObjectFromSrc(buttonarray)
MakeObjectFromSrc(dialogbox)
MakeObjectFromSrc(fileselector)
MakeObjectFromSrc(dialog_ctor)
MakeObjectFromSrc(commandlookup)
MakeObjectFromSrc(editor)
MakeObjectFromSrc(edit_menus)
MakeObjectFromSrc(edit_request)
MakeObjectFromSrc(pvoceditor)
MakeObjectFromSrc(soundeditor)
MakeObjectFromSrc(format)
MakeObjectFromSrc(main)
MakeObjectFromSrc(filename)
MakeObjectFromSrc(smpte)
MakeObjectFromSrc(vmessage)
MakeObjectFromSrc(numberlabel)
MakeObjectFromSrc(testit)

#if defined(SGIArchitecture) && !HasGcc2

MakeObjectFromSrc(sgi-channelview)

XCOMM The following targets are for the bare minimum objects needed from libg++
XCOMM in order to link on SGI machines (for users running the native SGI CC)

LIBSRC = $(SRC)/g++lib

MakeObjectRule(error, $(LIBSRC)/error, NullParameter)
MakeObjectRule(regex, $(LIBSRC)/regex, NullParameter)
MakeObjectRule(Regex, $(LIBSRC)/Regex, NullParameter)
MakeObjectRule(String, $(LIBSRC)/String, NullParameter)
MakeObjectRule(Complex, $(LIBSRC)/Complex, NullParameter)

#endif

LIBCFUNS = libcfuns.a
CFUNOBJS = ellipse.o kaiser.o mxfft.o i1mach.o

$(LIBCFUNS): ellipse.o
ellipse.o: $(SRC)/ellipse.c
	@$(RM) ellipse.o
	$(CC) $(FLAGS) -c $(SRC)/ellipse.c	

$(LIBCFUNS): kaiser.o
kaiser.o: $(SRC)/kaiser.c
	@$(RM) kaiser.o
	$(CC) $(FLAGS) -c $(SRC)/kaiser.c	

$(LIBCFUNS): mxfft.o
mxfft.o: $(SRC)/mxfft.c
	@$(RM) mxfft.o
	$(CC) $(FLAGS) -c $(SRC)/mxfft.c	

$(LIBCFUNS): i1mach.o
i1mach.o: $(SRC)/i1mach.c
	@$(RM) i1mach.o
	$(CC) $(FLAGS) -c $(SRC)/i1mach.c	

NormalNonSharedLibraryTarget(cfuns,NullParameter,$(CFUNOBJS))

mxv.pure:	$(OBJS) libcfuns.a
	purify $(PURIFY_OPTIONS) $(CCDRIVER) $(CFLAGS) -o mxv.pure $(OBJS) $(CCLDFLAGS) $(CCLDLIBS)

mxv.pure.purecov:	$(OBJS) libcfuns.a
	purify $(PURIFY_OPTIONS) purecov $(PURECOV_OPTIONS) $(CCDRIVER) $(CFLAGS) -o mxv.pure.purecov $(OBJS) $(CCLDFLAGS) $(CCLDLIBS)

mxv.pho:
	-mv *.o objs
	$(MAKE) CCDRIVER='phog++ echo' CC='phogcc echo'
	-mv objs$(SLASH)*.o .

#else

MakeInObjectCodeDir()

COMPRESS = gzip
UNCOMPRESS = gunzip

#ifdef USE_ADR
SPECIAL_IMAKEFLAGS=-DIVUseInstalled -DUseInstalled -DUSE_ADR
#endif
#ifdef USE_SPARC
SPECIAL_IMAKEFLAGS=-DIVUseInstalled -DUseInstalled -DUSE_SPARC
#endif
#ifdef USE_PROPORT
SPECIAL_IMAKEFLAGS=-DIVUseInstalled -DUseInstalled -DUSE_PROPORT
#endif

dist:
	tar cvf - Imake* CHANGES README* mxv.doc mxv.bitmap *.[$(CCSUFFIX)ch]  | $(COMPRESS) > dist.tar.gz

uu: dist
	uuencode dist.tar.gz dist.tar.gz > dist.uu
	rm dist.tar.gz

mail: uu
	cat dist.uu | mail -s my_program me
	rm dist.uu

backup: dist
	@cd old; rm -r -f *
	mv dist.tar.gz old

compare:
	-@for file in *.[$(CCSUFFIX)ch]; \
	do \
	(diff -c sparc/$$file $$file); \
	done

diff:
	@cd old; cat dist.tar.gz | $(UNCOMPRESS) | tar xf -
	-@for file in *.[$(CCSUFFIX)ch]; \
		do \
			if [ ! -f old/$$file ]; then \
					(touch old/$$file); \
			fi; \
		done
	-/bin/diff -c -r old . | grep -v "^Only" | grep -v "^Common" > diffs.NEW
	$(MAKE) backup

newtar:
	tar cvf - `find . \( -name "*.[Cch]" -o -name "I*" -o -name CHANGES \) -a -type f -a -mtime -2 -print` | $(COMPRESS) > new.tar.gz

newmail: newtar
	cat new.tar.gz | uuencode new.tar.gz | mail -s 'new.tar.gz.uu' home
	rm new.tar.gz

tags:
	ctags -d *.[$(CCSUFFIX)ch]

copy:
	cp -p Imakefile CHANGES README* mxv.doc mxv.bitmap *.[Cch] sparc

#endif

