Hi there,
attached are the files needed to compile the Pd 0.36 *developer* branch from CVS for SGI IRIX 6.5. I'm too lazy to learn how to check in my stuff (since I'm a "stupid windows user"*), so maybe someone could do me a favour and check these files in.
Changes to the original version are:
makefile.irix:
- compiles on IRIX 6.5 using GCC (n32 or o32 binaries)
t_main.c:
- small change to remove 'unresolved external symbol' error
sgi.c:
- using new audio API (al* instead of AL*)
- made -audiodev and -audioindev & -audiooutdev working, specifying no audio device (or -1) results in the default device selected in 'Audio Panel' being used
- added support for multiple audio devices: use -audiodev 1,3 -channels 2,8 to open stereo AnalogIO and 8 channel ADAT-IO to get a total of 10 channels
- made -r working, it now overwrites the sample rate setting in audio panel and defaults to 44100 Hz
- made -realtime (-rt) work: pd runs with a priority of 192, pd-watchdog with 250 and the pd-gui with 20 to overcome audio drops
- memory locking when in realtime mode
- added -listdev printout
Many thanks for checking it in! BTW, this is based on a checkout I did on Dec. 16th, just in case anything changed in t_main.c in the meantime.
best, Olaf
PS: n32 binaries of the above available from http://www.nullmedium.de/dev/irix/
* forgot who coined the term, sorry
/* Copyright (c) 1997-1999 Miller Puckette. * For information on usage and redistribution, and for a DISCLAIMER OF ALL * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */
/* changes added my Olaf Matthes olaf.matthes@gmx.de on 15th Oct. 2003:
- added priority scheduling (-rt flag) - added memlocking (-rt flag) - changed to new audio API (al instead of AL)
*/ /* changes added my Olaf Matthes olaf.matthes@gmx.de on 16th Nov. 2003:
- support for multiple devices: in the end nearly completely rewrote this file and removed a lot of Soerens changes from s_main.c
*/
#include "m_imp.h" #include <stdio.h> #include <stdlib.h> #include <unistd.h> #include <string.h> #ifdef HAVE_BSTRING_H #include <bstring.h> #endif #include <sys/types.h> #include <sys/time.h> #include <sys/mman.h> #include <sched.h>
#include <dmedia/audio.h> #include <dmedia/midi.h> #include <sys/fpu.h> int mdInit(void); /* prototype was messed up in midi.h */
#define SGI_MAXCH 12 /* 2 x stereo plus 8 ADATA */ #define MAXAUDIODEV 3 /* applies for my Octane */ #define DEFAULTCHANS 2 /* stereo as our default */ #define DEFAULTINDEV -1 /* use defaults from audio panel */ #define DEFAULTOUTDEV -1
static ALport iport[MAXAUDIODEV]; static ALport oport[MAXAUDIODEV]; static ALconfig sgi_inconfig; static ALconfig sgi_outconfig; static int sys_inchannels, sys_outchannels; static int sys_nindevs, sys_noutdevs; static int sys_ninchans[MAXAUDIODEV], sys_noutchans[MAXAUDIODEV]; static int sys_audiobufsamps; int sys_schedadvance = 50000; /* scheduler advance in microseconds */ /* (this is set ridiculously high until we can get the real-time scheduling act together.) */ int sys_hipriority = 0; static int sgi_meters; /* true if we're metering */ static float sgi_inmax; /* max input amplitude */ static float sgi_outmax; /* max output amplitude */
/* set the special "flush zero" but (FS, bit 24) in the Control Status Register of the FPU of R4k and beyond so that the result of any underflowing operation will be clamped to zero, and no exception of any kind will be generated on the CPU.
thanks to cpirazzi@cp.esd.sgi.com (Chris Pirazzi). */
static void sgi_flush_all_underflows_to_zero(void) { union fpc_csr f; f.fc_word = get_fpc_csr(); f.fc_struct.flush = 1; set_fpc_csr(f.fc_word); }
/* convert the most common errors into readable strings */ static char *sgi_get_error_message(int err) { switch (err) { case AL_BAD_CONFIG: return "Invalid config";
case AL_BAD_DIRECTION: return "Invalid direction (neither "r" nor "w")";
case AL_BAD_OUT_OF_MEM: return "Not enough memory";
case AL_BAD_DEVICE_ACCESS: return "Audio hardware is not available or is improperly configured";
case AL_BAD_DEVICE: return "Invalid device";
case AL_BAD_NO_PORTS: return "No audio ports available";
case AL_BAD_QSIZE: return "Invalid fifo size";
case AL_BAD_SAMPFMT: return "Invalid sample format";
case AL_BAD_FLOATMAX: return "Invalid float maximum";
case AL_BAD_WIDTH: return "Invalid sample width";
default: return "Unknown error"; } }
static void sgi_setsr(int sr) { sys_dacsr = sr; sys_audiobufsamps = (sys_schedadvance * sys_dacsr) / (1000000.); if (sys_audiobufsamps < 3 * DACBLKSIZE) sys_audiobufsamps = 3 * DACBLKSIZE; }
static void sgi_setch(int inchans, int outchans) { int inbytes = inchans * (DACBLKSIZE*sizeof(float)); int outbytes = outchans * (DACBLKSIZE*sizeof(float));
sys_inchannels = inchans; sys_outchannels = outchans;
if (sys_soundin) free(sys_soundin); sys_soundin = (t_float *)malloc(inbytes); memset(sys_soundin, 0, inbytes);
if (sys_soundout) free(sys_soundout); sys_soundout = (t_float *)malloc(outbytes); memset(sys_soundout, 0, outbytes);
if (sys_verbose) post("input channels = %d, output channels = %d", sys_inchannels, sys_outchannels); }
static void sgi_open_audio(int nindev, int *indev, int nchin, int *chin, int noutdev, int *outdev, int nchout, int *chout, int rate) { ALpv pvbuf[2]; int num_devs = 0; int in_dev = 0; int out_dev = 0; int inchans = 0; int outchans = 0; int err, n;
sgi_setsr(rate);
for (n = 0; n < nindev; n++) { int gotchannels = 0; int thisdevice = indev[n]; int wantchannels = chin[n]; char *indevnames[4] = {"DefaultIn", "AnalogIn", "AESIn", "ADATIn"};
if(thisdevice > 0) /* open specified defice by name */ { if(sys_verbose)post("opening %s", indevnames[thisdevice]); in_dev = alGetResourceByName(AL_SYSTEM, indevnames[thisdevice], AL_DEVICE_TYPE); } else /* open default device */ { if(sys_verbose)post("opening %s", indevnames[0]); in_dev = AL_DEFAULT_INPUT; } if(!in_dev) { error("%s\n", sgi_get_error_message(in_dev)); continue; /* try next device, if any */ }
sgi_inconfig = alNewConfig(); alSetSampFmt(sgi_inconfig, AL_SAMPFMT_FLOAT); alSetFloatMax(sgi_outconfig, 1.1f); alSetChannels(sgi_outconfig, chin[n]); alSetQueueSize(sgi_inconfig, sys_audiobufsamps * chin[n]); alSetDevice(sgi_inconfig, in_dev); iport[n] = alOpenPort("Pd input port", "r", sgi_inconfig); if (!iport[n]) fprintf(stderr,"Pd: failed to open audio read port\n");
/* now try to set sampl erate */ pvbuf[0].param = AL_RATE; pvbuf[0].value.ll = alDoubleToFixed(rate); if((err = alSetParams(in_dev, pvbuf, 1)) < 0) { post("could not set specified sample rate for input (%s)\n", sgi_get_error_message(err)); if(pvbuf[0].sizeOut < 0) post("rate was invalid\n"); } /* check how many channels we actually got */ pvbuf[0].param = AL_CHANNELS; if(alGetParams(in_dev, pvbuf, 1) < 0) { post("could not figure out how many input channels we got"); gotchannels = chin[n]; /* assume we got them all */ } else { gotchannels = pvbuf[0].value.i; } inchans += gotchannels; /* count total number of channels */ sys_ninchans[n] = gotchannels; /* remember channels for this device */ }
for (n = 0; n < noutdev; n++) { int gotchannels; int thisdevice = outdev[n]; int wantchannels = chout[n]; char *outdevnames[4] = {"DefaultOut", "AnalogOut", "AESOut", "ADATOut"};
if(thisdevice > 0) /* open specified defice by name */ { if(sys_verbose)post("opening %s", outdevnames[thisdevice]); out_dev = alGetResourceByName(AL_SYSTEM, outdevnames[thisdevice], AL_DEVICE_TYPE); } else /* open default device */ { if(sys_verbose)post("opening %s", outdevnames[0]); out_dev = AL_DEFAULT_OUTPUT; } if(!out_dev) { error("%s\n", sgi_get_error_message(out_dev)); continue; /* try next device, if any */ }
/* configure the port before opening it */ sgi_outconfig = alNewConfig(); alSetSampFmt(sgi_outconfig, AL_SAMPFMT_FLOAT); alSetFloatMax(sgi_outconfig, 1.1f); alSetChannels(sgi_outconfig, chout[n]); alSetQueueSize(sgi_outconfig, sys_audiobufsamps * chout[n]); alSetDevice(sgi_outconfig, out_dev);
/* open the port */ oport[n] = alOpenPort("Pd ouput port", "w", sgi_outconfig); if (!oport[n]) fprintf(stderr,"Pd: failed to open audio write port\n");
/* now try to set sample rate */ pvbuf[0].param = AL_RATE; pvbuf[0].value.ll = alDoubleToFixed(rate); if((err = alSetParams(out_dev, pvbuf, 1)) < 0) { post("could not set specified sample rate for output (%s)\n", sgi_get_error_message(err)); if(pvbuf[0].sizeOut < 0) post("rate was invalid\n"); } /* check how many channels we actually got */ pvbuf[0].param = AL_CHANNELS; if(alGetParams(out_dev, pvbuf, 1) < 0) { post("could not figure out how many output channels we got"); gotchannels = chout[n]; } else { gotchannels = pvbuf[0].value.i; } outchans += gotchannels; sys_noutchans[n] = gotchannels; }
sys_noutdevs = noutdev; sys_nindevs = nindev;
/* allocate memory for the number of channels we got */ sgi_setch(inchans, outchans); }
void sys_close_audio(void) { /* this never gets called anyway... ;-( */ #if 0 if (iport[n]) alClosePort(iport); if (oport[n]) alClosePort(oport); #endif }
void sys_close_midi( void) { /* ??? */ }
t_sample *sys_soundout; t_sample *sys_soundin; float sys_dacsr;
int sys_send_dacs(void) { float buf[SGI_MAXCH * DACBLKSIZE], *fp1, *fp2, *fp3, *fp4; long outfill[MAXAUDIODEV], infill[MAXAUDIODEV]; long minoutfill = 100000000; int outchannels = sys_outchannels, inchannels = sys_inchannels; int outdevchannels, indevchannels; int i, n, nwait = 0, channel; int outblk = DACBLKSIZE; int inblk = DACBLKSIZE;
/* take a lok how much audio data we have available */ for(n = 0; n < sys_noutdevs; n++) { outfill[n] = alGetFillable(oport[n]); if(minoutfill > outfill[n]) minoutfill = outfill[n]; } for(n = 0; n < sys_nindevs; n++) infill[n] = alGetFilled(iport[n]);
/* calculate values for level meter */ if (sgi_meters) { float maxsamp; for (i = 0, n = sys_inchannels * DACBLKSIZE, maxsamp = sgi_inmax; i < n; i++) { float f = sys_soundin[i]; if (f > maxsamp) maxsamp = f; else if (-f > maxsamp) maxsamp = -f; } sgi_inmax = maxsamp; for (i = 0, n = sys_outchannels * DACBLKSIZE, maxsamp = sgi_outmax; i < n; i++) { float f = sys_soundout[i]; if (f > maxsamp) maxsamp = f; else if (-f > maxsamp) maxsamp = -f; } sgi_outmax = maxsamp; }
if (!outchannels && !inchannels) return(1);
/* no need to output data, check input */ if((minoutfill <= DACBLKSIZE) && sys_nindevs) { i = 0; for(n = 0; n < sys_nindevs; n++) { /* we jsut throw away the input in case it is getting too much by the time */ while((infill[n] = alGetFilled(iport[n])) > (4*DACBLKSIZE)) { alReadFrames(iport[n], buf, DACBLKSIZE); i = 1; /* indicate we really did it */ } } if(sys_verbose && i)post("drop ADC buf"); return (0); } /* output audio data, if we use audio out */ if(sys_noutdevs) { fp2 = sys_soundout; /* point to current output position in buffer */ for(n = 0; n < sys_noutdevs; n++) { outdevchannels = sys_noutchans[n]; /* channels supported by this device */
for (channel = 0, fp1 = buf; channel < outdevchannels; channel++, fp1++, fp2 += DACBLKSIZE) { for (i = 0, fp3 = fp1, fp4 = fp2; i < DACBLKSIZE; i++, fp3 += outdevchannels, fp4++) *fp3 = *fp4, *fp4 = 0; } alWriteFrames(oport[n], buf, DACBLKSIZE); } } /* get audio data from input, if we use audio in */ if(sys_nindevs) { fp2 = sys_soundin; /* point to current input position in buffer */ for(n = 0; n < sys_nindevs; n++) { indevchannels = sys_ninchans[n]; /* channels supported by this device */
if (alGetFilled(iport[n]) > DACBLKSIZE) { alReadFrames(iport[n], buf, DACBLKSIZE); } else /* have to read but nothing's there... */ { if (sys_verbose) post("extra ADC buf"); /* set buffer to silende */ memset(buf, 0, inblk*sizeof(float)); } for (channel = 0, fp1 = buf; channel < indevchannels; channel++, fp1++, fp2 += DACBLKSIZE) { for (i = 0, fp3 = fp1, fp4 = fp2; i < DACBLKSIZE; i++, fp3 += indevchannels, fp4++) *fp4 = *fp3; } } } return (1); }
/* ------------------------- MIDI -------------------------- */
#define NPORT 2
static MDport sgi_inport[NPORT]; static MDport sgi_outport[NPORT];
void sgi_open_midi(int midiin, int midiout) { int i; int sgi_nports = mdInit(); if (sgi_nports < 0) sgi_nports = 0; else if (sgi_nports > NPORT) sgi_nports = NPORT; if (sys_verbose) { if (!sgi_nports) { post("no serial ports are configured for MIDI;"); post("if you want to use MIDI, try exiting Pd, typing"); post("'startmidi -d /dev/ttyd2' to a shell, and restarting Pd."); } else if (sgi_nports == 1) post("Found one MIDI port on %s", mdGetName(0)); else if (sgi_nports == 2) post("Found MIDI ports on %s and %s", mdGetName(0), mdGetName(1)); } if (midiin) { for (i = 0; i < sgi_nports; i++) { if (!(sgi_inport[i] = mdOpenInPort(mdGetName(i)))) error("MIDI input port %d: open failed", i+1);; } } if (midiout) { for (i = 0; i < sgi_nports; i++) { if (!(sgi_outport[i] = mdOpenOutPort(mdGetName(i)))) error("MIDI output port %d: open failed", i+1);; } } return; }
void sys_putmidimess(int portno, int a, int b, int c) { MDevent mdv; if (portno >= NPORT || portno < 0 || !sgi_outport[portno]) return; mdv.msg[0] = a; mdv.msg[1] = b; mdv.msg[2] = c; mdv.msg[3] = 0; mdv.sysexmsg = 0; mdv.stamp = 0; mdv.msglen = 0; if (mdSend(sgi_outport[portno], &mdv, 1) < 0) error("MIDI output error\n"); post("msg out %d %d %d", a, b, c); }
void sys_putmidibyte(int portno, int foo) { error("MIDI raw byte output not available on SGI"); }
void inmidi_noteon(int portno, int channel, int pitch, int velo); void inmidi_controlchange(int portno, int channel, int ctlnumber, int value); void inmidi_programchange(int portno, int channel, int value); void inmidi_pitchbend(int portno, int channel, int value); void inmidi_aftertouch(int portno, int channel, int value); void inmidi_polyaftertouch(int portno, int channel, int pitch, int value);
void sys_poll_midi(void) { int i; MDport *mp; for (i = 0, mp = sgi_inport; i < NPORT; i++, mp++) { int ret, nfds; MDevent mdv; fd_set inports; struct timeval timeout; timeout.tv_sec = 0; timeout.tv_usec = 0; if (!*mp) continue; FD_ZERO(&inports); FD_SET(mdGetFd(*mp), &inports);
if (select(mdGetFd(*mp)+1 , &inports, 0, 0, &timeout) < 0) perror("midi select"); if (FD_ISSET(mdGetFd(*mp),&inports)) { if (mdReceive(*mp, &mdv, 1) < 0) error("failure receiving message\n"); else if (mdv.msg[0] == MD_SYSEX) mdFree(mdv.sysexmsg);
else { int status = mdv.msg[0]; int channel = (status & 0xf) + 1; int b1 = mdv.msg[1]; int b2 = mdv.msg[2]; switch(status & 0xf0) { case MD_NOTEOFF: inmidi_noteon(i, channel, b1, 0); break; case MD_NOTEON: inmidi_noteon(i, channel, b1, b2); break; case MD_POLYKEYPRESSURE: inmidi_polyaftertouch(i, channel, b1, b2); break; case MD_CONTROLCHANGE: inmidi_controlchange(i, channel, b1, b2); break; case MD_PITCHBENDCHANGE: inmidi_pitchbend(i, channel, ((b2 << 7) + b1)); break; case MD_PROGRAMCHANGE: inmidi_programchange(i, channel, b1); break; case MD_CHANNELPRESSURE: inmidi_aftertouch(i, channel, b1); break; } } } } }
/* ----------------------- public routines ----------------------- */ void sys_listdevs( void) { post("common devices on SGI machines:"); post("#-1 - Default In/Out selected in Audio Panel"); post("#1 - Analog In/Out"); post("#2 - AES In/Out"); post("#3 - ADAT I/O"); }
void sys_open_audio(int naudioindev, int *audioindev, int nchindev, int *chindev, int naudiooutdev, int *audiooutdev, int nchoutdev, int *choutdev, int rate) /* IOhannes */ { int inchans=0; int outchans=0; int i;
if(rate < 1) rate = 44100;
if (naudioindev == -1) /* not set */ { if (nchindev==-1) { nchindev=1; chindev[0] = DEFAULTCHANS; naudioindev=1; audioindev[0] = DEFAULTINDEV; } else { for (i = 0; i < MAXAUDIODEV; i++) audioindev[i]=i+1; naudioindev = nchindev; } } else /* audioindev is specified */ { if (nchindev == -1) /* no channels specified */ { nchindev = naudioindev; for (i = 0; i < naudioindev; i++) chindev[i] = DEFAULTCHANS; } else if (nchindev > naudioindev) { for (i = naudioindev; i < nchindev; i++) { if (i == 0) audioindev[0] = DEFAULTINDEV; else audioindev[i] = audioindev[i-1] + 1; } naudioindev = nchindev; } else if (nchindev < naudioindev) { for (i = nchindev; i < naudioindev; i++) { if (i == 0) chindev[0] = DEFAULTCHANS; else chindev[i] = chindev[i-1]; } naudioindev = nchindev; } }
if (naudiooutdev == -1) /* audiooutdev not set */ { if (nchoutdev==-1) { nchoutdev=1; choutdev[0] = DEFAULTCHANS; naudiooutdev = 1; audiooutdev[0] = DEFAULTOUTDEV; } else { for (i = 0; i < MAXAUDIODEV; i++) audiooutdev[i] = i+1; naudiooutdev = nchoutdev; } } else { if (nchoutdev == -1) { nchoutdev = naudiooutdev; for (i = 0; i < naudiooutdev; i++) choutdev[i] = DEFAULTCHANS; } else if (nchoutdev > naudiooutdev) { for (i = naudiooutdev; i < nchoutdev; i++) { if (i == 0) audiooutdev[0] = DEFAULTOUTDEV; else audiooutdev[i] = audiooutdev[i-1] + 1; } naudiooutdev = nchoutdev; } else if (nchoutdev < naudiooutdev) { for (i = nchoutdev; i < naudiooutdev; i++) { if (i == 0) choutdev[0] = DEFAULTCHANS; else choutdev[i] = choutdev[i-1]; } naudiooutdev = nchoutdev; } }
sgi_flush_all_underflows_to_zero(); sgi_open_audio(naudioindev, audioindev, nchindev, chindev, naudiooutdev, audiooutdev, nchoutdev, choutdev, rate); }
void sys_open_midi(int nmidiin, int *midiinvec, int nmidiout, int *midioutvec) { sgi_open_midi(nmidiin!=0, nmidiout!=0); }
float sys_getsr(void) { return (sys_dacsr); }
void sys_audiobuf(int n) { /* set the size, in milliseconds, of the audio FIFO */ if (n < 5) n = 5; else if (n > 5000) n = 5000; fprintf(stderr, "audio buffer set to %d milliseconds\n", n); sys_schedadvance = n * 1000; }
void sys_getmeters(float *inmax, float *outmax) { if (inmax) { sgi_meters = 1; *inmax = sgi_inmax; *outmax = sgi_outmax; } else sgi_meters = 0; sgi_inmax = sgi_outmax = 0; }
void sys_reportidle(void) { }
int sys_get_inchannels(void) { return (sys_inchannels); }
int sys_get_outchannels(void) { return (sys_outchannels); }
void sys_set_priority(int foo) { /* hack by olaf.matthes@gmx.de at 2003/09/21 */ struct sched_param par; /* Bearing the table found in 'man realtime' in mind, I found it a */ /* good idea to use 192 as the priority setting for Pd. Any thoughts? */ if(foo) par.sched_priority = 250; /* priority for watchdog */ else par.sched_priority = 192; /* priority for pd (DSP) */
if (sched_setscheduler(0, SCHED_FIFO, &par) != -1) fprintf(stderr, "priority %d scheduling enabled.\n", par.sched_priority); #ifdef _POSIX_MEMLOCK if (mlockall(MCL_FUTURE) != -1) fprintf(stderr, "memory locking enabled.\n"); #endif /* end of hack */ }
void sys_setblocksize(int n) { fprintf(stderr, "warning: blocksize not settable in IRIX\n"); }
/* Copyright (c) 1997-1999 Miller Puckette. * For information on usage and redistribution, and for a DISCLAIMER OF ALL * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */
/* This file should be compared with the corresponding thing in the TK * distribution whenever updating to newer versions of TCL/TK. */
/* * Copyright (c) 1993 The Regents of the University of California. * Copyright (c) 1994 Sun Microsystems, Inc. * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. */
#ifndef MACOSX /* linux and IRIX only; in MACOSX we don't link this in */ #include "tk.h" #include <stdlib.h>
#ifndef IRIX /* added by olaf.matthes@gmx.de to compile on IRIX 6.5 */ /* * The following variable is a special hack that is needed in order for * Sun shared libraries to be used for Tcl. */
extern int matherr(void); int *tclDummyMathPtr = (int *) matherr; #endif
/* *---------------------------------------------------------------------- * * main -- * * This is the main program for the application. * * Results: * None: Tk_Main never returns here, so this procedure never * returns either. * * Side effects: * Whatever the application does. * *---------------------------------------------------------------------- */
void pdgui_startup(Tcl_Interp *interp); void pdgui_setname(char *name); void pdgui_setsock(int port); void pdgui_sethost(char *name);
int main(int argc, char **argv) { pdgui_setname(argv[0]); if (argc >= 2) { pdgui_setsock(atoi(argv[1])); argc--; argv++; argv[0] = "Pd"; } if (argc >= 2) { pdgui_sethost(argv[1]); argc--; argv++; argv[0] = "Pd"; } Tk_Main(argc, argv, Tcl_AppInit); return 0; /* Needed only to prevent compiler warning. */ }
/* *---------------------------------------------------------------------- * * Tcl_AppInit -- * * This procedure performs application-specific initialization. * Most applications, especially those that incorporate additional * packages, will have their own version of this procedure. * * Results: * Returns a standard Tcl completion code, and leaves an error * message in interp->result if an error occurs. * * Side effects: * Depends on the startup script. * *---------------------------------------------------------------------- */
int Tcl_AppInit(interp) Tcl_Interp *interp; /* Interpreter for application. */ { Tk_Window mainwindow;
if (Tcl_Init(interp) == TCL_ERROR) { return TCL_ERROR; } if (Tk_Init(interp) == TCL_ERROR) { return TCL_ERROR; }
/* setup specific to pd-gui: */
pdgui_startup(interp);
/* * Specify a user-specific startup file to invoke if the application * is run interactively. Typically the startup file is "~/.apprc" * where "app" is the name of the application. If this line is deleted * then no user-specific startup file will be run under any conditions. */
#if 0 tcl_RcFileName = "~/.pdrc"; #endif
return TCL_OK; }
#endif /* MACOSX */
#Makefile mods by Soeren Bovbjerg. #Adopted by Olaf Matthes for use with GCC 3.3 # #This makefile is made for r10000. You can change r10000 to your #processor type if you have problems. Just change and type #'make pd' # #You will need to change the tck/tk paths if you want to recompile #The GUI part.
#compile with GCC as n32 binary EXECUTABLE=../bin/pd-n32 XF1=-mabi=n32 -DN32 -O3 -funroll-loops -fomit-frame-pointer XF2=-Wall -W -Wshadow -Wno-unused -Wno-parentheses -Wno-switch -mips4
#compile with GCC as o32 binary #EXECUTABLE=../bin/pd-o32 #XF1=-mcpu=r4000 -O3 -funroll-loops -fomit-frame-pointer #XF2=-Wall -W -Wshadow -Wno-unused -Wno-parentheses -Wno-switch -mips3
#EXECUTABLE=../bin/pd-n32 #XF1=-n32 -DN32 -woff 1080,1064,1185,1552,1174,1171 -Ofast=ip32 #XF2=-OPT:cray_ivdep=true -r10000 -OPT:roundoff=3 -OPT:IEEE_arithmetic=3
#uncomment this to make o32 version and comment the 3 lines above #EXECUTABLE=../bin/pd-o32 #XF1=-o32 -fullwarn -O2 #XF2=
all: $(EXECUTABLE) ../bin/pd-gui ../bin/pd.tk ../bin/pd-watchdog
VPATH=../obj
INCLUDE = -I. -I../tk/unix/include -I../tcl/unix/include GLIB = ../tk/unix/lib/libtk8.4.a ../tcl/unix/lib/libtcl8.4.a -lm -lX11 LIB = -laudio -lmd -lm -lpthread CFLAGS = -DUNIX -DIRIX -DPD -DDL_OPEN $(XF1) $(XF2) LDFLAGS = $(XF1) $(XF2)
SYSSRC = s_sgi.c
SRC = g_canvas.c g_graph.c g_text.c g_rtext.c g_array.c g_template.c g_io.c \ g_scalar.c g_traversal.c g_guiconnect.c g_readwrite.c g_editor.c \ g_all_guis.c g_bang.c g_hdial.c g_hslider.c g_mycanvas.c g_numbox.c \ g_toggle.c g_vdial.c g_vslider.c g_vumeter.c \ m_pd.c m_class.c m_obj.c m_atom.c m_memory.c m_binbuf.c \ m_conf.c m_glob.c m_sched.c \ s_main.c s_inter.c s_unix.c s_file.c s_print.c \ s_loader.c s_path.c s_entry.c \ d_ugen.c d_ctl.c d_arithmetic.c d_osc.c d_filter.c d_dac.c d_misc.c \ d_math.c d_fft.c d_mayer_fft.c d_fftroutine.c d_array.c d_global.c \ d_delay.c d_resample.c \ x_arithmetic.c x_connective.c x_interface.c x_midi.c x_misc.c \ x_time.c x_acoustics.c x_net.c x_qlist.c x_gui.c d_soundfile.c \ $(SYSSRC)
OBJ = $(SRC:.c=.o)
GSRC = t_main.c t_tkcmd.c
GOBJ = $(GSRC:.c=.o) .PHONY: pd gui
.c.o: gcc $(CFLAGS) $(INCLUDE) -c -o $(VPATH)/$*.o $*.c
pd: $(EXECUTABLE)
gui: ../bin/pd-gui
$(EXECUTABLE): $(OBJ) cd ../obj; gcc $(LDFLAGS) -o $(EXECUTABLE) $(OBJ) \ $(LIB)
../bin/pd-gui: $(GOBJ) cd ../obj; gcc $(LDFLAGS) -o ../bin/pd-gui $(GOBJ) \ $(GLIB) -lm -lX11 -v
../bin/pd.tk: u_main.tk; cp u_main.tk ../bin/pd.tk
pd-watchdog: ../bin/pd-watchdog
../bin/pd-watchdog: s_watchdog.c gcc $(LDFLAGS) -o ../bin/pd-watchdog s_watchdog.c
tags: $(SRC) $(GSRC); ctags *.[ch]
depend:; gcc -M $(CFLAGS) $(INCLUDE) $(SRC) > makefile.dependencies
include makefile.dependencies