summaryrefslogtreecommitdiff
path: root/src/Makefile.in
blob: 28681ff340a3650716abc6114e7faa5dfd78ab37 (plain)
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
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
RM := rm -f
## Use compiler from configure. May be specified by user with e.g.:
## ./configure CXX=/usr/local/bin/g++-7
CXX := @CXX@

PREFIX := @prefix@
MANDIR = $(PREFIX)/share/man

CXXFLAGS := @CXXFLAGS@
CPPFLAGS := @CPPFLAGS@
LDFLAGS := @LDFLAGS@

# profiling:
#-g -pg

HNLOPT := @HNLOPT@
HARM := @HARM@
HOMP := @HOMP@

CPP_LIBS = -llapack -lblas -lpthread -lm
ifeq "$(HNLOPT)" "Y"
    CPP_LIBS += -lnlopt
endif

ifeq "$(HARM)" "Y"
    CPP_LIBS += -larmadillo
endif

OPT_FLAGS := @OPT_FLAGS@ -Wall
ifeq "$(HOMP)" "Y"
    OPT_FLAGS += -DOMP
endif

ifneq "$(CXX)" "icc"
    OPT_FLAGS += -ftree-vectorize
    ifneq ($(filter @host_cpu@,i386 i486 i586 i686),)
        OPT_FLAGS += -ffloat-store
    else
        OPT_FLAGS += -ffast-math
    endif
endif

NLOPT_PROGRAMS :=
ifeq "$(HNLOPT)" "Y"
    NLOPT_PROGRAMS += pxbdfit pxcontrates pxstrec
endif

FFLAGS	= -O3

CONSEQ_SRC = main_consq.cpp
CONSEQ_OBJ = main_consq.o
CONSEQ_DEP = main_consq.d

STREC_SRC = main_strec.cpp
STREC_OBJ = main_strec.o
STREC_DEP = main_strec.d

MRCA_SRC = main_mrca.cpp
MRCA_OBJ = main_mrca.o
MRCA_DEP = main_mrca.d

MRCACUT_SRC = main_mrca_cut.cpp
MRCACUT_OBJ = main_mrca_cut.o
MRCACUT_DEP = main_mrca_cut.d

MRCANAME_SRC = main_mrca_name.cpp
MRCANAME_OBJ = main_mrca_name.o
MRCANAME_DEP = main_mrca_name.d

BD_SIM_SRC = bd_sim.cpp main_bd_sim.cpp
BD_SIM_OBJ = bd_sim.o main_bd_sim.o
BD_SIM_DEP = bd_sim.d main_bd_sim.d

BD_FIT_SRC = bd_fit.cpp main_bd_fit.cpp
BD_FIT_OBJ = bd_fit.o main_bd_fit.o
BD_FIT_DEP = bd_fit.d main_bd_fit.d

NNI_SRC = main_nni.cpp
NNI_OBJ = main_nni.o
NNI_DEP = main_nni.d

UPGMA_SRC = upgma.cpp main_upgma.cpp
UPGMA_OBJ = upgma.o main_upgma.o
UPGMA_DEP = upgma.d main_upgma.d

2FA_SRC = main_s2fa.cpp
2FA_OBJ = main_s2fa.o
2FA_DEP = main_s2fa.d

2PHY_SRC = main_s2phy.cpp
2PHY_OBJ = main_s2phy.o
2PHY_DEP = main_s2phy.d

2NEX_SRC = main_s2nex.cpp
2NEX_OBJ = main_s2nex.o
2NEX_DEP = main_s2nex.d

FQFILT_SRC = main_fqfilt.cpp
FQFILT_OBJ = main_fqfilt.o
FQFILT_DEP = main_fqfilt.d

REVCOMP_SRC = main_revcomp.cpp edlib.cpp
REVCOMP_OBJ = main_revcomp.o edlib.o
REVCOMP_DEP = main_revcomp.d edlib.d

NW_SRC = main_nw.cpp
NW_OBJ = main_nw.o
NW_DEP = main_nw.d

SW_SRC = main_sw.cpp
SW_OBJ = main_sw.o
SW_DEP = main_sw.d

SEQSAMP_SRC = seq_sample.cpp main_boot.cpp
SEQSAMP_OBJ = seq_sample.o main_boot.o
SEQSAMP_DEP = seq_sample.d main_boot.d

SEQGEN_SRC = main_seqgen.cpp
SEQGEN_OBJ = main_seqgen.o
SEQGEN_DEP = main_seqgen.d

CONCAT_SRC = concat.cpp main_cat.cpp
CONCAT_OBJ = concat.o main_cat.o
CONCAT_DEP = concat.d main_cat.d

