summaryrefslogtreecommitdiff
path: root/web/yacco2/library/makefile_APPLE
blob: 94232bfea2e9b8cc7a14a0a576c674193217fd85 (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
# File: makefile_APPLE
# Why:  Creates the library of yacco2: libyacco2.a
#       or gens the code and pdf document
# Library placement: 
#   Rlse:   /usr/local/yacco2/library/lib/Release
#   Dbg:    /usr/local/yacco2/library/lib/Debug
# `*.cpp' gen and pdf placement:
#   Genw:   for the pdf file: yacco2/docs
#           for the *.cpp files: yacco2/library
#
# How to run: U must choose the label to execute: Rlse, Dbg, Genw
#   Rlse --- gen the fast version of library: libyacco2.a
#   Dbg --- gen the debug version of library: libyacco2.a
#   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
#  cd /usr/local//yacco2/library
#  make Dbg -f makefile_APPLE
#
O2 := /usr/local/yacco2
#CC := /opt/local/bin/c++-mp-4.9
CC := clang++ #g++
02_target_dir :=
ifeq ($(MAKECMDGOALS),Rlse)
O2_target_dir := Release
Compile_opts :=  -c -pthread -arch x86_64
else
O2_target_dir := Debug
Compile_opts := -g -c -pthread -arch x86_64
endif

###
# Set up directories
###
Base_o2     := $(O2)
O2_docs     := $(Base_o2)/docs
O2_library  := $(Base_o2)/library
O2_library_lib  := $(O2_library)/lib
O2_lib_grms := $(O2_library)/grammars
O2_includes := -I'$(O2_library)' -I'$(O2_lib_grms)'
	
###
#   Objects to compile
##
Objects_to_compile:= $(patsubst %.cpp,%.o,$(wildcard *.cpp))
Objects_for_lib:= wrc.o wtok_can.o wtree.o wthread.o wset.o yacco2.o
Objects_for_lib+= yacco2_characters.o yacco2_k_symbols.o

###
#    Compile, link, and move yacco2 library 
###
Rlse: Compile Move_lib
Dbg: Compile Move_lib

Move_lib:
	rm -f $(O2_library_lib)/$(O2_target_dir)/libyacco2.a
	libtool -static -arch_only x86_64 -o $(O2_library_lib)/$(O2_target_dir)/libyacco2.a $(Objects_for_lib)
	rm -f  $(Objects_for_lib)

Compile: 
	$(CC) $(Compile_opts) $(O2_includes) wrc.cpp -o wrc.o
	$(CC) $(Compile_opts) $(O2_includes) wtok_can.cpp -o wtok_can.o
	$(CC) $(Compile_opts) $(O2_includes) wtree.cpp -o wtree.o
	$(CC) $(Compile_opts) $(O2_includes) wthread.cpp -o wthread.o
	$(CC) $(Compile_opts) $(O2_includes) wset.cpp -o wset.o
	$(CC) $(Compile_opts) $(O2_includes) yacco2.cpp -o yacco2.o
	$(CC) $(Compile_opts) $(O2_includes) $(O2_lib_grms)/yacco2_characters.cpp -o yacco2_characters.o
	$(CC) $(Compile_opts) $(O2_includes) $(O2_lib_grms)/yacco2_k_symbols.cpp -o yacco2_k_symbols.o
Genw:
	cweave wlibrary
	pdftex wlibrary
	ctangle -l +e wlibrary
	sh Makefile_Edit_cweb
	mv wlibrary.pdf $(O2_docs)
	rm wlibrary.idx
	rm wlibrary.scn
	rm wlibrary.toc
	rm wlibrary.tex
	rm wlibrary.log
	rm wlibrary.c