Skip to content

Commit b90f6ef

Browse files
committed
Initial commit
MusyX2MidiSrc-120114
1 parent 773a4bf commit b90f6ef

20 files changed

+6929
-0
lines changed

Makefile

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
## main Midifile GNU makefile for Linux/Cygwin and OS X on Intel computers.
2+
##
3+
## Programmer: Craig Stuart Sapp <[email protected]>
4+
## Creation Date: Sun Apr 3 00:44:44 PST 2005
5+
## Last Modified: Sun Jun 21 12:17:38 PDT 2009
6+
## Filename: ...midifile/Makefile
7+
##
8+
## Description: This Makefile can create the Midifile library or
9+
## example programs which use the Midifile library with
10+
## linux/cygwin or OS X using g++ (gcc 2.7.2.1 or later).
11+
##
12+
## To run this makefile, type (without quotes) "make library", then
13+
## "make examples".
14+
##
15+
16+
MAKE = make
17+
18+
# targets which don't actually refer to files
19+
.PHONY : src lib examples include bin clean info
20+
21+
###########################################################################
22+
# #
23+
# #
24+
25+
all: info library examples
26+
27+
info:
28+
@echo ""
29+
@echo This makefile will create either the Midifile library or will
30+
@echo compile the Midifile programs. You may have to make the library
31+
@echo first if it does not exist. Type one of the following:
32+
@echo " $(MAKE) library"
33+
@echo or
34+
@echo " $(MAKE) examples"
35+
@echo ""
36+
@echo To compile a specific program called xxx, type:
37+
@echo " $(MAKE) xxx"
38+
@echo ""
39+
@echo Typing \"make\" alone will compile both the library and all examples.
40+
@echo ""
41+
42+
library:
43+
$(MAKE) -f Makefile.library
44+
45+
clean:
46+
$(MAKE) -f Makefile.library clean
47+
-rm -rf bin
48+
-rm -rf lib
49+
50+
examples:
51+
programs:
52+
$(MAKE) -f Makefile.examples
53+
54+
%:
55+
-mkdir -p bin
56+
@echo compiling file $@
57+
$(MAKE) -f Makefile.examples $@
58+
59+
60+
# #
61+
# #
62+
###########################################################################
63+
64+
65+

Makefile.examples

