# File: makefile_APPLE # Why: Creates the library of grammars for o2 compiler /compiler: libo2grammars.a # or gens the symbol table code and its pdf document # Ks: make sure u run GNU make: gmake or make depending on your system # Library placement: # Rlse: /usr/local/yacco2/compiler/o2qammars/lib/Release # Dbg: /usr/local/yacco2/compiler/o2gammars/lib/Debug # Genw: for the pdf file: yacco2/docs # for the yacco2_stbl h and cpp files: yacco2/compiler/grammars # # How to run: U must choose the label to execute: Rlse, Dbg # Rlse --- gen the fast version of library with no debug support # Dbg --- gen the debug version of library # 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/compiler/grammars # make Dbg -f makefile_APPLE # O2 := /usr/local/yacco2 #CC := /opt/local/bin/c++-mp-4.9 #gnu c++ 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_bin := $(Base_o2)/bin O2_eternals := $(Base_o2)/externals O2_stbl := $(Base_o2)/compiler/stbl O2_cc := $(Base_o2)/compiler/o2 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_includes := -I'$(O2_cc_grms)' -I'$(O2_cc)' -I'$(O2_library)' -I'$(O2_lib_grms)' ### # Objects to compile ## Objects_to_compile:= $(patsubst %.cpp,%.o,$(wildcard *.cpp)) ### # Compile, link, and move O2 into bin account ### Rlse: Compile Move_lib Dbg: Compile Move_lib Move_lib: rm -f $(O2_cc_grms)/lib/$(O2_target_dir)/libo2grammars.a libtool -static -arch_only x86_64 -o $(O2_cc_grms)/lib/$(O2_target_dir)/libo2grammars.a $(Objects_to_compile) rm -f *.o Compile: $(Objects_to_compile) %.o: %.cpp $(CC) $(Compile_opts) $(O2_includes) $< -o $@ Genw: cweave $(O2_stbl)/yacco2_stbl pdftex yacco2_stbl pdftops yacco2_stbl.pdf mv yacco2_stbl.pdf $(O2_docs) mv yacco2_stbl.ps $(O2_docs) ctangle -l +e $(O2_stbl)/yacco2_stbl cweave Lrk pdftex Lrk mv Lrk.pdf $(O2_docs) rm yacco2_stbl.idx rm yacco2_stbl.scn rm yacco2_stbl.toc rm yacco2_stbl.tex rm yacco2_stbl.log rm yacco2_stbl.c