|  | # Makefile for Thrift compiler. This Makefile assumes that you are running on | 
|  | # some form of *NIX operating system with the following tools and packages | 
|  | # installed: | 
|  | # | 
|  | #   g++ | 
|  | #   flex | 
|  | #   bison | 
|  | #   libfl | 
|  | # | 
|  | # Author: | 
|  | #   Mark Slee <mcslee@facebook.com> | 
|  |  | 
|  | # Default build rule | 
|  | target:	thrift | 
|  |  | 
|  | # Tools | 
|  | CC    = g++ | 
|  | LD    = g++ | 
|  | LEX   = flex | 
|  | YACC  = bison | 
|  | MKDIR = mkdir | 
|  |  | 
|  | # Source directory | 
|  | SRC_DIR = src/ | 
|  |  | 
|  | # Object file directory | 
|  | OBJ_DIR = obj/ | 
|  |  | 
|  | # Generated source dir | 
|  | GEN_DIR = $(SRC_DIR) | 
|  |  | 
|  | # Output directory | 
|  | BIN_DIR = bin/ | 
|  |  | 
|  | # Source files | 
|  | SRC_FILES = main.cc \ | 
|  | generate/t_generator.cc \ | 
|  | generate/t_cpp_generator.cc | 
|  |  | 
|  | # Autogenerated files | 
|  | GEN_FILES = thrift.tab.hh \ | 
|  | thrift.tab.cc \ | 
|  | lex.yy.cc | 
|  |  | 
|  | # Object files | 
|  | OBJ_FILES = thrift.tab.o \ | 
|  | lex.yy.o \ | 
|  | ${SRC_FILES:.cc=.o} | 
|  |  | 
|  | # Apply directory prefixes | 
|  | SRCS = ${addprefix $(SRC_DIR), $(SRC_FILES)} | 
|  | GENS = ${addprefix $(GEN_DIR), $(GEN_FILES)} | 
|  | OBJS = ${addprefix $(OBJ_DIR), $(OBJ_FILES)} | 
|  |  | 
|  | # Compile with strict warnings | 
|  | CFL = -g -Wall -I$(SRC_DIR) -I$(OBJ_DIR) | 
|  |  | 
|  | # Flex library | 
|  | LIBS = -lfl | 
|  |  | 
|  | # Scanner generation | 
|  | $(GEN_DIR)lex.yy.cc: $(SRC_DIR)thrift.l | 
|  | $(LEX) -o$(GEN_DIR)lex.yy.cc $(SRC_DIR)thrift.l | 
|  |  | 
|  | # Parser generation | 
|  | $(GEN_DIR)thrift.tab.hh: $(GEN_DIR)thrift.tab.cc | 
|  |  | 
|  | $(GEN_DIR)thrift.tab.cc: $(SRC_DIR)thrift.y | 
|  | $(YACC) -d -o$(GEN_DIR)thrift.tab.cc $(SRC_DIR)thrift.y | 
|  |  | 
|  | # C++ compilation | 
|  | $(OBJS): $(GEN_DIR)thrift.tab.cc $(GEN_DIR)lex.yy.cc obj_dir | 
|  | $(CC) $(CFL) -c -o $@ ${subst $(OBJ_DIR),$(SRC_DIR),$*.cc} | 
|  |  | 
|  | # Header dependency | 
|  | $(SRC_DIR)main.cc: $(SRC_DIR)*.h | 
|  |  | 
|  | # Main build rule | 
|  | thrift:	$(OBJS) | 
|  | $(LD) $(CFL) -o $(BIN_DIR)thrift $(OBJS) $(LIBS) | 
|  |  | 
|  | # Build directory | 
|  | obj_dir: | 
|  | $(MKDIR) -p $(OBJ_DIR)parse | 
|  | $(MKDIR) -p $(OBJ_DIR)generate | 
|  |  | 
|  | # This will auto-make dependency rules | 
|  | depend: | 
|  | makedepend -- $(CFL) -- $(SRCS) | 
|  |  | 
|  | # Remove auto-gen'd files and binaries | 
|  | clean: | 
|  | rm -f \ | 
|  | $(OBJS) \ | 
|  | $(GENS) \ | 
|  | $(BIN_DIR)thrift.exe \ | 
|  | $(BIN_DIR)thrift | 
|  | # DO NOT DELETE | 
|  |  | 
|  | src/main.o: /usr/include/stdlib.h /usr/include/features.h | 
|  | src/main.o: /usr/include/sys/cdefs.h /usr/include/gnu/stubs.h | 
|  | src/main.o: /usr/include/bits/wordsize.h /usr/include/gnu/stubs-64.h | 
|  | src/main.o: /usr/include/stdio.h /usr/include/bits/types.h | 
|  | src/main.o: /usr/include/bits/typesizes.h /usr/include/libio.h | 
|  | src/main.o: /usr/include/_G_config.h /usr/include/wchar.h | 
|  | src/main.o: /usr/include/bits/wchar.h /usr/include/gconv.h | 
|  | src/main.o: /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h | 
|  | src/main.o: src/globals.h src/main.h src/parse/t_program.h | 
|  | src/main.o: src/parse/t_base_type.h src/parse/t_type.h src/parse/t_typedef.h | 
|  | src/main.o: src/parse/t_enum.h src/parse/t_constant.h src/parse/t_struct.h | 
|  | src/main.o: src/parse/t_list.h src/parse/t_field.h src/parse/t_service.h | 
|  | src/main.o: src/parse/t_function.h src/generate/t_cpp_generator.h | 
|  | src/main.o: src/generate/t_generator.h | 
|  | src/generate/t_generator.o: src/generate/t_generator.h src/parse/t_program.h | 
|  | src/generate/t_generator.o: src/parse/t_base_type.h src/parse/t_type.h | 
|  | src/generate/t_generator.o: src/parse/t_typedef.h src/parse/t_enum.h | 
|  | src/generate/t_generator.o: src/parse/t_constant.h src/parse/t_struct.h | 
|  | src/generate/t_generator.o: src/parse/t_list.h src/parse/t_field.h | 
|  | src/generate/t_generator.o: src/parse/t_service.h src/parse/t_function.h | 
|  | src/generate/t_cpp_generator.o: /usr/include/sys/stat.h | 
|  | src/generate/t_cpp_generator.o: /usr/include/features.h | 
|  | src/generate/t_cpp_generator.o: /usr/include/sys/cdefs.h | 
|  | src/generate/t_cpp_generator.o: /usr/include/gnu/stubs.h | 
|  | src/generate/t_cpp_generator.o: /usr/include/bits/wordsize.h | 
|  | src/generate/t_cpp_generator.o: /usr/include/gnu/stubs-64.h | 
|  | src/generate/t_cpp_generator.o: /usr/include/bits/types.h | 
|  | src/generate/t_cpp_generator.o: /usr/include/bits/typesizes.h | 
|  | src/generate/t_cpp_generator.o: /usr/include/bits/stat.h | 
|  | src/generate/t_cpp_generator.o: src/generate/t_cpp_generator.h | 
|  | src/generate/t_cpp_generator.o: src/generate/t_generator.h | 
|  | src/generate/t_cpp_generator.o: src/parse/t_program.h src/parse/t_base_type.h | 
|  | src/generate/t_cpp_generator.o: src/parse/t_type.h src/parse/t_typedef.h | 
|  | src/generate/t_cpp_generator.o: src/parse/t_enum.h src/parse/t_constant.h | 
|  | src/generate/t_cpp_generator.o: src/parse/t_struct.h src/parse/t_list.h | 
|  | src/generate/t_cpp_generator.o: src/parse/t_field.h src/parse/t_service.h | 
|  | src/generate/t_cpp_generator.o: src/parse/t_function.h src/globals.h |