SSTAT_SRC = sstat.cpp main_sstat.cpp
SSTAT_OBJ = sstat.o main_sstat.o
SSTAT_DEP = sstat.d main_sstat.d

CONTRATES_SRC = main_contrates.cpp optimize_cont_models_nlopt.cpp
CONTRATES_OBJ = main_contrates.o optimize_cont_models_nlopt.o
CONTRATES_DEP = main_contrates.d optimize_cont_models_nlopt.d

SEQRECODE_SRC = recode.cpp main_recode.cpp
SEQRECODE_OBJ = recode.o main_recode.o
SEQRECODE_DEP = recode.d main_recode.d

BP_SRC = main_bp.cpp
BP_OBJ = main_bp.o
BP_DEP = main_bp.d

#BPSEQ_SRC = main_bpseq.cpp
#BPSEQ_OBJ = main_bpseq.o
#BPSEQ_DEP = main_bpseq.d

T2NEW_SRC = main_t2new.cpp
T2NEW_OBJ = main_t2new.o
T2NEW_DEP = main_t2new.d

T2NEX_SRC = main_t2nex.cpp
T2NEX_OBJ = main_t2nex.o
T2NEX_DEP = main_t2nex.d

RR_SRC = main_rr.cpp
RR_OBJ = main_rr.o
RR_DEP = main_rr.d

MONO_SRC = main_mono.cpp
MONO_OBJ = main_mono.o
MONO_DEP = main_mono.d

RMT_SRC = main_rmt.cpp
RMT_OBJ = main_rmt.o
RMT_DEP = main_rmt.d

TRT_SRC = main_trt.cpp
TRT_OBJ = main_trt.o
TRT_DEP = main_trt.d

RMK_SRC = main_rmk.cpp
RMK_OBJ = main_rmk.o
RMK_DEP = main_rmk.d

#removing for fortran, updating for non-fortran in process
#SM0_SRC = main_sm0.cpp
#SM0_OBJ = main_sm0.o
#SM0_DEP = main_sm0.d

#SM2A_SRC = main_sm2a.cpp
#SM2A_OBJ = main_sm2a.o
#SM2A_DEP = main_sm2a.d

CLSQ_SRC = clean_seq.cpp main_clsq.cpp
CLSQ_OBJ = clean_seq.o main_clsq.o
CLSQ_DEP = clean_seq.d main_clsq.d

CLTR_SRC = clean_tree.cpp main_cltr.cpp
CLTR_OBJ = clean_tree.o main_cltr.o
CLTR_DEP = clean_tree.d main_cltr.d

AA2C_SRC = aa2cdn.cpp main_aa2cdn.cpp
AA2C_OBJ = aa2cdn.o main_aa2cdn.o
AA2C_DEP = aa2cdn.d main_aa2cdn.d

TLATE_SRC = tlate.cpp main_tlate.cpp
TLATE_OBJ = tlate.o main_tlate.o
TLATE_DEP = tlate.d main_tlate.d

RMS_SRC = main_rms.cpp
RMS_OBJ = main_rms.o
RMS_DEP = main_rms.d

NJ_SRC = nj.cpp main_nj.cpp
NJ_OBJ = nj.o main_nj.o
NJ_DEP = nj.d main_nj.d

LOGMANIP_SRC = log_manip.cpp main_log.cpp
LOGMANIP_OBJ = log_manip.o main_log.o
LOGMANIP_DEP = log_manip.d main_log.d

VCF2FA_SRC = vcf_reader.cpp main_vcf2fa.cpp
VCF2FA_OBJ = vcf_reader.o main_vcf2fa.o
VCF2FA_DEP = vcf_reader.d main_vcf2fa.d

LS_SQ_SRC = seq_info.cpp main_lssq.cpp
LS_SQ_OBJ = seq_info.o main_lssq.o
LS_SQ_DEP = seq_info.d main_lssq.d

LS_TR_SRC = tree_info.cpp main_lstr.cpp
LS_TR_OBJ = tree_info.o main_lstr.o
LS_TR_DEP = tree_info.d main_lstr.d

COMPTEST_SRC = comp_test.cpp main_comp.cpp
COMPTEST_OBJ = comp_test.o main_comp.o
COMPTEST_DEP = comp_test.d main_comp.d

RELABEL_TREE_SRC = relabel.cpp main_rlt.cpp
RELABEL_TREE_OBJ = relabel.o main_rlt.o
RELABEL_TREE_DEP = relabel.d main_rlt.d

