forked from pianoroll/roll-image-parser
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile.programs
136 lines (106 loc) · 4.56 KB
/
Makefile.programs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
##
## Programmer: Craig Stuart Sapp <[email protected]>
## Creation Date: Mon Aug 10 16:06:48 PDT 2015
## Last Modified: Sat Jun 17 00:16:40 CEST 2017
## Syntax: GNU Makefile
## Filename: Makefile.programs
## vim: ts=3
##
## Description: Makefile to compile programs using the humlib library.
##
## To run this makefile, type (without quotes) "make -f Makefile.examples",
## (or "gmake -f Makefile.examples" on FreeBSD computers). Although it is
## intended to be used with the file "Makefile" which runs this makefile with
## the command "make examples". The program executables will be placed
## in the bin directory. Note that you have to first create the library
## files with the main makefile using the command "make".
##
## Without arguments or with the argument "programs", 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 test1"
## or used in conjunction with "Makefile", type "make test1", which will
## compile the test1.cpp program and place it in the ./bin directory.
# Set the environmental variable $MACOSX_DEPLOYMENT_TARGET to
# "10.9" in Apple OS X to compile for OS X 10.9 and later (for example,
# you can compile for OS X 10.9 computers even if you are using the 10.10
# version of the operating system).
ENV =
ifeq ($(shell uname),Darwin)
ENV = MACOSX_DEPLOYMENT_TARGET=10.9
# use the following to compile for 32-bit architecture on 64-bit comps:
#ARCH = -m32 -arch i386
else
# 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
###########################################################################
# #
# Beginning of user-modifiable configuration variables #
# #
INCDIR = include
EXTERNALINC = -Iexternal/midifile/include
#EXTERNALLIB = -Lexternal/midifile/lib -lmidifile
LIBDIR = lib
LIBFILE = pianoroll
#TARGDIR = /user/c/craig/www/piano-roll-project/full-scans/bin
TARGDIR = bin
TOOLDIR = tools
#DEFINES = -DDONOTUSEFFT
PREFLAGS = -Wall -I$(INCDIR) $(DEFINES) $(EXTERNALINC)
PREFLAGS += -O3
# include debugging information:
#PREFLAGS += -g
# using C++ 2014 standard for imaginary literals for FFT:
PREFLAGS += -std=c++14
#PREFLAGS += -std=c++98
# Add -static flag to compile without dynamics libraries for better portability:
#PREFLAGS += -static
#POSTFLAGS = -L$(LIBDIR) -l$(LIBFILE) $(EXTERNALLIB)
POSTFLAGS = -L$(LIBDIR) -l$(LIBFILE)
COMPILER = LANG=C $(ENV) g++ $(ARCH)
# Alternatly, use clang++ v3.3:
#COMPILER = clang++
#PREFLAGS += -stdlib=libc++
# #
# End of user-modifiable variables. #
# #
###########################################################################
# setting up the directory paths to search for dependency files
vpath %.h $(INCDIR)
vpath %.cpp $(wildcard tests/test-*) examples myprograms
vpath %.cpp $(wildcard $(TOOLDIR)) examples myprograms
# generating a list of the programs to compile with "make all"
PROGS1=$(notdir $(patsubst %.cpp,%,$(wildcard $(TOOLDIR)/*.cpp)))
PROGS=$(PROGS1)
# targets which don't actually refer to files
.PHONY: examples
###########################################################################
# #
# #
examples: all
all: bin $(PROGS)
@echo Finished compiling all programs: $(PROGS).
info:
@echo "Programs to compile: $(PROGS)" | fmt
install:
@(cd bin && sudo cp $(PROGS) /usr/local/bin)
@echo "Copied tools to /usr/local/bin"
bin:
ifeq ($(wildcard $(TARGDIR)),)
@-mkdir -p $(TARGDIR)
endif
###########################################################################
#
# Defining explicit rules for program sourcefile dependencies:
#
.cpp:
ifeq ($(wildcard $(TARGDIR)),)
@-mkdir -p $(TARGDIR)
endif
@echo [CC] $@
@$(COMPILER) $(PREFLAGS) -o $(TARGDIR)/$@ $< $(POSTFLAGS) \
# && strip $(TARGDIR)/$@$(EXTEN)
# #
# #
###########################################################################