Lines changed: 183 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,183 @@
1+
## Midifile programs makefile for linux/cygwin or OS X on Intel computers.
2+
##
3+
## Programmer: Craig Stuart Sapp <[email protected]>
4+
## Creation Date: Sun Apr 3 15:34:28 PDT 2005
5+
## Last Modified: Thu Jun 18 13:24:31 PDT 2009
6+
## Filename: ...midifile/Makefile.programs
7+
##
8+
## Description: This Makefile creates example programs which utilize the
9+
## lib/libmidifile.a library for linux/cygwin or OS X, using
10+
## gcc 2.7.2.1 or higher. Also, gives basic guidelines of
11+
## how to compile for Windows using MinGW.
12+
##
13+
## To run this makefile, type (without quotes) "make -f Makefile.examples",
14+
## Although it is intended to be used the file "Makefile" which runs this
15+
## makefile with the command "make examples". Note that you have to first
16+
## create the library file with the makefile "Makefile.library" (by typing
17+
## the command "make library").
18+
##
19+
## Without arguments, this makefile will compile all example programs.
20+
## If you give a program name as an argument, it will compile
21+
## just that program. E.g.: "make -f Makefile.examples blank" or used
22+
## in conjunction with "Makefile", type "make blank", which will
23+
## compile the "./examples/blank.cpp" program and place it in the
24+
## ./bin directory.
25+
##
26+
27+
###########################################################################
28+
# #
29+
# Operating System OSTYPEs available in the midifile library #
30+
# compilation: #
31+
# #
32+
# HPUX = Hewlett-Packard Unix Workstations. #
33+
# IRIX = SGI computers with IRIX OS. #
34+
# LINUX = Linux running on intel computers #
35+
# NEXTI = NeXT OS on Intel Hardware #
36+
# NEXTM = NeXT OS on Motorola Hardware #
37+
# OSXPC = Apple Macintosh OS 10.x, Intel CPU #
38+
# OSXOLD = Apple Macintosh OS 10.x, PowerPC CPU #
39+
# SUN = Sun SPARCstations #
40+
# VISUAL = Windows 95/NT using Microsoft Visual C++ 6.0 #
41+
# #
42+
# Look at the sigConfiguration.h file for various things which need #
43+
# to be defined specifically for each OS. Only one of these defines #
44+
# can be defined at a time. #
45+
# #
46+
###########################################################################
47+
#
48+
# You can set the OSTYPE variable by uncommenting one of the lines below;
49+
# otherwise, it will be set automatically in the next section of the
50+
# Makefile if the configuration should be OSXPC or LINUX. For example,
51+
# if you need to compile for OSXOLD (OS X on a PowerPC), then you would
52+
# need to uncomment out the OSTYPE = OSXOLD line below.
53+
54+
#OSTYPE = LINUX
55+
#OSTYPE = OSXPC
56+
#OSTYPE = OSXOLD
57+
ARCH =
58+
59+
# If OSTYPE is not defined, then this IF-statement will be run:
60+
ifeq ($(origin OSTYPE), undefined)
61+
ifeq ($(shell uname),Darwin)
62+
OSTYPE = OSXPC
63+
# the following line forces the library to be compiled for
64+
# 32-bit architectures (particularly when compiling on a 64-bit computer):
65+
ARCH = -m32 -arch i386
66+
else
67+
OSTYPE = LINUX
68+
endif
69+
endif
70+
# Next IF-statement needed for some versions of make which already set OSTYPE:
71+
ifeq ($(OSTYPE),linux)
72+
OSTYPE = LINUX
73+
endif
74+
75+
# Cygwin (and MinGW?) adds the string ".exe" to the end of compiled programs.
76+
# so select EXTEN = .exe when compiling in cygwin. (Need a test for cygwin
77+
# so that the EXTEN variable is setup automatically...)
78+
EXTEN =
79+
# EXTEN = .exe
80+
81+
82+
###########################################################################
83+
# #
84+
# Beginning of user-modifiable configuration variables #
85+
# #
86+
87+
SRCDIR = examples
88+
INCDIR = include
89+
OBJDIR = obj
90+
LIBDIR = lib
91+
LIBFILE = midifile
92+
TARGDIR = bin
93+
# LANG=C: Nuts to the GCC error beautification committee.
94+
COMPILER = LANG=C g++ $(ARCH)
95+
96+
# MinGW compiling setup (used to compile for Microsoft Windows but actual
97+
# compiling can be done in Linux). You have to install MinGW and these
98+
# variables will probably have to be changed to the correct paths:
99+
#COMPILER = /opt/xmingw/bin/i386-mingw32msvc-g++
100+
#OBJDIR = obj-win
101+
#TARGDIR = bin-win
102+
#LIBDIR = lib-win
103+
#POSTFLAGS = -Wl,--export-all-symbols -Wl,--enable-auto-import \
104+
# -Wl,--no-whole-archive -lmingw32 -L$(LIBDIR) -l$(LIBFILE)
105+
106+
DEFINES = $(addprefix -D,$(OSTYPE))
107+
DEFINES += $(addprefix -D,$(OSSUBTYPE))
108+
109+
PREFLAGS = -O3 -Wall -I$(INCDIR) $(DEFINES)
110+
111+
# Add -DOLDCPP if using an older C++ compiler
112+
#PREFLAGS += -DOLDCPP
113+
114+
# Add -static flag to compile without dynamics libraries for better portability:
115+
#PREFLAGS += -static
116+
117+
POSTFLAGS ?= -L$(LIBDIR) -l$(LIBFILE)
118+
119+
# #
120+
# End of user-modifiable variables. #
121+
# #
122+
###########################################################################
123+
124+
125+
# setting up the directory paths to search for program source code
126+
vpath %.cpp $(SRCDIR)
127+
128+
# generating a list of the programs to compile with "make all"
129+
PROGS1=$(notdir $(patsubst %.cpp,%,$(wildcard $(SRCDIR)/*.cpp)))
130+
PROGS=$(PROGS1)
131+
132+
# Targets which don't actually refer to files
133+
.PHONY : bin examples src include obj
134+
135+
136+
###########################################################################
137+
# #
138+
# #
139+
140+
examples: all
141+
all: bin $(addprefix $(TARGDIR)/,$(PROGS))
142+
@echo Finished compiling all programs.
143+
144+
info:
145+
@echo "Programs to compile: $(PROGS)" | fmt
146+
147+
bin:
148+
ifeq ($(wildcard $(TARGDIR)),)
149+
-mkdir -p $(TARGDIR)
150+
endif
151+
152+
$(TARGDIR)/henonfile:
153+
-echo Skipping henonfile.cpp since it needs external functions.
154+
$(TARGDIR)/mid2hum:
155+
-echo Skipping mid2hum.cpp since it needs external functions.
156+
$(TARGDIR)/peep2midi:
157+
-echo Skipping peep2midi.cpp since it needs external functions.
158+
159+
160+
###########################################################################
161+
#
162+
# Defining explicit rules for program sourcefile dependencies:
163+
#
164+
165+
$(TARGDIR)/% : $(notdir %.cpp)
166+
ifeq ($(wildcard $(TARGDIR)),)
167+
-mkdir -p $(TARGDIR)
168+
endif
169+
$(COMPILER) $(PREFLAGS) -o $@ $< $(POSTFLAGS) \
170+
&& strip $@$(EXTEN)
171+
172+
% : $(notdir %.cpp)
173+
ifeq ($(wildcard $(TARGDIR)),)
174+
-mkdir -p $(TARGDIR)
175+
endif
176+
$(COMPILER) $(PREFLAGS) -o $(TARGDIR)/$@ $< $(POSTFLAGS) \
177+
&& strip $(TARGDIR)/$@$(EXTEN)
178+
179+
# #
180+
# #
181+
###########################################################################
182+
183+

0 commit comments

Comments
 (0)