RELABEL_SEQ_SRC = relabel.cpp main_rls.cpp
RELABEL_SEQ_OBJ = relabel.o main_rls.o
RELABEL_SEQ_DEP = relabel.d main_rls.d

SEQ_SPLIT_SRC = main_ssplit.cpp
SEQ_SPLIT_OBJ = main_ssplit.o
SEQ_SPLIT_DEP = main_ssplit.d

RESCALE_TREE_SRC = tscale.cpp main_tscale.cpp
RESCALE_TREE_OBJ = tscale.o main_tscale.o
RESCALE_TREE_DEP = tscale.d main_tscale.d

TCOL_SRC = main_tcol.cpp
TCOL_OBJ = main_tcol.o
TCOL_DEP = main_tcol.d

TCOMB_SRC = main_tcomb.cpp
TCOMB_OBJ = main_tcomb.o
TCOMB_DEP = main_tcomb.d

TGEN_SRC = tgen.cpp main_tgen.cpp
TGEN_OBJ = tgen.o main_tgen.o
TGEN_DEP = tgen.d main_tgen.d

SSORT_SRC = main_ssort.cpp
SSORT_OBJ = main_ssort.o
SSORT_DEP = main_ssort.d

POLY_SRC = polytomy.cpp main_poly.cpp
POLY_OBJ = polytomy.o main_poly.o
POLY_DEP = polytomy.d main_poly.d

COLLAPSE_TREE_SRC = collapse_tree.cpp main_colt.cpp
COLLAPSE_TREE_OBJ = collapse_tree.o main_colt.o
COLLAPSE_TREE_DEP = collapse_tree.d main_colt.d

CPP_SRCS += \
./utils.cpp \
./citations.cpp \
./log.cpp \
./superdouble.cpp \
./timer.cpp

TREE_SRCS += \
./node.cpp \
./tree.cpp \
./tree_reader.cpp \
./tree_utils.cpp

SEQ_SRCS += \
./sequence.cpp \
./seq_reader.cpp \
./seq_utils.cpp \
./seq_models.cpp \
./pairwise_alignment.cpp

RATE_SRCS += \
./rate_model.cpp \
./state_reconstructor.cpp \
./optimize_state_reconstructor_nlopt.cpp \
./optimize_state_reconstructor_periods_nlopt.cpp \
./branch_segment.cpp \
./cont_models.cpp \
./seq_gen.cpp 
#removing to get rid of fortran. update in process
#./mcmc.cpp \
#./state_reconstructor_simple.cpp \

CPP_OBJS += \
./utils.o \
./citations.o \
./log.o \
./superdouble.o \
./timer.o

TREE_OBJS += \
./node.o \
./tree.o \
./tree_reader.o \
./tree_utils.o

SEQ_OBJS += \
./sequence.o \
./seq_reader.o \
./seq_utils.o \
./seq_models.o \
./pairwise_alignment.o

RATE_OBJS += \
./rate_model.o \
./state_reconstructor.o \
./optimize_state_reconstructor_nlopt.o \
./optimize_state_reconstructor_periods_nlopt.o \
./branch_segment.o \
./cont_models.o \
./seq_gen.o
#removing to get rid of fortran. update in process
#./mcmc.o \
#./state_reconstructor_simple.o \

CPP_DEPS += \
./utils.d \
./citations.d \
./log.d \
./superdouble.d \
./timer.d

TREE_DEPS += \
./node.d \
./tree.d \
./tree_reader.d \
./tree_utils.d

SEQ_DEPS += \
./sequence.d \
./seq_reader.d \
./seq_utils.d \
./seq_models.d \
./pairwise_alignment.d

RATE_DEPS += \
./rate_model.d \
./state_reconstructor.d \
./optimize_state_reconstructor_nlopt.d \
./optimize_state_reconstructor_periods_nlopt.d \
./branch_segment.d \
./cont_models.d \
./seq_gen.d
#removing to get rid of fortran. update in process
#./mcmc.d \
#./state_reconstructor_simple.d \

main_%.o: ./main_%.cpp
	$(CXX) $(CXXFLAGS) $(OPT_FLAGS) $(CPPFLAGS) $(LDFLAGS) -c -fmessage-length=0 -MMD -MP -MF "$(@:%.o=%.d)" -o "$@" "$<"

%.o: ./%.cpp ./%.h
	$(CXX) $(CXXFLAGS) $(OPT_FLAGS) $(CPPFLAGS) $(LDFLAGS) -c -fmessage-length=0 -MMD -MP -MF "$(@:%.o=%.d)" -o "$@" "$<"

