[PD] how to build multiple objects from one file

David Medine dmedine at ucsd.edu
Fri May 12 14:37:25 CEST 2017

I am building a small suite of related externals and it would be most 
convenient to simply compile one .obj file and pull the externs off of 
it one at a time. My makefile is the standard Pd makefile, but I leave 
the CSYM and current fields empty so I can declare them with my call to 

 >> make CSYM=lsl_inlet current=pd_nt

It builds just fine, but when I open the help patch, the extern doesn't 
load. If, I rename the file and arrange things so that the filename is 
the same as the extern name (i.e. there is only one extern per .obj) and 
recompile it works just fine. The important point is that I don't change 
the code or the body of the makefile at all (except for the NAME field).

I know that Miller does this it this way all the time, e.g. 
d_arithmetic.c. Any suggestions?

Below is my makefile, in case that helps.



NAME = lsl_io
#CSYM = lsl_inlet

# this is the UNIX-style complicated layout dir, simple goes to $(prefix)/pd
#prefix = /usr/local
#libpddir = $(prefix)/lib/pd


#current: pd_nt

# ----------------------- Microsoft Visual C -----------------------
MSCC = cl
MSLN = link

pd_nt: $(NAME).dll


VC = "C:\\Program Files (x86)\\Microsoft Visual Studio 9.0\\VC"
VSTK = "C:\\Program Files\\Microsoft SDKs\\Windows\\v6.0A"

PDNTINCLUDE = -I. -I$(VC)\\include -I$(VSTK)\\include

PDNTLDIR = $(VC)\\lib
-NODEFAULTLIB:kernel32 \
         -NODEFAULTLIB:uuid \
     $(PDNTLDIR)\\libcmt.lib $(PDNTLDIR)\\oldnames.lib \
         $(VSTK)\\lib\\kernel32.lib $(VSTK)\\lib\\uuid.lib \
      .\\pd.lib .\\liblsl32.lib

     $(MSLN) -nologo -dll -export:$(CSYM)_setup $*.obj $(PDNTLIB)

# ----------------------- LINUX i386 -----------------------

pd_linux: $(NAME).pd_linux

.SUFFIXES: .pd_linux

LINUXCFLAGS = -DPD -O2 -funroll-loops -fomit-frame-pointer -fPIC \
     -Wall -W -Wshadow -Wstrict-prototypes \
     -Wno-unused -Wno-unused-parameter -Wno-parentheses -Wno-switch \

LINUXINCLUDE =  -I../../src

     $(CC) $(LINUXCFLAGS) $(LINUXINCLUDE) -o $*.o -c $*.c
     $(CC) -shared -o $*.pd_linux $*.o -lc -lm
     rm -f $*.o

More information about the Pd-list mailing list