# File: makefile_GNU # 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 # Notice: Some possible construction to be done # 1) Adjust base_dir variable if the ``yacco2'' package is moved elsewhere. # For example, if u installed the ``yacco2'' package in /opt/yacco2 # Set the base_dir variable in this file to: base_dir = /opt/ # The trailing / must be there or ugly things will happen. # # 2) Make sure u know where the ``ranlib'' utility resides on your system # If it's already defined in your ``bash'' ``PATH'' varable then # just space out the below ``RANLIB'' variable # RANLIB = # or set it to point to its residence as what this file has done # # Example: gen the debug version of the library # cd /usr/local//yacco2/compiler/grammars # make Dbg -f GNU_makefile # CC := g++ 02_target_dir := ifeq ($(MAKECMDGOALS),Rlse) O2_target_dir := Release else O2_target_dir := Debug endif ### # Set up c++ compiler and ld linker options ### Rlse: Compile_opts := -c -o3 -pthread Dbg: Compile_opts := -g -c -pthread ### # Set up directories ### Base_o2 := $(O2) O2_bin := $(Base_o2)/bin O2_eternals := $(Base_o2)/externals O2_stbl := $(Base_o2)/compiler/stbl 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_cc)' -I'$(O2_lib)' -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_rlse_lib Move_rlse_lib: rm -f $(O2_cc_grms)/lib/$(O2_target_dir)/libo2grammars.a $(AR) rv $(O2_cc_grms)/lib/$(O2_target_dir)/libo2grammars.a $(Objects_to_compile) rm -f *.o Dbg: Compile Move_dbg_lib Move_dbg_lib: rm -f $(O2_cc_grms)/lib/$(O2_target_dir)/libo2grammars.a $(AR) rv $(O2_cc_grms)/lib/$(O2_target_dir)/libo2grammars.a $(Objects_to_compile) $(RANLIB) $(O2_cc_grms)/lib/$(O2_target_dir)/libo2grammars.a rm -f *.o Compile: $(Objects_to_compile) %.o: %.cpp $(CC) $(Compile_opts) $(O2_includes) $< -o $@ Genw: cweave $(O2_stbl)yacco2_stbl ctangle -l +e $(O2_stbl)yacco2_stbl pdftex yacco2_stbl mv yacco2_stbl.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