PROGS := pxaa2cdn pxbdsim pxboot pxbp pxcat pxclsq pxcltr pxcolt pxcomp pxconsq pxfqfilt pxlog pxlssq pxlstr pxmono pxmrca pxmrcacut pxmrcaname pxnw pxpoly pxrecode pxrevcomp pxrls pxupgma pxrlt pxnj pxrmk pxrms pxrmt pxrr pxs2fa pxs2nex pxs2phy pxseqgen pxssort pxsstat pxsw pxt2new pxt2nex pxtcol pxtcomb pxtgen pxtlate pxtrt pxtscale pxvcf2fa $(NLOPT_PROGRAMS)

# default all target
all: $(PROGS)

## Sequence-oriented programs ##

pxlssq: $(CPP_OBJS) $(SEQ_OBJS) $(LS_SQ_OBJ)
	@echo 'bulding pxlssq'
	$(CXX) $(CXXFLAGS) -o "pxlssq" $(OPT_FLAGS) $(LS_SQ_OBJ) $(CPP_OBJS) $(SEQ_OBJS)
	cat man/$@.1.in > man/$@.1

pxconsq: $(CPP_OBJS) $(SEQ_OBJS) $(CONSEQ_OBJ)
	@echo 'building pxconsq'
	$(CXX) $(CXXFLAGS) -o "pxconsq" $(OPT_FLAGS) $(CONSEQ_OBJ) $(CPP_OBJS) $(SEQ_OBJS)
	cat man/$@.1.in > man/$@.1

pxclsq: $(CPP_OBJS) $(SEQ_OBJS) $(CLSQ_OBJ)
	@echo 'building pxclsq'
	$(CXX) $(CXXFLAGS) -o "pxclsq" $(OPT_FLAGS) $(CLSQ_OBJ) $(CPP_OBJS) $(SEQ_OBJS)
	cat man/$@.1.in > man/$@.1

pxrms: $(CPP_OBJS) $(SEQ_OBJS) $(RMS_OBJ)
	@echo 'building pxrms'
	$(CXX) $(CXXFLAGS) -o "pxrms" $(OPT_FLAGS) $(RMS_OBJ) $(CPP_OBJS) $(SEQ_OBJS)
	cat man/$@.1.in > man/$@.1

pxaa2cdn: $(CPP_OBJS) $(SEQ_OBJS) $(AA2C_OBJ)
	@echo 'building pxaa2cdn'
	$(CXX) $(CXXFLAGS) -o "pxaa2cdn" $(OPT_FLAGS) $(AA2C_OBJ) $(CPP_OBJS) $(SEQ_OBJS)
	cat man/$@.1.in > man/$@.1

pxs2fa: $(CPP_OBJS) $(SEQ_OBJS) $(2FA_OBJ)
	@echo 'building pxs2fa'
	$(CXX) $(CXXFLAGS) -o "pxs2fa" $(OPT_FLAGS) $(2FA_OBJ) $(CPP_OBJS) $(SEQ_OBJS)
	cat man/$@.1.in > man/$@.1

pxs2phy: $(CPP_OBJS) $(SEQ_OBJS) $(2PHY_OBJ)
	@echo 'building pxs2phy'
	$(CXX) $(CXXFLAGS) -o "pxs2phy" $(OPT_FLAGS) $(2PHY_OBJ) $(CPP_OBJS) $(SEQ_OBJS)
	cat man/$@.1.in > man/$@.1

pxs2nex: $(CPP_OBJS) $(SEQ_OBJS) $(2NEX_OBJ)
	@echo 'building pxs2nex'
	$(CXX) $(CXXFLAGS) -o "pxs2nex" $(OPT_FLAGS) $(2NEX_OBJ) $(CPP_OBJS) $(SEQ_OBJS)
	cat man/$@.1.in > man/$@.1

pxfqfilt: $(CPP_OBJS) $(SEQ_OBJS) $(FQFILT_OBJ)
	@echo 'building pxfqfilt'
	$(CXX) $(CXXFLAGS) -o "pxfqfilt" $(OPT_FLAGS) $(FQFILT_OBJ) $(CPP_OBJS) $(SEQ_OBJS)
	cat man/$@.1.in > man/$@.1

pxrevcomp: $(CPP_OBJS) $(SEQ_OBJS) $(REVCOMP_OBJ)
	@echo 'building pxrevcomp'
	$(CXX) $(CXXFLAGS) -o "pxrevcomp" $(OPT_FLAGS) $(REVCOMP_OBJ) $(CPP_OBJS) $(SEQ_OBJS)
	cat man/$@.1.in > man/$@.1

