Rev 2 of Thrift, the Pillar successor

Summary: End-to-end communications and serialization in C++ is working

Reviewed By: aditya

Test Plan: See the new top-level test/ folder. It vaguely resembles a unit test, though it could be more automated.

Revert Plan: Revertible

Notes: Still a LOT of optimization work to be done on the generated C++ code, which should be using dynamic memory in a number of places. Next major task is writing the PHP/Java/Python generators.




git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@664712 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/compiler/Makefile b/compiler/Makefile
index 8fa9e60..62ce275 100644
--- a/compiler/Makefile
+++ b/compiler/Makefile
@@ -43,14 +43,17 @@
             lex.yy.cc
 
 # Object files
-OBJ_FILES = thrift.tab.o \
-            lex.yy.o \
-            ${SRC_FILES:.cc=.o}
+OBJ_FILES = ${SRC_FILES:.cc=.o}
+
+# Generated object files
+GOB_FILES = thrift.tab.o \
+            lex.yy.o
 
 # Apply directory prefixes
 SRCS = ${addprefix $(SRC_DIR), $(SRC_FILES)}
 GENS = ${addprefix $(GEN_DIR), $(GEN_FILES)}
 OBJS = ${addprefix $(OBJ_DIR), $(OBJ_FILES)}
+GOBS = ${addprefix $(OBJ_DIR), $(GOB_FILES)}
 
 # Compile with strict warnings
 CFL = -g -Wall -I$(SRC_DIR) -I$(OBJ_DIR)
@@ -60,7 +63,7 @@
 
 # Scanner generation
 $(GEN_DIR)lex.yy.cc: $(SRC_DIR)thrift.l
-	$(LEX) -o$(GEN_DIR)lex.yy.cc $(SRC_DIR)thrift.l
+	$(LEX) -o$@ $(SRC_DIR)thrift.l
 
 # Parser generation
 $(GEN_DIR)thrift.tab.hh: $(GEN_DIR)thrift.tab.cc
@@ -69,68 +72,36 @@
 	$(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
+$(OBJ_DIR)lex.yy.o: $(GEN_DIR)lex.yy.cc
+	$(CC) $(CFL) -c -o $@ $(GEN_DIR)lex.yy.cc
+
+# C++ compilation
+$(OBJ_DIR)thrift.tab.o: $(GEN_DIR)thrift.tab.cc
+	$(CC) $(CFL) -c -o $@ $(GEN_DIR)thrift.tab.cc
+
+# C++ compilation
+$(OBJS): $(SRCS)
 	$(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)
+thrift:	$(OBJS)	$(GOBS)
+	$(LD) $(CFL) -o $(BIN_DIR)thrift $(OBJS) $(GOBS) $(LIBS)
 
 # Build directory
-obj_dir:	
+obj_dirs:	
 	$(MKDIR) -p $(OBJ_DIR)parse
 	$(MKDIR) -p $(OBJ_DIR)generate
 
-# This will auto-make dependency rules
-depend:
-	makedepend -- $(CFL) -- $(SRCS)
+# Install it
+install: thrift
+	sudo install bin/thrift /usr/local/bin/thrift
 
 # Remove auto-gen'd files and binaries
 clean:
 	rm -f \
 	$(OBJS) \
+	$(GOBS) \
 	$(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