summaryrefslogtreecommitdiff
path: root/web/yacco2/o2linker/makefile_APPLE
blob: f2a08e73a2793ca06b580ff23a3dda7e182a0cd4 (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
# File: makefile_APPLE
# Why:  Creates the o2linker companion to o2 compiler /compiler
# Library placement: 
#   Rlse:   /usr/local/yacco2/bin/o2linker
#   Dbg:    /usr/local/yacco2/bin/o2linker_debug
#   Genw:   Create the pdf file: yacco2/docs
#           Generate the *.cpp files from cweb
#
# How to run: U must choose the label to execute: Rlse, Dbg
#   Rlse --- gen the fast version of o2linker with no debug support
#   Dbg --- gen the debug version of o2liner_debug
#   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 debug version compiler/compiler linker: o2linker_debug using GNU make
#  cd /usr/local//yacco2/compiler/grammars
#  make Dbg -f makefile_APPLE
# Example: gen document and cpp sub/programs
#  make Genw -f makefile_APPLE
#

O2 := /usr/local/yacco2
#CC := /opt/local/bin/gcc-mp-4.9
CC := clang++ #g++
#LD := /opt/local/bin/ld
LD := ld #apple linker
LD_PARMS :=  -arch x86_64 #-macosx_version_min 10.9 -no_compact_unwind 

02_target_dir :=
ifeq ($(MAKECMDGOALS),Rlse)
O2_target_dir := Release 
Prg := o2linker
Compile_opts :=  -c -pthread -arch x86_64 #-frepo -fno-implicit-templates -fno-rtti 
else
O2_target_dir := Debug
Prg := o2linker_debug
Compile_opts := -c -g -pthread  -arch x86_64 
endif

###
# Set up directories
###
Base_o2     := $(O2)
O2_bin      := $(Base_o2)/bin
O2_eternals := $(Base_o2)/externals
O2_docs     := $(Base_o2)/docs
O2_lib      := $(Base_o2)/library
O2_lib_grms := $(Base_o2)/library/grammars
O2_cc_grms  := $(Base_o2)/compiler/grammars
O2_cc       := $(Base_o2)/compiler/o2
O2_includes :=  -I'$(O2_cc_grms)' -I'$(O2_lib)' -I'$(O2_lib_grms)'
O2_req_libraries :=   -lyacco2 -lo2grammars 
O2_lib_directories := -L$(O2_cc_grms)/lib/$(O2_target_dir) -L$(O2_lib)/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_o2linker 
Dbg: YYY Move_o2linker 	
YYY:
	$(CC) $(Compile_opts)  $(O2_includes) o2linker.cpp -o $(Prg).o 
	$(CC) $(Compile_opts)  $(O2_includes) common_externs.cpp -o common_externs.o 
	$(CC) $(Compile_opts)  $(O2_includes) o2linker_externs.cpp -o o2linker_externs.o 
	$(CC) $(Compile_opts)  $(O2_includes) o2linker_defs.cpp -o o2linker_defs.o 
	$(LD) $(LD_PARMS) -o $(Prg) $(STDCC_dir) $(O2_lib_directories) $(O2_req_libraries) -l$(CC_lib)  -lpthread  o2linker_externs.o o2linker_defs.o common_externs.o $(Prg).o

Move_o2linker:
	mv $(Prg) $(O2_bin)
	rm *.o

Genw:
	cweave o2linker_types
	pdftex o2linker_types
	mv o2linker_types.pdf $(O2_docs)
	cweave o2linker
	pdftex o2linker
	mv o2linker.pdf $(O2_docs)
	cweave $(O2_eternals)/common_externs
	pdftex common_externs
	mv common_externs.pdf $(O2_docs)
	cweave o2linker_externs
	pdftex o2linker_externs
	mv o2linker_externs.pdf $(O2_docs)
	ctangle -l +e $(O2_eternals)/common_externs
	ctangle -l +e o2linker_externs
	ctangle -l +e o2linker_defs
	ctangle -l +e o2linker
	ctangle -l +e o2linker_types
	sh Makefile_Edit_cweb
	rm *.idx
	rm *.scn
	rm *.toc
	rm *.tex
	rm *.log
	rm *.c