pxnw: $(CPP_OBJS) $(SEQ_OBJS) $(NW_OBJ)
	@echo 'building pxnw'
	$(CXX) $(CXXFLAGS) -o "pxnw" $(OPT_FLAGS) $(NW_OBJ) $(CPP_OBJS) $(SEQ_OBJS)
	cat man/$@.1.in > man/$@.1

pxsw: $(CPP_OBJS) $(SEQ_OBJS) $(SW_OBJ)
	@echo 'building pxsw'
	$(CXX) $(CXXFLAGS) -o "pxsw" $(OPT_FLAGS) $(SW_OBJ) $(CPP_OBJS) $(SEQ_OBJS)
	cat man/$@.1.in > man/$@.1

pxboot: $(CPP_OBJS) $(SEQ_OBJS) $(SEQSAMP_OBJ)
	@echo 'building pxboot'
	$(CXX) $(CXXFLAGS) -o "pxboot" $(OPT_FLAGS) $(SEQSAMP_OBJ) $(CPP_OBJS) $(SEQ_OBJS)
	cat man/$@.1.in > man/$@.1

pxtlate: $(CPP_OBJS) $(SEQ_OBJS) $(TLATE_OBJ)
	@echo 'building pxtlate'
	$(CXX) $(CXXFLAGS) -o "pxtlate" $(OPT_FLAGS) $(TLATE_OBJ) $(CPP_OBJS) $(SEQ_OBJS)
	cat man/$@.1.in > man/$@.1

pxcat: $(CPP_OBJS) $(SEQ_OBJS) $(CONCAT_OBJ)
	@echo 'building pxcat'
	$(CXX) $(CXXFLAGS) -o "pxcat" $(OPT_FLAGS) $(CONCAT_OBJ) $(CPP_OBJS) $(SEQ_OBJS)
	cat man/$@.1.in > man/$@.1

pxsstat: $(CPP_OBJS) $(SEQ_OBJS) $(SSTAT_OBJ)
	@echo 'building pxsstat'
	$(CXX) $(CXXFLAGS) -o "pxsstat" $(OPT_FLAGS) $(SSTAT_OBJ) $(CPP_OBJS) $(SEQ_OBJS)
	cat man/$@.1.in > man/$@.1

pxrecode: $(CPP_OBJS) $(SEQ_OBJS) $(SEQRECODE_OBJ)
	@echo 'building pxrecode'
	$(CXX) $(CXXFLAGS) -o "pxrecode" $(OPT_FLAGS) $(SEQRECODE_OBJ) $(CPP_OBJS) $(SEQ_OBJS)
	cat man/$@.1.in > man/$@.1

pxssort: $(CPP_OBJS) $(SEQ_OBJS) $(SSORT_OBJ)
	@echo 'building pxssort'
	$(CXX) $(CXXFLAGS) -o "pxssort" $(OPT_FLAGS) $(SSORT_OBJ) $(CPP_OBJS) $(SEQ_OBJS)
	cat man/$@.1.in > man/$@.1

pxcomp: $(CPP_OBJS) $(SEQ_OBJS) $(COMPTEST_OBJ)
	@echo 'building pxcomp'
	$(CXX) $(CXXFLAGS) -o "pxcomp" $(OPT_FLAGS) $(COMPTEST_OBJ) $(CPP_OBJS) $(SEQ_OBJS)
	cat man/$@.1.in > man/$@.1

pxvcf2fa: $(CPP_OBJS) $(SEQ_OBJS) $(VCF2FA_OBJ)
	@echo 'building pxvcf2fa'
	$(CXX) $(CXXFLAGS) -o "pxvcf2fa" $(OPT_FLAGS) $(VCF2FA_OBJ) $(CPP_OBJS) $(SEQ_OBJS)
	cat man/$@.1.in > man/$@.1

pxssplit: $(CPP_OBJS) $(SEQ_OBJS) $(SEQ_SPLIT_OBJ)
	@echo 'building pxssplit'
	$(CXX) $(CXXFLAGS) -o "pxssplit" $(OPT_FLAGS) $(SEQ_SPLIT_OBJ) $(CPP_OBJS) $(SEQ_OBJS)
	cat man/$@.1.in > man/$@.1


## Tree-oriented programs ##

pxbdsim: $(CPP_OBJS) $(TREE_OBJS) $(BD_SIM_OBJ)
	@echo 'building pxbdsim'
	$(CXX) $(CXXFLAGS) -o "pxbdsim" $(OPT_FLAGS) $(BD_SIM_OBJ) $(CPP_OBJS) $(TREE_OBJS)
	cat man/$@.1.in > man/$@.1

