summaryrefslogtreecommitdiff
path: root/web/yacco2/o2testdriver/makefile_APPLE
blob: ca43223de457cf7488a58aa0cd9eca3e9107a1a8 (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
# File: makefile_APPLE
# Why:  Creates the testdriver using the GNU make program
# Ks:   Depending on your system, this utility might be called gmake or make
#
# O2 placement: 
#   Rlse:   /usr/local/yacco2/bin/o2
#   Dbg:    /usr/local/yacco2/bin/o2_debug
#   Genw:   for the pdf file: yacco2/docs
#           for the *.cpp files
#
# How to run: U must choose the label to execute: Rlse, Dbg, or Genw
#   Rlse --- gen the optimizwd version of O2 with no debug support
#   Dbg --- gen the debug version of O2
#   Genw --- gen the pdf document and the cpp code 
#            from cweb see www.tug.org for details on obtaining code
#            for the literate programming environment aka CWEB
#            and please join Tug. It is a marvelous FOSS
#            Note: U do not need to use Genw as *.cpp and pdf 
#                  document are included in the ``yacco2'' package
#
# ---> Know where the stdc++ library resides and adjust the STDCC_dir variable
#
# Example: gen the compiler/compiler o2 release version using GNU make
#  cd /usr/local//yacco2/o2testdriver
#  make Rlse -f makefile_APPLE
#
# Example: gen programs from cweb
#  make Genw -f makefile_APPLE
#

O2 := /usr/local/yacco2
##CC := /opt/local/bin/c++-mp-4.9
CC := clang++#g++
##LD := /opt/local/bin/ld
LD := ld #apple linker
02_target_dir :=
Prg := testdriver
O2_target_dir := Release 
Compile_opts :=  -c -pthread  -arch x86_64 #-frepo -fno-implicit-templates -fno-rtti

###
# Set up directories
###
Base_o2     := $(O2)
O2_bin      := $(Base_o2)/bin
O2_eternals := $(Base_o2)/externals
O2_docs     := $(Base_o2)/docs
O2_docs     := $(Base_o2)/docs
O2_library  := $(Base_o2)/library
O2_library_lib  := $(O2_library)/lib
O2_lib_grms := $(O2_library)/grammars
O2_cc_grms  := $(Base_o2)/compiler/grammars
O2_cc       := $(Base_o2)/compiler/o2
O2_testdriver := $(Base_o2)/o2testdriver
O2_includes :=   -I'$(O2_testdriver)' -I'$(O2_cc_grms)' -I'$(O2_library)' -I'$(O2_lib_grms)'
O2_req_libraries :=   -lyacco2 -lo2grammars 
O2_lib_directories := -L$(O2_cc_grms)/lib/$(O2_target_dir) -L$(O2_library_lib)/$(O2_target_dir) 

CC_lib      := c++ 
##CC_lib      := stdc++ #gnu c++
LD_PARMS :=  -arch x86_64 -macosx_version_min 10.9 #-stack_size 0x2000000  -no_compact_unwind 

#STDCC_dir := -L/usr/llvm-gcc-4.2/lib/gcc/i686-apple-darwin11/4.2.1/
##STDCC_dir := -L/opt/local/lib/gcc49/ #gnu c++
STDCC_dir := -L/usr/lib/

###
#    Compile, link, and move O2 into bin account 
###
Rlse: YYY Move_o2 

YYY:
	$(CC) -v $(Compile_opts)  $(O2_includes) testdriver.cpp -o $(Prg).o 
	$(CC) -v $(Compile_opts)  $(O2_includes) common_externs.cpp -o common_externs.o
	$(CC) -v $(Compile_opts)  $(O2_includes) o2_externs.cpp -o o2_externs.o
	$(CC) -v $(Compile_opts)  $(O2_includes) o2_defs.cpp -o o2_defs.o
	$(LD)  $(LD_PARMS) -o $(Prg) $(STDCC_dir) $(O2_lib_directories) $(O2_req_libraries) -l$(CC_lib) -lpthread o2_externs.o o2_defs.o common_externs.o $(Prg).o

Move_o2:
	mv $(Prg) $(O2_bin)
	rm *.o
 
Genw:
	cweave testdriver
	pdftex testdriver
	mv testdriver.pdf $(O2_docs)
	ctangle -l +e testdriver
	rm *.idx
	rm *.scn
	rm *.toc
	rm *.tex
	rm *.log
	rm *.c