summaryrefslogtreecommitdiff
path: root/web/yacco2/grammar-testsuite/makefile_testout_GNU
blob: 52a736732784c70f391b240aebac4a2de9101c7b (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
# File: makefile_GNU
# Why:  Creates the o2 compiler /compiler 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_dbg
#   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 marvalous FOSS
#            Note: U do not need to use Genw as *.cpp and pdf 
#                  document are included in the ``yacco2'' package
#
# Example: gen the debug version of the library using GNU make = gmake
#  cd /usr/local/yacco2/compiler/o2
#  make Rlse -f GNU_makefile
#
O2 := /usr/local/yacco2

CC := g++ 

02_target_dir :=
ifeq ($(MAKECMDGOALS),Rlse)
O2_target_dir := Release 
else
O2_target_dir := Debug
endif

###
# Set up directories
###
Base_yacco2     := $(O2)
O2_bin      := $(Base_yacco2)/bin
O2_eternals := $(Base_yacco2)/externals
O2_docs     := $(Base_yacco2)/docs
O2_lib      := $(Base_yacco2)/library
O2_lib_grms := $(Base_yacco2)/library/grammars
O2_cc_grms  := $(Base_yacco2)/compiler/grammars
O2_cc       := $(Base_yacco2)/compiler/o2
O2_includes :=  -I'$(O2_cc)' -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) 

###
# Set up c++ compiler and ld linker options
###

Rlse: Compile_opts :=  -c -O3 -pthread #-frepo -fno-implicit-templates -fno-rtti
Dbg: Compile_opts := -c -g -pthread -arch x86_64
Link_opts :=    -Wl,-z -Wl,muldefs -Wl,-Ur #$(O2_lib_directories)
Multi_rd_libs := -static-libgcc -Wl,--start-group -lyacco2 -lo2grammars -Wl,--end-group -lpthread

###
#    Compile, link, and move O2 into bin account 
###
Rlse: YYY Move_rlse_o2 
Dbg: YYY Move_dbg_o2 	
YYY:
	$(CC) -v $(Compile_opts) o2.cpp -o o2.o  $(O2_includes)
	$(CC) -v $(Compile_opts) common_externs.cpp -o common_externs.o $(O2_includes)
	$(CC) -v $(Compile_opts) o2_externs.cpp -o o2_externs.o $(O2_includes)
	$(CC) -v $(Compile_opts) o2_defs.cpp -o o2_defs.o $(O2_includes)
	ld '-o' 'o2' '-shared-libgcc' '-mtune=generic'\
	--eh-frame-hdr -m elf_i386 --hash-style=both -dynamic-linker\
	/lib/ld-linux.so.2 -o o2 -z relro /usr/lib/gcc/i486-linux-gnu/4.3.2/../../../../lib/crt1.o\
	/usr/lib/gcc/i486-linux-gnu/4.3.2/../../../../lib/crti.o /usr/lib/gcc/i486-linux-gnu/4.3.2/crtbegin.o\
	-L/usr/lib/gcc/i486-linux-gnu/4.3.2 -L/usr/lib/gcc/i486-linux-gnu/4.3.2\
	-L/usr/lib/gcc/i486-linux-gnu/4.3.2/../../../../lib -L/lib/../lib -L/usr/lib/../lib\
	-L/usr/lib/gcc/i486-linux-gnu/4.3.2/../../..\
	$(O2_lib_directories) o2_externs.o o2_defs.o common_externs.o o2.o\
	--whole-archive -lyacco2 --no-whole-archive  -start-group -lo2grammars  --end-group -lstdc++ -lm -lgcc_s -lgcc -lc -lgcc_s -lgcc\
	-lpthread /usr/lib/gcc/i486-linux-gnu/4.3.2/crtend.o\
	/usr/lib/gcc/i486-linux-gnu/4.3.2/../../../../lib/crtn.o

Move_rlse_o2:
	mv o2 $(O2_bin)
	rm *.o
Move_dbg_o2:
	mv o2 o2_dbg
	mv o2_dbg $(O2_bin)
	rm o2
	rm *.o