pxbdfit: $(CPP_OBJS) $(TREE_OBJS) $(BD_FIT_OBJ)
	@echo 'building pxbdfit'
	$(CXX) $(CXXFLAGS) -o "pxbdfit" $(OPT_FLAGS) $(BD_FIT_OBJ) $(CPP_OBJS) $(TREE_OBJS) $(CPPFLAGS) $(LDFLAGS) $(CPP_LIBS)
	cat man/$@.1.in > man/$@.1

pxnni: $(CPP_OBJS) $(TREE_OBJS) $(NNI_OBJ)
	@echo 'building pxnni'
	$(CXX) $(CXXFLAGS) -o "pxnni" $(OPT_FLAGS) $(NNI_OBJ) $(CPP_OBJS) $(TREE_OBJS) $(CPPFLAGS) $(LDFLAGS) $(CPP_LIBS)
	cat man/$@.1.in > man/$@.1

pxlstr: $(CPP_OBJS) $(TREE_OBJS) $(LS_TR_OBJ)
	@echo 'building pxlstr'
	$(CXX) $(CXXFLAGS) -o "pxlstr" $(OPT_FLAGS) $(LS_TR_OBJ) $(CPP_OBJS) $(TREE_OBJS)
	cat man/$@.1.in > man/$@.1

pxmrca: $(CPP_OBJS) $(TREE_OBJS) $(MRCA_OBJ)
	@echo 'building pxmrca'
	$(CXX) $(CXXFLAGS) -o "pxmrca" $(OPT_FLAGS) $(MRCA_OBJ) $(CPP_OBJS) $(TREE_OBJS)
	cat man/$@.1.in > man/$@.1

pxmrcacut: $(CPP_OBJS) $(TREE_OBJS) $(MRCACUT_OBJ)
	@echo 'building pxmrcacut'
	$(CXX) $(CXXFLAGS) -o "pxmrcacut" $(OPT_FLAGS) $(MRCACUT_OBJ) $(CPP_OBJS) $(TREE_OBJS)
	cat man/$@.1.in > man/$@.1

pxmrcaname: $(CPP_OBJS) $(TREE_OBJS) $(MRCANAME_OBJ)
	@echo 'building pxmrcaname'
	$(CXX) $(CXXFLAGS) -o "pxmrcaname" $(OPT_FLAGS) $(MRCANAME_OBJ) $(CPP_OBJS) $(TREE_OBJS)
	cat man/$@.1.in > man/$@.1

pxcltr: $(CPP_OBJS) $(TREE_OBJS) $(CLTR_OBJ)
	@echo 'building pxcltr'
	$(CXX) $(CXXFLAGS) -o "pxcltr" $(OPT_FLAGS) $(CLTR_OBJ) $(CPP_OBJS) $(TREE_OBJS)
	cat man/$@.1.in > man/$@.1

pxt2new: $(CPP_OBJS) $(TREE_OBJS) $(T2NEW_OBJ)
	@echo 'building pxt2new'
	$(CXX) $(CXXFLAGS) -o "pxt2new" $(OPT_FLAGS) $(T2NEW_OBJ) $(CPP_OBJS) $(TREE_OBJS)
	cat man/$@.1.in > man/$@.1

pxt2nex: $(CPP_OBJS) $(TREE_OBJS) $(T2NEX_OBJ)
	@echo 'building pxt2nex'
	$(CXX) $(CXXFLAGS) -o "pxt2nex" $(OPT_FLAGS) $(T2NEX_OBJ) $(CPP_OBJS) $(TREE_OBJS)
	cat man/$@.1.in > man/$@.1

pxrr: $(CPP_OBJS) $(TREE_OBJS) $(RR_OBJ)
	@echo 'building pxrr'
	$(CXX) $(CXXFLAGS) -o "pxrr" $(OPT_FLAGS) $(RR_OBJ) $(CPP_OBJS) $(TREE_OBJS)
	cat man/$@.1.in > man/$@.1

pxmono: $(CPP_OBJS) $(TREE_OBJS) $(MONO_OBJ)
	@echo 'building pxmono'
	$(CXX) $(CXXFLAGS) -o "pxmono" $(OPT_FLAGS) $(MONO_OBJ) $(CPP_OBJS) $(TREE_OBJS)
	cat man/$@.1.in > man/$@.1

pxrmt: $(CPP_OBJS) $(TREE_OBJS) $(RMT_OBJ)
	@echo 'building pxrmt'
	$(CXX) $(CXXFLAGS) -o "pxrmt" $(OPT_FLAGS) $(RMT_OBJ) $(CPP_OBJS) $(TREE_OBJS)
	cat man/$@.1.in > man/$@.1

