# 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