summaryrefslogtreecommitdiff
path: root/web/yacco2/grammar-testsuite/makefile_testout_APPLE
blob: d7195ddf23e22b31455acf3b38a694b7586cdd7b (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
# File: makefile_testout_APPLE
# Why:  Creates the testout using the GNU make program
# Ks:   Depending on your system, this utility might be called gmake or make
#
# testout placement: 
#   Rlse:   /usr/local/yacco2/grammar-testsuite
#
# How to run: U must choose the label to execute: Rlse, Dbg, or Genw
#   Rlse --- gen the optimized version of testout 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
#
# Make sure that the pager_1.lex and testout_err_hdlr.lex grammars has been gened:
# o2 pager_1.lex
# o2 testout_err_hdlr.lex
#
# Create the bitmaps for testout
# o2linker testout.fsc
#
# ---> 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/grammar-testsuite
#  make Rlse -f makefile_testout_APPLE
#
# Example: gen programs from cweb
#  make Genw -f makefile_testout_APPLE
#
echo "=======> Build testout compiler using pager_1.lex grammar"
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 :=
ifeq ($(MAKECMDGOALS),Rlse)
Prg := testout
O2_target_dir := Release 
Compile_opts :=  -c -pthread  -arch x86_64 #-frepo -fno-implicit-templates -fno-rtti
else
O2_target_dir := Debug
Prg := testout_debug
Compile_opts := -c -g -pthread -arch x86_64
endif

###
# Set up directories
###
Base_o2     := $(O2)
O2_library  := $(Base_o2)/library
O2_externs := $(Base_o2)/compiler/o2
O2_grammars := $(Base_o2)/compiler/grammars
O2_library_grm  := $(Base_o2)/library/grammars
O2_library_lib  := $(O2_library)/lib/Release
Testout   := $(Base_o2)/grammar-testsuite
Testout_includes :=  -I'$(Testout)' -I'$(O2_externs)'  -I'$(O2_grammars)'  -I'$(O2_library)' -I'$(O2_library_grm)'
Testout_req_libraries :=   -lyacco2 
Testout_lib_directories := -L$(O2_library_lib) 
CC_lib      := 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/usr/lib/

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

YYY:
	$(CC) -v $(Compile_opts)  $(Testout_includes) $(Prg).cpp -o $(Prg).o 
	$(CC) -v $(Compile_opts)  $(Testout_includes) testout_err_hdlr.cpp -o testout_err_hdlr.o
	$(CC) -v $(Compile_opts)  $(Testout_includes) testout_err_hdlrsym.cpp -o testout_err_hdlrsym.o
	$(CC) -v $(Compile_opts)  $(Testout_includes) testout_err_hdlrtbl.cpp -o testout_err_hdlrtbl.o
	$(CC) -v $(Compile_opts)  $(Testout_includes) pager_1.cpp -o pager_1.o
	$(CC) -v $(Compile_opts)  $(Testout_includes) pager_1sym.cpp -o pager_1sym.o
	$(CC) -v $(Compile_opts)  $(Testout_includes) pager_1tbl.cpp -o pager_1tbl.o
	$(CC) -v $(Compile_opts)  $(Testout_includes) testout_err_symbols.cpp -o testout_err_symbols.o
	$(CC) -v $(Compile_opts)  $(Testout_includes) testout_terminals.cpp -o testout_terminals.o
	$(CC) -v $(Compile_opts)  $(Testout_includes) testout_fsc.cpp -o testout_fsc.o
	$(LD)  $(LD_PARMS) -o $(Prg) $(STDCC_dir) $(Testout_lib_directories) $(Testout_req_libraries) -l$(CC_lib) -lpthread testout_err_symbols.o testout_terminals.o testout_err_hdlr.o testout_err_hdlrsym.o testout_err_hdlrtbl.o pager_1.o pager_1sym.o pager_1tbl.o testout_fsc.o $(Prg).o
	rm *o
	
Genw:
	cweave testout 
	pdftex testout
	mv testout\.pdf /usr/local/yacco2/docs/
	ctangle -l +e testout
	rm testout.idx
	rm testout.scn
	rm testout.toc
	rm testout.tex
	rm testout.log
	rm testout.c