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
This commit is contained in:
jmpenn 2019-10-25 13:21:39 -05:00 committed by GitHub
parent 95c6659733
commit d86a23834c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 34 additions and 49 deletions

View File

@ -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)

View File

@ -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