## Humdrum extras programs makefile for linux on Intel computers. ## ## Programmer: Craig Stuart Sapp ## Creation Date: Sun Apr 3 15:34:28 PDT 2005 ## Last Modified: Wed Aug 25 14:29:18 PDT 2010 ## Filename: ...humextra/Makefile.programs ## ## Description: This Makefile creates the Humdrum Extras library ## lib/libhumextra.a for linux, using gcc 2.7.2.1 or higher ## Also, gives basic guidelines of how to compile for Windows ## using MinGW. ## ## To run this makefile, type (without quotes) "make -f Makefile.programs" ## (or "gmake -f Makefile.programs" on FreeBSD computers), although it ## is intended to be used the file "Makefile" which runs this makefile ## with the command "make programs". Note that you have to first ## create the library file with the makefile "Makefile.library". ## ## Without arguments, this makefile will compile all programs. ## If you give a program name as an argument, it will compile ## just that program. E.g.: "make -f Makefile.programs blank" or used ## in conjunction with "Makefile", type "make blank", which will ## compile the "blank" program and place it in the ./bin directory. ## ########################################################################### # # # Operating System OSTYPEs available in the humextra library # # compilation: but probably not used in humextra: # # # # HPUX = Hewlett-Packard Unix Workstations. # # IRIX = SGI computers with IRIX OS. # # LINUX = Linux running on intel computers # # NEXTI = NeXT OS on Intel Hardware # # NEXTM = NeXT OS on Motorola Hardware # # SUN = Sun SPARCstations # # VISUAL = Windows 95/NT using Microsoft Visual C++ 6.0 # # OSXPC = Apple Macintosh OS 10.x, Intel CPU # # OSXOLD = Apple Macintosh OS 10.x, PowerPC CPU # # # # Look at the sigConfiguration.h file for various things which need # # to be defined specifically for each OS. Only one of these defines # # can be defined at a time. # # # ########################################################################### # # You can set the OSTYPE variable by uncommenting one of the lines below; # otherwise, it will be set automatically in the next section of the # Makefile if the configuration should be OSXPC or LINUX. For example, # if you need to compile for OSXOLD (OS X on a PowerPC), then you would # need to uncomment out the OSTYPE = OSXOLD line below. #OSTYPE = LINUX #OSTYPE = OSXPC #OSTYPE = OSXOLD ARCH = # if OSTYPE is not defined, then this if statement will be run: ifeq ($(origin OSTYPE), undefined) ifeq ($(shell uname),Darwin) OSTYPE = OSXPC # use the following to compile for 32-bit architecture on 64-bit comps: #ARCH = -m32 -arch i386 else OSTYPE = LINUX # use the following to compile for 32-bit architecture on 64-bit comps: # (you will need 32-bit libraries in order to do this) # ARCH = -m32 endif endif # Next if statement needed for some versions of make which already set OSTYPE: ifeq ($(OSTYPE),linux) OSTYPE = LINUX # use the following to compile for 32-bit architecture on 64-bit comps: # (you will need 32-bit libraries in order to do this) # ARCH = -m32 endif # Cygwin (and MinGW?) adds the string ".exe" to the end of compiled programs. # so select EXTEN = .exe when compiling in cygwin EXTEN = # EXTEN = .exe ########################################################################### # # # The OSSUBTYPE is for determining which type of sound drivers are being # # used in linux. This variable is only needed when compiling interactive # # MIDI programs. Most humextra programs do not need this variable. # # There are three possibilities: # # # # OSSUBTYPE = ALSA : ALSA 1.0 interface (http://www.alsa-project.org)# # OSSUBTYPE = OSS : OSS interface (http://www.4front-tech.com) # # OSSUBTYPE = : use this for OS X since there is only CoreMIDI # # # # Two additional options are available for older systems: # # OSSUBTYPE = ALSA09 : ALSA 0.9 interface (http://www.alsa-project.org)# # OSSUBTYPE = ALSA05 : ALSA 0.5 interface (http://www.alsa-project.org)# # # # Note: The Improv library accesses the internal/external MIDI devices # # in OSS, but only the external MIDI devices in ALSA. OSS can be # # emulated in ALSA 0.9 and higher, but seems to be broken in ALSA 1.0. # # # # Choose one of the following OSSUBTYPE defines: # # # #OSSUBTYPE = ALSA #OSSUBTYPE = OSS #OSSUBTYPE = # If OSSUBTYPE is not set manually above, then automatically determine # what the value should be (only works for LINUX and OSXPC). ifeq ($(origin OSSUBTYPE), undefined) ifeq ($(OSTYPE),OSXPC) OSSUBTYPE = endif ifeq ($(OSTYPE),LINUX) ifneq ($(wildcard /proc/asound/version),) OSSUBTYPE = ALSA else OSSUBTYPE = OSS endif endif endif ########################################################################### # # # Beginning of user-modifiable configuration variables # # # SRCDIR = src-programs INCDIR = include OBJDIR = obj LIBDIR = lib LIBFILE = humextra TARGDIR = bin # LANG=C: Nuts to the GCC error beautification committee. COMPILER = LANG=C g++ $(ARCH) # MinGW compiling setup (used to compile for Microsoft Windows but actual # compiling can be done in Linux). You have to install MinGW and these # variables will probably have to be changed to the correct paths: #COMPILER = /opt/xmingw/bin/i386-mingw32msvc-g++ #OBJDIR = obj-win #TARGDIR = bin-win #LIBDIR = lib-win #POSTFLAGS = -Wl,--export-all-symbols -Wl,--enable-auto-import \ # -Wl,--no-whole-archive -lmingw32 -L$(LIBDIR) -l$(LIBFILE) DEFINES = $(addprefix -D,$(OSTYPE)) DEFINES += $(addprefix -D,$(OSSUBTYPE)) PREFLAGS = -O3 -Wall -I$(INCDIR) $(DEFINES) # Add -DOLDCPP if using an older C++ compiler #PREFLAGS += -DOLDCPP # Add -static flag to compile without dynamics libraries for better portability: # (-static flag doesn't work well with gethostbyname() used in Humdrum parser) #PREFLAGS += -static POSTFLAGS ?= -L$(LIBDIR) -l$(LIBFILE) # Thread library needed for MIDI input programs in Linux: ifeq ($(OSTYPE),LINUX) POSTFLAGS += -lpthread endif # The following setup is for compiling XML parsing code # which uses the CenterPoint XML classes: ifneq ($(wildcard external/centerpoint),) PREFLAGS += -Iexternal/centerpoint/include POSTFLAGS += -lcslxml CENTERPOINT := yes endif # The following setup is for PERL-Compatible Regular Expression library # linking (for themax2 in particular). ifneq ($(wildcard external/pcre-*.*),) PREFLAGS += -I$(wildcard external/pcre-*.*) POSTFLAGS += -lpcre PCRE := yes endif ################################### # # Interactive MIDI program compiling setup # # for compiling programs with interactive MIDI (such as humplay), you # first need to compile the improv library which can be downloaded # from http://improv.sapp.org ifneq ($(wildcard ../improv/lib/libimprov.a),) PREFLAGS += -I../improv/include POSTFLAGS += -L../improv/lib -limprov IMPROV := yes endif # extra setup for compiling interactive MIDI programs: ifneq ($(origin IMPROV),undefined) # On Apple OS X computers, include MIDI related libraries: ifeq ($(OSTYPE),OSXPC) POSTFLAGS += -framework CoreMIDI -framework CoreServices endif ifeq ($(OSTYPE),OSXOLD) POSTFLAGS += -framework CoreMIDI -framework CoreServices endif # On Linux computers, include MIDI related libraries: ifeq ($(OSTYPE),LINUX) # include pthread library for MIDI input parsing: POSTFLAGS += -L/usr/lib -lpthread # Add the ALSA library interface, if using ALSA: ifeq ($(OSSUBTYPE),ALSA) POSTFLAGS += -lasound endif endif endif # # # End of user-modifiable variables. # # # ########################################################################### # setting up the directory paths to search for program source code vpath %.cpp $(SRCDIR) # generating a list of the programs to compile with "make all" PROGS1=$(notdir $(patsubst %.cpp,%,$(wildcard $(SRCDIR)/*.cpp))) PROGS=$(PROGS1) # Targets which don't actually refer to files .PHONY : bin src-programs src-library include obj bin-win obj-win ########################################################################### # # # # examples: all all: bin $(addprefix $(TARGDIR)/,$(PROGS)) @echo Finished compiling all programs. info: @echo "Programs to compile: $(PROGS)" | fmt bin: ifeq ($(wildcard $(TARGDIR)),) -mkdir -p $(TARGDIR) endif ########################################################################### # # Exceptions to the default rules found a the bottom of the Makefile # # Programs which need the improv MIDI library: ifeq ($(origin IMPROV),undefined) bin/humplay: @echo Skipping compilation of humplay since improv library not found. humplay: @echo Skipping compilation of humplay since improv library not found. endif # Programs which need the centerpoint XML library: ifeq ($(origin CENTERPOINT),undefined) bin/xml2hum: @echo Skipping compilation of xml2hum since centerpoint library not found. xml2hum: @echo Skipping compilation of xml2hum since centerpoint library not found. endif ########################################################################### # # Defining explicit rules for program sourcefile dependencies: # $(TARGDIR)/% : $(notdir %.cpp) ifeq ($(wildcard $(TARGDIR)),) -mkdir -p $(TARGDIR) endif $(COMPILER) $(PREFLAGS) -o $@ $< $(POSTFLAGS) \ && strip $@$(EXTEN) % : $(notdir %.cpp) ifeq ($(wildcard $(TARGDIR)),) -mkdir -p $(TARGDIR) endif $(COMPILER) $(PREFLAGS) -o $(TARGDIR)/$@ $< $(POSTFLAGS) \ && strip $(TARGDIR)/$@$(EXTEN) # # # # ###########################################################################