pxtrt: $(CPP_OBJS) $(TREE_OBJS) $(TRT_OBJ)
	@echo 'building pxtrt'
	$(CXX) $(CXXFLAGS) -o "pxtrt" $(OPT_FLAGS) $(TRT_OBJ) $(CPP_OBJS) $(TREE_OBJS)
	cat man/$@.1.in > man/$@.1

pxrmk: $(CPP_OBJS) $(TREE_OBJS) $(RMK_OBJ)
	@echo 'building pxrmk'
	$(CXX) $(CXXFLAGS) -o "pxrmk" $(OPT_FLAGS) $(RMK_OBJ) $(CPP_OBJS) $(TREE_OBJS)
	cat man/$@.1.in > man/$@.1

pxlog: $(CPP_OBJS) $(TREE_OBJS) $(LOGMANIP_OBJ)
	@echo 'building pxlog'
	$(CXX) $(CXXFLAGS) -o "pxlog" $(OPT_FLAGS) $(LOGMANIP_OBJ) $(CPP_OBJS) $(TREE_OBJS)
	cat man/$@.1.in > man/$@.1

pxtscale: $(CPP_OBJS) $(TREE_OBJS) $(RESCALE_TREE_OBJ)
	@echo 'building pxtscale'
	$(CXX) $(CXXFLAGS) -o "pxtscale" $(OPT_FLAGS) $(RESCALE_TREE_OBJ) $(CPP_OBJS) $(TREE_OBJS)
	cat man/$@.1.in > man/$@.1
	
pxtcol: $(CPP_OBJS) $(TREE_OBJS) $(TCOL_OBJ)
	@echo 'building pxtcol'
	$(CXX) $(CXXFLAGS) -o "pxtcol" $(OPT_FLAGS) $(TCOL_OBJ) $(CPP_OBJS) $(TREE_OBJS)
	cat man/$@.1.in > man/$@.1

pxtcomb: $(CPP_OBJS) $(TREE_OBJS) $(TCOMB_OBJ)
	@echo 'building pxtcomb'
	$(CXX) $(CXXFLAGS) -o "pxtcomb" $(OPT_FLAGS) $(TCOMB_OBJ) $(CPP_OBJS) $(TREE_OBJS)
	cat man/$@.1.in > man/$@.1

pxtgen: $(CPP_OBJS) $(TREE_OBJS) $(TGEN_OBJ)
	@echo 'building pxtgen'
	$(CXX) $(CXXFLAGS) -o "pxtgen" $(OPT_FLAGS) $(TGEN_OBJ) $(CPP_OBJS) $(TREE_OBJS)
	cat man/$@.1.in > man/$@.1

pxpoly: $(CPP_OBJS) $(TREE_OBJS) $(POLY_OBJ)
	@echo 'building pxpoly'
	$(CXX) $(CXXFLAGS) -o "pxpoly" $(OPT_FLAGS) $(POLY_OBJ) $(CPP_OBJS) $(TREE_OBJS)
	cat man/$@.1.in > man/$@.1

pxcolt: $(CPP_OBJS) $(TREE_OBJS) $(COLLAPSE_TREE_OBJ)
	@echo 'building pxcolt'
	$(CXX) $(CXXFLAGS) -o "pxcolt" $(OPT_FLAGS) $(COLLAPSE_TREE_OBJ) $(CPP_OBJS) $(TREE_OBJS)
	cat man/$@.1.in > man/$@.1

pxbp: $(CPP_OBJS) $(TREE_OBJS) $(BP_OBJ)
	@echo 'building pxbp'
	$(CXX) $(CXXFLAGS) -o "pxbp" $(OPT_FLAGS) $(BP_OBJ) $(CPP_OBJS) $(TREE_OBJS)
	cat man/$@.1.in > man/$@.1


## Mixed tree + sequences ##

pxrls: $(CPP_OBJS) $(SEQ_OBJS) $(TREE_OBJS) $(RELABEL_SEQ_OBJ)
	@echo 'building pxrls'
	$(CXX) $(CXXFLAGS) -o "pxrls" $(OPT_FLAGS) $(RELABEL_SEQ_OBJ) $(CPP_OBJS) $(SEQ_OBJS) $(TREE_OBJS)
	cat man/$@.1.in > man/$@.1

pxrlt: $(CPP_OBJS) $(SEQ_OBJS) $(TREE_OBJS) $(RELABEL_TREE_OBJ)
	@echo 'building pxrlt'
	$(CXX) $(CXXFLAGS) -o "pxrlt" $(OPT_FLAGS) $(RELABEL_TREE_OBJ) $(CPP_OBJS) $(SEQ_OBJS) $(TREE_OBJS)
	cat man/$@.1.in > man/$@.1

