Merge pull request #533 from nasa/MakefileCleanup

Trick makefile output formatting and cleanup.
This commit is contained in:
Alex Lin 2018-03-01 08:54:13 -06:00 committed by GitHub
commit 269ed77cb4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
16 changed files with 82 additions and 67 deletions

View File

@ -134,13 +134,22 @@ endif
# libraries.
ICG_EXE := ${TRICK_HOME}/bin/trick-ICG
################################################################################
# Formating Variables
################################################################################
# Appends a newline to the -w / --print-directories leaving message for make.
# This helps break up directory traversal into blocks.
MAKE_TRAVERSAL_NEWLINE := | sed '/^make.*: Leaving directory/a\ '
################################################################################
# RULES
################################################################################
# DEFAULT TARGET
# 1 Build Trick-core and Trick Data-products.
all: no_dp dp
@ echo ; echo "Trick compilation complete:" ; date
@ echo -e "\e[32mTrick has been successfully compiled.\e[34m"
@date
ifeq ($(USE_JAVA), 1)
all: java
@ -149,10 +158,11 @@ endif
#-------------------------------------------------------------------------------
# 1.1 Build Trick-core
no_dp: $(TRICK_LIB) $(TRICK_SWIG_LIB)
@ echo ; echo "Trick libs compiled:" ; date
@ echo -e "\e[32mTrick libraries compiled:\e[34m" ; date ; echo -e "\e[0m"
# 1.1.1 Build libTrick.a
$(TRICK_LIB): $(SIM_SERV_DIRS) $(UTILS_DIRS) | $(TRICK_LIB_DIR)
@ echo -e "\e[34m[---Building $@---]\e[0m"
ar crs $@ $(SIM_SERV_OBJS) $(UTILS_OBJS)
ifeq ($(USE_ER7_UTILS), 1)
@ -160,23 +170,27 @@ ER7_UTILS_LIB = $(TRICK_LIB_DIR)/liber7_utils.a
no_dp: $(ER7_UTILS_LIB)
$(ER7_UTILS_LIB): $(ER7_UTILS_DIRS) | $(TRICK_LIB_DIR)
@ echo -e "\e[34m[---Building $@---]\e[0m"
ar crs $@ $(ER7_UTILS_OBJS)
endif
# 1.1.1.1 Compile the objects in the specified sim_services directories.
.PHONY: $(SIM_SERV_DIRS)
$(SIM_SERV_DIRS): icg_sim_serv $(TRICK_LIB_DIR)
@ echo -e "\e[34m[---Building $@---]\e[0m"
@ $(MAKE) -C $@ trick
# 1.1.1.2 Compile the objects in the specified utils directories.
.PHONY: $(UTILS_DIRS)
$(UTILS_DIRS): icg_sim_serv
@ echo -e "\e[34m[---Building $@---]\e[0m"
@ $(MAKE) -C $@ trick
# 1.1.1.3 Compile the objects in the specified er7_utils directories.
.PHONY: $(ER7_UTILS_DIRS)
$(ER7_UTILS_DIRS): TRICK_CXXFLAGS += -Wno-unused-parameter
$(ER7_UTILS_DIRS): make_er7_makefiles icg_sim_serv
@ echo -e "\e[34m[---Building $@---]\e[0m"
@ $(MAKE) -C $@ trick
.PHONY: make_er7_makefiles
@ -193,10 +207,12 @@ endif
# header files.
.PHONY: icg_sim_serv
icg_sim_serv: $(ICG_EXE)
@ echo -e "\e[34m[---Generating Interface Code---]\e[0m"
${TRICK_HOME}/bin/trick-ICG -s -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) :
@ echo -e "\e[34m[---Building Interface Code Generator---]\e[0m"
$(MAKE) -C trick_source/codegen/Interface_Code_Gen
# 1.1.1.5 Create Trick Library directory.
@ -205,21 +221,25 @@ $(TRICK_LIB_DIR):
# 1.1.2 Build libTrick_pyip.a (Swig Lib)
$(TRICK_SWIG_LIB): $(SWIG_DIRS) | $(TRICK_LIB_DIR)
@ echo -e "\e[34m[---Building $@---]\e[0m"
ar crs $@ $(SWIG_OBJS)
.PHONY: $(SWIG_DIRS)
$(SWIG_DIRS): icg_sim_serv $(TRICK_LIB_DIR)
@ echo -e "\e[34m[---Building $@---]\e[0m"
@ $(MAKE) -C $@ trick
#-------------------------------------------------------------------------------
# 1.2 Build Trick's Data-products Applications.
.PHONY: dp
dp: ${TRICK_HOME}/trick_source/trick_utils/units
@ echo -e "\e[34m[---Building Data-Products Applications---]\e[0m"
@ $(MAKE) -C ${TRICK_HOME}/trick_source/data_products
#-------------------------------------------------------------------------------
# 1.3 Build Trick's Java Tools
java:
@ echo -e "\e[34m[---Building Java Tools---]\e[0m"
@ $(MAKE) -C ${TRICK_HOME}/trick_source/java
.PHONY: javadoc
@ -250,7 +270,9 @@ premade:
################################################################################
# This target runs Trick's Unit-tests and simulation-tests.
test: unit_test sim_test
@ echo "All tests completed sucessfully"
@ echo -e "\n\e[32m#####################################"
@ echo -e "\e[32mAll unit tests completed sucessfully.\e[0m"
@ echo -e "\e[32m#####################################\n"
.PHONY: $(UNIT_TEST_DIRS)
$(UNIT_TEST_DIRS):
@ -269,35 +291,37 @@ sim_test:
# CLEAN Targets
################################################################################
clean: clean_sim_serv clean_utils clean_swig clean_dp clean_ICG clean_java
@/bin/rm -rf $(TRICK_BIN_DIR)
@/bin/rm -rf $(TRICK_LIB_DIR)
@echo -e "\e[32mTrick has been successfully cleaned."
ifeq ($(USE_ER7_UTILS), 1)
clean: clean_er7_utils
endif
clean_sim_serv:
@for i in $(SIM_SERV_DIRS) ; do \
$(MAKE) -C $$i real_clean ; \
$(MAKE) -C $$i real_clean $(MAKE_TRAVERSAL_NEWLINE); \
done
@ $(MAKE) -C ${TRICK_HOME}/trick_source/sim_services/mains real_clean
@ $(MAKE) -C ${TRICK_HOME}/trick_source/sim_services/mains real_clean $(MAKE_TRAVERSAL_NEWLINE)
clean_er7_utils: make_er7_makefiles
@for i in $(ER7_UTILS_DIRS) ; do \
$(MAKE) -C $$i real_clean ; \
$(MAKE) -C $$i real_clean $ $(MAKE_TRAVERSAL_NEWLINE); \
rm $$i/Makefile; \
done
clean_utils:
@for i in $(UTILS_DIRS) ; do \
$(MAKE) -C $$i real_clean ; \
$(MAKE) -C $$i real_clean $(MAKE_TRAVERSAL_NEWLINE); \
done
clean_swig:
@for i in $(SWIG_DIRS) ; do \
$(MAKE) -C $$i real_clean ; \
$(MAKE) -C $$i real_clean $(MAKE_TRAVERSAL_NEWLINE); \
done
ifeq ($(USE_ER7_UTILS), 1)
@ -305,7 +329,7 @@ clean_swig: make_er7_makefiles
endif
clean_ICG :
$(MAKE) -C ${TRICK_HOME}/trick_source/codegen/Interface_Code_Gen clean
@ $(MAKE) -C ${TRICK_HOME}/trick_source/codegen/Interface_Code_Gen clean $(MAKE_TRAVERSAL_NEWLINE)
clean_unit_test:
@/bin/rm -rf ${TRICK_HOME}/trick_test/*.xml
@ -314,14 +338,13 @@ clean_unit_test:
done
clean_doxygen:
@ $(MAKE) -C ${TRICK_HOME}/doxygen clean
@ $(MAKE) -C ${TRICK_HOME}/doxygen clean $(MAKE_TRAVERSAL_NEWLINE)
clean_dp:
@ $(MAKE) clean -C ${TRICK_HOME}/trick_source/data_products
@ $(MAKE) clean -C ${TRICK_HOME}/trick_source/data_products $(MAKE_TRAVERSAL_NEWLINE)
clean_java:
@ $(MAKE) -C ${TRICK_HOME}/trick_source/java clean
@ $(MAKE) -C ${TRICK_HOME}/trick_source/java clean $(MAKE_TRAVERSAL_NEWLINE)
# FIXME: Seems to me that the for loop below should be removed and that the

View File

@ -160,10 +160,7 @@ $(L_OBJS) : $(OBJ_DIR)/%.lex.o : $(SRC_DIR)%.lex.c $(SRC_DIR)%.tab.h | $(OBJ_DI
$(Y_OBJS) : $(OBJ_DIR)/%.tab.o : $(SRC_DIR)%.tab.c | $(OBJ_DIR)
$(CD_CMD) $(TRICK_CPPC) $(TRICK_CXXFLAGS) $(TRICK_SYSTEM_CXXFLAGS) -c ${<F} -o $(UP_DIR)$@
#
# OTHER RULES
#
depend:
@ $(TRICK_CPPC) -MM $(TRICK_CXXFLAGS) $(TRICK_SYSTEM_CXXFLAGS) $(C_SRC) $(CPP_SRC) >> $(DEPTEMPFILE)
@ -174,15 +171,15 @@ depend:
io_clean:
$(RM) -rf io_src
real_clean: clean io_clean
$(RM) -rf xml *~ *.bak core
@ echo "Directory is really clean!"
clean:
$(RM) -rf $(OBJ_DIR) $(L_C) $(Y_C) $(Y_H)
real_clean: clean io_clean
$(RM) -rf xml *~ *.bak core
help :
@ echo -e "\n\
Source Directory Make Options:\n\
make - Compiles are source files\n\
\n\
@ -194,4 +191,3 @@ Source Directory Make Options:\n\
\n\
make real_clean - Deletes xml/, io_src/,\n\
and object_${TRICK_HOST_CPU}/ directories\n"

View File

@ -55,7 +55,6 @@ OBJECT_FILES = $(C_OBJECT_FILES) $(CXX_OBJECT_FILES)
all: ${TRICK_HOME}/bin/trick-gxplot
${TRICK_HOME}/bin/trick-gxplot: ${LIBDIR}/libDPM.a ${LIBDIR}/libDPC.a ${LIBDIR}/libDPV.a $(OBJECT_FILES)
@echo "===== Making gxplot ====="
${CPP} ${CFLAGS} ${INCDIRS} -o $@ $(OBJECT_FILES) $(ALL_LIBS) ${XLIBS} ${LIBRTDEF} ${CONTROLLER_LIBS} -lDPV
$(C_OBJECT_FILES) : $(OBJDIR)/%.o : %.c

View File

@ -10,15 +10,15 @@ apps: fxplot
endif
fxplot:
$(MAKE) -C FXPLOT
@$(MAKE) -C FXPLOT
gxflot:
$(MAKE) -C GXPLOT
@$(MAKE) -C GXPLOT
clean:
$(MAKE) -C FXPLOT clean
$(MAKE) -C GXPLOT clean
@$(MAKE) -C FXPLOT clean
@$(MAKE) -C GXPLOT clean
spotless: clean
$(MAKE) -C FXPLOT spotless
$(MAKE) -C GXPLOT spotless
@$(MAKE) -C FXPLOT spotless
@$(MAKE) -C GXPLOT spotless

View File

@ -57,4 +57,3 @@ clean:
spotless: clean
${RM} ${LIBDIR}/${LIBNAME}

View File

@ -142,7 +142,6 @@ depend:
@ echo "Appended dependencies to $(MAKEFILE)"
clean:
@echo "===== Cleaning DPC_TEST Directory ====="
${RM} *~
${RM} *.o

View File

@ -131,7 +131,6 @@ clean:
spotless: clean
${RM} tcdstest
# Dependencies
#######################################################################

View File

@ -131,7 +131,6 @@ clean:
spotless: clean
${RM} udstest
# Dependencies
#######################################################################

View File

@ -25,9 +25,9 @@ clean:
$(MAKE) -C UDS clean
spotless:
$(MAKE) -C DPC_TEST spotless
$(MAKE) -C DPM_TEST spotless
$(MAKE) -C DS_exercisor spotless
$(MAKE) -C DS spotless
$(MAKE) -C TCDS spotless
$(MAKE) -C UDS spotless
@ $(MAKE) -C DPC_TEST spotless
@ $(MAKE) -C DPM_TEST spotless
@ $(MAKE) -C DS_exercisor spotless
@ $(MAKE) -C DS spotless
@ $(MAKE) -C TCDS spotless
@ $(MAKE) -C UDS spotless

View File

@ -23,21 +23,23 @@ all: $(LIBDIRS) $(APPDIRS)
always_make:
docs: always_make
@echo "===== Making DOCS ====="
@ echo -e "\e[34m[---Making Documentation---]\e[0m"
doxygen DPX.doxygen
testing: $(LIBDIRS)
@echo "===== Making TESTING ====="
@ echo -e "\e[34m[---Building TESTING---]\e[0m"
$(MAKE) -C TESTING
@ echo ""
$(LIBDIRS):
@ echo ; echo "==: Compile $@"
@ echo -e "\e[34m[---Building $@---]\e[0m"
@ $(MAKE) -C $@
@ echo ""
$(APPDIRS): $(LIBDIRS)
@echo "===== Making APPS ====="
@ echo ; echo "==: Compile $@"
@ echo -e "\e[34m[---Building $@---]\e[0m"
@ $(MAKE) -C $@
@ echo ""
clean:
@ for i in $(LIBDIRS) ; do \
@ -46,11 +48,12 @@ clean:
@ for i in $(APPDIRS) ; do \
$(MAKE) -C $$i clean ; \
done
${RM} -rf DOCS
@ $(MAKE) -C TESTING spotless
@ $(MAKE) -C APPS spotless
${RM} DOCS
${RM} ${LIBDIR}
$(MAKE) -C TESTING spotless
$(MAKE) -C APPS spotless
$(MAKE) -C XML clean
${RM} *~
${RM} *.o

View File

@ -23,17 +23,19 @@ APPDIRS = DPX \
Apps/ExternalPrograms
all: $(LIBDIRS) $(APPDIRS)
@ echo "== Trick data_products make complete =="
@ echo -e "\e[32mTrick data-products compiled:\e[34m" ; date ; echo -e "\e[0m"
.PHONY: $(LIBDIRS) $(APPDIRS)
$(LIBDIRS):
@ echo ; echo "==: Compile data_products/$@"
@ echo -e "\e[34m[---Building $@---]\e[0m"
@ $(MAKE) -C $@
@ echo ""
$(APPDIRS): $(LIBDIRS)
@ echo ; echo "==: Compile data_products/$@"
@ echo -e "\e[34m[---Building $@---]\e[0m"
@ $(MAKE) -C $@
@ echo ""
real_clean: clean
@ -41,8 +43,9 @@ clean:
@ for i in $(LIBDIRS) ; do \
$(MAKE) -C $$i real_clean ; \
done
@ for i in $(APPDIRS) ; do \
$(MAKE) -C $$i real_clean ; \
done
@ rm -rf $(LIB_DIR)
@ rm -rf $(LIB_DIR)

View File

@ -24,13 +24,12 @@ RESOURCES = $(subst src/,,$(shell find src/trick -name resources))
RESOURCES += $(subst src/,,$(shell find src/trick -name jaxb.index))
all: ${DIST_DIR}/trick.jar resources
@echo "Java build successful"
@ echo -e "\n\e[32mTrick GUIs compiled:\e[34m" ; date ; echo -e "\e[0m"
${DEST_DIR} ${DIST_DIR} ${RESOURCES_DIR} ${DOCS_API_DIR}:
mkdir -p $@
${DIST_DIR}/trick.jar: compile ${DIST_DIR}
@echo "Creating jar file..."
@jar cf ${DIST_DIR}/trick.jar -C ${DEST_DIR} .
@cd ${SRC_DIR} && jar uf ${DIST_DIR}/trick.jar ${RESOURCES}
@ -38,7 +37,6 @@ external_jars:
@ $(MAKE) -C $(LIB_DIR)
compile: ${DEST_DIR} external_jars
@echo "Building Trick GUIs..."
@${JAVAC} ${JAVAC_FLAGS} -classpath ${CLASS_PATH} -d ${DEST_DIR} -sourcepath ${SRC_DIR} ${SRC_FILES}
resources: ${RESOURCES_DIR}/trick_icon.png

View File

@ -86,12 +86,9 @@ real_clean: clean
clean: clean_python
$(RM) -rf $(OBJ_DIR) $(TEST_DIR) $(PY_FILES)
clean_python:
rm -rf swig_${TRICK_HOST_CPU} sim_services.py swig_double.py swig_int.py swig_ref.py
real_clean: clean
# some depends
swig_int_wrap.cpp: swig_int.cpp
swig_double_wrap.cpp: swig_double.cpp