From d86a23834c4c5ad22e4c1e57b5a08419a930a682 Mon Sep 17 00:00:00 2001 From: jmpenn Date: Fri, 25 Oct 2019 13:21:39 -0500 Subject: [PATCH] Fix a race condition between ICG and mongoose install (#891) * Fix a race condition between ICG and mongoose install * Update mongoose to version 6.16 --- Makefile | 35 +++++++++++++++++--- trick_source/web/HttpServer/makefile | 48 +++------------------------- 2 files changed, 34 insertions(+), 49 deletions(-) diff --git a/Makefile b/Makefile index b6d8d3dc..fdd72048 100644 --- a/Makefile +++ b/Makefile @@ -183,8 +183,8 @@ $(ER7_UTILS_DIRS): icg_sim_serv # 1.1.1.4 Generate interface code (using ICG) for the specified sim_services # header files. .PHONY: icg_sim_serv -icg_sim_serv: $(ICG_EXE) - ${TRICK_HOME}/bin/trick-ICG -sim_services -m ${TRICK_CXXFLAGS} ${TRICK_SYSTEM_CXXFLAGS} ${TRICK_HOME}/include/trick/files_to_ICG.hh +icg_sim_serv: $(ICG_EXE) ${TRICK_HOME}/include/mongoose/mongoose.h + ${ICG_EXE} -sim_services -m ${TRICK_CXXFLAGS} ${TRICK_SYSTEM_CXXFLAGS} ${TRICK_HOME}/include/trick/files_to_ICG.hh # 1.1.1.4.1 Build the Interface Code Generator (ICG) executable. $(ICG_EXE) : @@ -211,9 +211,34 @@ dp: ${TRICK_HOME}/trick_source/trick_utils/units #------------------------------------------------------------------------------- # .PHONY: webserver -webserver: +webserver: ${TRICK_LIB_DIR}/libmongoose.a ${TRICK_HOME}/include/mongoose/mongoose.h @ $(MAKE) -C ${TRICK_HOME}/trick_source/web/HttpServer +#------------------------------------------------------------------------------- +TRICK_ICG_EXCLUDE += ${TRICK_HOME}/include/mongoose + +mongoose.h: + curl --retry 4 -O https://raw.githubusercontent.com/cesanta/mongoose/6.16/mongoose.h + +mongoose.c: + curl --retry 4 -O https://raw.githubusercontent.com/cesanta/mongoose/6.16/mongoose.c + +mongoose.o: mongoose.h mongoose.c + $(CC) $(TRICK_CFLAGS) -c -o mongoose.o mongoose.c + rm mongoose.c + +${TRICK_LIB_DIR}/libmongoose.a: mongoose.o ${TRICK_HOME}/include/mongoose/mongoose.h | $(TRICK_LIB_DIR) + ar crs $@ mongoose.o + rm mongoose.o + rm mongoose.h + @ echo ; echo "Mongoose library compiled:" ; date + +${TRICK_HOME}/include/mongoose/mongoose.h: mongoose.h | ${TRICK_HOME}/include/mongoose + @ cp mongoose.h $@ + +${TRICK_HOME}/include/mongoose: + @ mkdir $@ + #------------------------------------------------------------------------------- # 1.3 Build Trick's Java Tools java: @@ -392,8 +417,8 @@ uninstall: ################################################################################ # ICG all sim_services files (for testing and debugging ICG). # The -f flag forces io_src files to be regenerated whether or not they need to be. -ICG: $(ICG_EXE) - ${TRICK_HOME}/bin/trick-ICG -f -s -m -n ${TRICK_CXXFLAGS} ${TRICK_SYSTEM_CXXFLAGS} ${TRICK_HOME}/include/trick/files_to_ICG.hh +ICG: $(ICG_EXE) ${TRICK_HOME}/include/mongoose/mongoose.h + $(ICG_EXE) -f -s -m -n ${TRICK_CXXFLAGS} ${TRICK_SYSTEM_CXXFLAGS} ${TRICK_HOME}/include/trick/files_to_ICG.hh # This builds a tricklib share library. trick_lib: $(SIM_SERV_DIRS) $(UTILS_DIRS) | $(TRICK_LIB_DIR) diff --git a/trick_source/web/HttpServer/makefile b/trick_source/web/HttpServer/makefile index 7a02298e..b5976e0a 100644 --- a/trick_source/web/HttpServer/makefile +++ b/trick_source/web/HttpServer/makefile @@ -19,9 +19,6 @@ INCDIR = include #TRICK_LIB_DIR comes from Makefile.common -MONGOOSE_OBJS = ${OBJDIR}/mongoose.o -MONGOOSE_INCDIR = ${TRICK_HOME}/include/mongoose - TRICK_HTTP_OBJS = \ ${OBJDIR}/VariableServerSession.o \ ${OBJDIR}/VariableServerVariable.o \ @@ -33,56 +30,19 @@ TRICK_HTTP_OBJS = \ ## MODEL TARGETS ## ############################################################################# -all: build_libs +all: ${TRICK_LIB_DIR}/libtrickHTTP.a -build_libs: ${TRICK_LIB_DIR}/libmongoose.a ${TRICK_LIB_DIR}/libtrickHTTP.a - -${TRICK_LIB_DIR}/libmongoose.a: ${LIBDIR}/libmongoose.a ${MONGOOSE_INCDIR}/mongoose.h - $(MV) ${LIBDIR}/libmongoose.a ${TRICK_LIB_DIR} - -${TRICK_LIB_DIR}/libtrickHTTP.a: ${LIBDIR}/libtrickHTTP.a - $(MV) ${LIBDIR}/libtrickHTTP.a ${TRICK_LIB_DIR} - -${MONGOOSE_INCDIR}/mongoose.h: mongoose.h | ${MONGOOSE_INCDIR} - $(CP) mongoose.h ${MONGOOSE_INCDIR}/mongoose.h - -${MONGOOSE_INCDIR}: - $(MKDIR) -p ${MONGOOSE_INCDIR} - -# Build Mongoose Library -mongoose.h: - $(CURL) --retry 4 -O https://raw.githubusercontent.com/cesanta/mongoose/master/mongoose.h - -mongoose.c: - $(CURL) --retry 4 -O https://raw.githubusercontent.com/cesanta/mongoose/master/mongoose.c - -${MONGOOSE_OBJS}: mongoose.h mongoose.c | $(OBJDIR) - $(CC) $(CFLAGS) -c -o ${MONGOOSE_OBJS} mongoose.c - -${LIBDIR}/libmongoose.a: ${MONGOOSE_OBJS} | ${LIBDIR} - ar crs $@ ${MONGOOSE_OBJS} - - -# Build Trick HTTP Server Library -$(TRICK_HTTP_OBJS): $(OBJDIR)/%.o : src/%.cpp ${MONGOOSE_INCDIR}/mongoose.h | $(OBJDIR) +$(TRICK_HTTP_OBJS): $(OBJDIR)/%.o : src/%.cpp | $(OBJDIR) $(CPP) $(CPPFLAGS) ${INCLUDE_DIRS} -c $< -o $@ -${LIBDIR}/libtrickHTTP.a: ${TRICK_HTTP_OBJS} | ${LIBDIR} +${TRICK_LIB_DIR}/libtrickHTTP.a: ${TRICK_HTTP_OBJS} ar crs $@ ${TRICK_HTTP_OBJS} -# --------------------------------- +# --------------------------------------------------------------------------- ${OBJDIR}: mkdir -p ${OBJDIR} -${LIBDIR}: - mkdir -p ${LIBDIR} - clean: ${RM} *~ ${RM} ${OBJDIR} - -spotless: clean - ${RM} ${LIBDIR} - ${RM} mongoose.h mongoose.c -