pxupgma: $(CPP_OBJS) $(SEQ_OBJS) $(TREE_OBJS) $(UPGMA_OBJ)
	@echo 'building pxupgma'
	$(CXX) $(CXXFLAGS) -o "pxupgma" $(OPT_FLAGS) $(UPGMA_OBJ) $(CPP_OBJS) $(SEQ_OBJS) $(TREE_OBJS)
	cat man/$@.1.in > man/$@.1

pxnj: $(CPP_OBJS) $(SEQ_OBJS) $(TREE_OBJS) $(NJ_OBJ)
	@echo 'building pxnj'
	$(CXX) $(CXXFLAGS) -o "pxnj" $(OPT_FLAGS) $(NJ_OBJ) $(CPP_OBJS) $(SEQ_OBJS) $(TREE_OBJS)
	cat man/$@.1.in > man/$@.1


## ... + rates ##

pxseqgen: $(CPP_OBJS) $(SEQ_OBJS) $(TREE_OBJS) $(RATE_OBJS) $(SEQGEN_OBJ) $(FORT_OBJS)
	@echo 'building pxseqgen'
	$(CXX) $(CXXFLAGS) -o "pxseqgen" $(OPT_FLAGS) $(SEQGEN_OBJ) $(CPP_OBJS) $(SEQ_OBJS) $(TREE_OBJS) $(RATE_OBJS) $(CPPFLAGS) $(LDFLAGS) $(CPP_LIBS)
	cat man/$@.1.in > man/$@.1

pxcontrates: $(CPP_OBJS) $(SEQ_OBJS) $(TREE_OBJS) $(CONTRATES_OBJ) $(RATE_OBJS)
	@echo 'building pxcontrates'
	$(CXX) $(CXXFLAGS) -o "pxcontrates" $(OPT_FLAGS) $(CONTRATES_OBJ) $(RATE_OBJS) $(CPP_OBJS) $(SEQ_OBJS) $(TREE_OBJS) $(CPPFLAGS) $(LDFLAGS) $(CPP_LIBS)
	cat man/$@.1.in > man/$@.1

pxstrec: $(CPP_OBJS) $(SEQ_OBJS) $(TREE_OBJS) $(RATE_OBJS) $(STREC_OBJ) #$(FORT_OBJS)
	@echo 'building pxstrec'
	$(CXX) $(CXXFLAGS) -o "pxstrec" $(OPT_FLAGS) $(STREC_OBJ) $(CPP_OBJS) $(SEQ_OBJS) $(TREE_OBJS) $(RATE_OBJS) $(CPPFLAGS) $(LDFLAGS) $(CPP_LIBS) #$(FORT_OBJS) -lgfortran
	cat man/$@.1.in > man/$@.1



#removing until fortran update
#pxsm0: $(CPP_OBJS) $(RATE_OBJS) $(SM0_OBJ) $(FORT_OBJS)
#	@echo 'building pxsm0'
#	$(CXX) $(CXXFLAGS) -o "pxsm0" $(OPT_FLAGS) $(SM0_OBJ) $(CPP_OBJS) $(RATE_OBJS) $(FORT_OBJS) $(CPP_LIBS) -lgfortran

#pxsm2a: $(CPP_OBJS) $(RATE_OBJS) $(SM2A_OBJ) $(FORT_OBJS)
#	@echo 'building pxsm2a'
#	$(CXX) $(CXXFLAGS) -o "pxsm2a" $(OPT_FLAGS) $(SM2A_OBJ) $(CPP_OBJS) $(RATE_OBJS) $(FORT_OBJS) $(CPP_LIBS) -lgfortran



install:
	mkdir -p $(PREFIX)/bin && install -m 0755 px* $(PREFIX)/bin
	mkdir -p $(MANDIR)/man1 && install -m 0755 man/px*.1 $(MANDIR)/man1

uninstall:
	-$(RM) $(addprefix $(PREFIX)/bin/, $(PROGS))
	-$(RM) $(addprefix $(MANDIR)/man1/, $(addsuffix .1, $(PROGS)))

# Other Targets
clean:
	-$(RM) *.o *.d px* man/px*.1

distclean:
	-$(RM) *.o *.d px* man/px*.1 configure config.log config.h config.status Makefile

check:
	python3 run_tests.py

test:
	python3 run_tests.py

installcheck:
	python3 run_tests.py $(PREFIX)/bin