From 2eeb311a705ce3b2bebb0cf5c50b320fa310a514 Mon Sep 17 00:00:00 2001 From: Alex Lin Date: Thu, 11 Jun 2015 14:40:14 -0500 Subject: [PATCH] Standardize directory names Moved the no_arch swig files to share/trick/swig and adjusted the makefiles to look for the files in the new location. Changed the install rule to only copy the files we need for our installation. refs #63 --- Makefile | 159 ++++-------------- libexec/trick/pm/make_swig_makefile.pm | 14 +- share/trick/makefiles/Makefile.common | 7 - share/trick/makefiles/config_Darwin.mk | 2 + share/trick/makefiles/config_Linux.mk | 9 + share/trick/makefiles/config_user.mk.in | 2 +- .../trick/swig}/exception.py | 0 .../trick/swig}/shortcuts.py | 0 .../trick/swig}/unit_test.py | 0 trick_source/trick_swig/Makefile | 12 +- 10 files changed, 59 insertions(+), 146 deletions(-) rename {trick_source/trick_swig => share/trick/swig}/exception.py (100%) rename {trick_source/trick_swig => share/trick/swig}/shortcuts.py (100%) rename {trick_source/trick_swig => share/trick/swig}/unit_test.py (100%) diff --git a/Makefile b/Makefile index e2b5f88b..8dd28b8e 100644 --- a/Makefile +++ b/Makefile @@ -354,140 +354,43 @@ clean_gui: clean_java # INSTALL Targets ################################################################################ -install: copy_files - -.PHONY: copy_files -copy_files: ${PREFIX}/trick/trick-$(TRICK_VERSION) copy_trick_source - cp -r ${TRICK_HOME}/bin ${PREFIX}/trick/trick-$(TRICK_VERSION) - cp ${TRICK_HOME}/config_Linux.mk ${PREFIX}/trick/trick-$(TRICK_VERSION) - cp -r ${TRICK_HOME}/docs ${PREFIX}/trick/trick-$(TRICK_VERSION) - cp -r ${TRICK_HOME}/lib_${TRICK_HOST_CPU} ${PREFIX}/trick/trick-$(TRICK_VERSION) - cp -r ${TRICK_HOME}/makefiles ${PREFIX}/trick/trick-$(TRICK_VERSION) - cp -r ${TRICK_HOME}/man ${PREFIX}/trick/trick-$(TRICK_VERSION) - -${PREFIX}/trick/trick-$(TRICK_VERSION) : - mkdir -p $@ - -########### - -copy_trick_source: copy_codegen copy_sim_objects copy_sim_serv_dirs copy_utils_dirs copy_swig - -ifeq ($(USE_ER7_UTILS_INTEGRATORS), 1) -copy_trick_source: copy_er7_utils_dirs -endif - -${PREFIX}/trick/trick-$(TRICK_VERSION)/trick_source : ${PREFIX}/trick/trick-$(TRICK_VERSION) - mkdir -p $@ - -########### - -copy_codegen: ${PREFIX}/trick/trick-$(TRICK_VERSION)/trick_source/codegen/Interface_Code_Gen - cp ${TRICK_HOME}/trick_source/codegen/Interface_Code_Gen/ICG_* ${PREFIX}/trick/trick-$(TRICK_VERSION)/trick_source/codegen/Interface_Code_Gen - cp -r ${TRICK_HOME}/trick_source/codegen/Interface_Code_Gen/lib ${PREFIX}/trick/trick-$(TRICK_VERSION)/trick_source/codegen/Interface_Code_Gen - -${PREFIX}/trick/trick-$(TRICK_VERSION)/trick_source/codegen/Interface_Code_Gen : ${PREFIX}/trick/trick-$(TRICK_VERSION)/trick_source - mkdir -p $@ - -########### - -copy_sim_objects: ${PREFIX}/trick/trick-$(TRICK_VERSION)/trick_source - cp -r ${TRICK_HOME}/trick_source/sim_objects ${PREFIX}/trick/trick-$(TRICK_VERSION)/trick_source - -########### - -BARE_ER7_UTILS_DIRS = $(patsubst ${TRICK_HOME}/trick_source/er7_utils/%,%,$(ER7_UTILS_DIRS)) -TARGET_ER7_UTILS_DIRS = $(addprefix ${PREFIX}/trick/trick-$(TRICK_VERSION)/trick_source/er7_utils/,$(BARE_ER7_UTILS_DIRS)) - -${PREFIX}/trick/trick-$(TRICK_VERSION)/trick_source/er7_utils : ${PREFIX}/trick/trick-$(TRICK_VERSION)/trick_source - mkdir -p $@ - -$(TARGET_ER7_UTILS_DIRS): ${PREFIX}/trick/trick-$(TRICK_VERSION)/trick_source/er7_utils - mkdir -p $@ - -copy_er7_utils_dirs: $(TARGET_ER7_UTILS_DIRS) - @for i in $(BARE_ER7_UTILS_DIRS) ; do \ - cp -r ${TRICK_HOME}/trick_source/er7_utils/$$i/include ${PREFIX}/trick/trick-$(TRICK_VERSION)/trick_source/er7_utils/$$i ; \ - done - -########### - -BARE_SIM_SERV_DIRS = $(filter-out include,$(notdir $(SIM_SERV_DIRS))) -BARE_SIM_SERV_DIRS += InputProcessor -TARGET_SIM_SERV_DIRS = $(addprefix ${PREFIX}/trick/trick-$(TRICK_VERSION)/trick_source/sim_services/,$(BARE_SIM_SERV_DIRS)) -TARGET_SIM_SERV_DIRS += ${PREFIX}/trick/trick-$(TRICK_VERSION)/trick_source/sim_services/include - -${PREFIX}/trick/trick-$(TRICK_VERSION)/trick_source/sim_services : ${PREFIX}/trick/trick-$(TRICK_VERSION)/trick_source - mkdir -p $@ - -$(TARGET_SIM_SERV_DIRS): ${PREFIX}/trick/trick-$(TRICK_VERSION)/trick_source/sim_services - mkdir -p $@ - -copy_sim_serv_dirs: $(TARGET_SIM_SERV_DIRS) - cp ${TRICK_HOME}/trick_source/sim_services/include/*.h ${PREFIX}/trick/trick-$(TRICK_VERSION)/trick_source/sim_services/include - cp ${TRICK_HOME}/trick_source/sim_services/include/*.hh ${PREFIX}/trick/trick-$(TRICK_VERSION)/trick_source/sim_services/include - for i in $(BARE_SIM_SERV_DIRS) ; do \ - cp -r ${TRICK_HOME}/trick_source/sim_services/$$i/include ${PREFIX}/trick/trick-$(TRICK_VERSION)/trick_source/sim_services/$$i ; \ - done - -########### - -BARE_UTILS_DIRS = $(notdir $(UTILS_DIRS)) -TARGET_UTILS_DIRS = $(addprefix ${PREFIX}/trick/trick-$(TRICK_VERSION)/trick_source/trick_utils/,$(BARE_UTILS_DIRS)) - -${PREFIX}/trick/trick-$(TRICK_VERSION)/trick_source/trick_utils : ${PREFIX}/trick/trick-$(TRICK_VERSION)/trick_source - mkdir -p $@ - -$(TARGET_UTILS_DIRS): ${PREFIX}/trick/trick-$(TRICK_VERSION)/trick_source/trick_utils - mkdir -p $@ - -copy_utils_dirs: $(TARGET_UTILS_DIRS) - for i in $(BARE_UTILS_DIRS) ; do \ - cp -r ${TRICK_HOME}/trick_source/trick_utils/$$i/include ${PREFIX}/trick/trick-$(TRICK_VERSION)/trick_source/trick_utils/$$i ; \ - done - -########### - -TARGET_SWIG_DIRS = \ - ${PREFIX}/trick/trick-$(TRICK_VERSION)/trick_source/trick_swig \ - ${PREFIX}/trick/trick-$(TRICK_VERSION)/trick_source/trick_swig/swig_${TRICK_HOST_CPU} - -$(TARGET_SWIG_DIRS): ${PREFIX}/trick/trick-$(TRICK_VERSION)/trick_source - mkdir -p $@ - -copy_swig: $(TARGET_SWIG_DIRS) - cp ${TRICK_HOME}/trick_source/trick_swig/*.py ${PREFIX}/trick/trick-$(TRICK_VERSION)/trick_source/trick_swig - cp ${TRICK_HOME}/trick_source/trick_swig/swig_${TRICK_HOST_CPU}/*.py ${PREFIX}/trick/trick-$(TRICK_VERSION)/trick_source/trick_swig/swig_${TRICK_HOST_CPU} - -########### +install: + cp -r bin include $(notdir ${TRICK_LIB_DIR}) libexec share ${PREFIX} uninstall: - rm -rf ${PREFIX}/trick/trick-$(TRICK_VERSION) + rm -f ${PREFIX}/bin/trick-* + rm -rf ${PREFIX}/include/trick + rm -f ${PREFIX}/${BASE_LIB_DIR}/libtrick* + rm -rf ${PREFIX}/libexec/trick + rm -rf ${PREFIX}/share/doc/trick + rm -f ${PREFIX}/share/man/man1/trick-* + rm -rf ${PREFIX}/share/trick ########### # These rules run the alternatives command in linux to create links in /usr/local/bin for Trick. -ifeq ($(TRICK_HOST_TYPE),Linux) -ALTERNATIVES := $(shell which alternatives || which update-alternatives) - -install: set_alternatives -.PHONY: set_alternatives -set_alternatives: copy_files - - ${ALTERNATIVES} --install /usr/local/bin/CP trick ${PREFIX}/trick/trick-$(TRICK_VERSION)/bin/trick-CP 10 \ - --slave /usr/local/bin/trick-ICG trick-ICG /usr/local/trick/trick-$(TRICK_VERSION)/bin/trick-ICG \ - --slave /usr/local/bin/trick-gte trick-gte /usr/local/trick/trick-$(TRICK_VERSION)/bin/trick-gte \ - --slave /usr/local/bin/trick-killsim trick-killsim /usr/local/trick/trick-$(TRICK_VERSION)/bin/trick-killsim \ - --slave /usr/local/bin/trick-sie trick-sie /usr/local/trick/trick-$(TRICK_VERSION)/bin/trick-sie \ - --slave /usr/local/bin/trick-sim_control trick-simcontrol /usr/local/trick/trick-$(TRICK_VERSION)/bin/trick-simcontrol \ - --slave /usr/local/bin/trick-sniffer trick-sniffer /usr/local/trick/trick-$(TRICK_VERSION)/bin/trick-sniffer \ - --slave /usr/local/bin/trick-dp trick-dp /usr/local/trick/trick-$(TRICK_VERSION)/bin/trick-dp \ - --slave /usr/local/bin/trick-version trick-version /usr/local/trick/trick-$(TRICK_VERSION)/bin/trick-version \ - --slave /usr/local/bin/trick-tv trick-tv /usr/local/trick/trick-$(TRICK_VERSION)/bin/trick-tv - -uninstall: remove_alternatives -.PHONY: remove_alternatives -remove_alternatives: - - ${ALTERNATIVES} --remove trick ${PREFIX}/trick/trick-$(TRICK_VERSION)/bin/CP -endif +#ifeq ($(TRICK_HOST_TYPE),Linux) +#ALTERNATIVES := $(shell which alternatives || which update-alternatives) +# +#install: set_alternatives +#.PHONY: set_alternatives +#set_alternatives: copy_files +# - ${ALTERNATIVES} --install /usr/local/bin/CP trick ${PREFIX}/trick/trick-$(TRICK_VERSION)/bin/trick-CP 10 \ +# --slave /usr/local/bin/trick-ICG trick-ICG /usr/local/trick/trick-$(TRICK_VERSION)/bin/trick-ICG \ +# --slave /usr/local/bin/trick-gte trick-gte /usr/local/trick/trick-$(TRICK_VERSION)/bin/trick-gte \ +# --slave /usr/local/bin/trick-killsim trick-killsim /usr/local/trick/trick-$(TRICK_VERSION)/bin/trick-killsim \ +# --slave /usr/local/bin/trick-sie trick-sie /usr/local/trick/trick-$(TRICK_VERSION)/bin/trick-sie \ +# --slave /usr/local/bin/trick-sim_control trick-simcontrol /usr/local/trick/trick-$(TRICK_VERSION)/bin/trick-simcontrol \ +# --slave /usr/local/bin/trick-sniffer trick-sniffer /usr/local/trick/trick-$(TRICK_VERSION)/bin/trick-sniffer \ +# --slave /usr/local/bin/trick-dp trick-dp /usr/local/trick/trick-$(TRICK_VERSION)/bin/trick-dp \ +# --slave /usr/local/bin/trick-version trick-version /usr/local/trick/trick-$(TRICK_VERSION)/bin/trick-version \ +# --slave /usr/local/bin/trick-tv trick-tv /usr/local/trick/trick-$(TRICK_VERSION)/bin/trick-tv +# +#uninstall: remove_alternatives +#.PHONY: remove_alternatives +#remove_alternatives: +# - ${ALTERNATIVES} --remove trick ${PREFIX}/trick/trick-$(TRICK_VERSION)/bin/CP +#endif ################################################################################ # MISCELLANEOUS DEVELOPER UTILITY TARGETS # diff --git a/libexec/trick/pm/make_swig_makefile.pm b/libexec/trick/pm/make_swig_makefile.pm index d95a75e6..a70ec7f5 100644 --- a/libexec/trick/pm/make_swig_makefile.pm +++ b/libexec/trick/pm/make_swig_makefile.pm @@ -397,25 +397,25 @@ SWIG_SRC_FILES = \$(addprefix $swig_src_dir/,\$(notdir \$(subst .o,.cpp,\$(ALL_S print MAKEFILE "TRICK_FIXED_PYTHON = $swig_sim_dir/swig_double.py $swig_sim_dir/swig_int.py $swig_sim_dir/swig_ref.py $swig_sim_dir/shortcuts.py $swig_sim_dir/unit_test.py $swig_sim_dir/sim_services.py $swig_sim_dir/exception.py\n" ; print MAKEFILE "S_main: \$(TRICK_FIXED_PYTHON) \$(PY_WRAPPERS)\n\n" ; - print MAKEFILE "$swig_sim_dir/sim_services.py : \${TRICK_HOME}/trick_source/trick_swig/swig_\${TRICK_HOST_CPU}/sim_services.py\n" ; + print MAKEFILE "$swig_sim_dir/sim_services.py : \${TRICK_HOME}/share/trick/swig/sim_services.py\n" ; print MAKEFILE "\t/bin/cp \$< \$@\n\n" ; - print MAKEFILE "$swig_sim_dir/swig_double.py : \${TRICK_HOME}/trick_source/trick_swig/swig_\${TRICK_HOST_CPU}/swig_double.py\n" ; + print MAKEFILE "$swig_sim_dir/swig_double.py : \${TRICK_HOME}/share/trick/swig/swig_double.py\n" ; print MAKEFILE "\t/bin/cp \$< \$@\n\n" ; - print MAKEFILE "$swig_sim_dir/swig_int.py : \${TRICK_HOME}/trick_source/trick_swig/swig_\${TRICK_HOST_CPU}/swig_int.py\n" ; + print MAKEFILE "$swig_sim_dir/swig_int.py : \${TRICK_HOME}/share/trick/swig/swig_int.py\n" ; print MAKEFILE "\t/bin/cp \$< \$@\n\n" ; - print MAKEFILE "$swig_sim_dir/swig_ref.py : \${TRICK_HOME}/trick_source/trick_swig/swig_\${TRICK_HOST_CPU}/swig_ref.py\n" ; + print MAKEFILE "$swig_sim_dir/swig_ref.py : \${TRICK_HOME}/share/trick/swig/swig_ref.py\n" ; print MAKEFILE "\t/bin/cp \$< \$@\n\n" ; - print MAKEFILE "$swig_sim_dir/shortcuts.py : \${TRICK_HOME}/trick_source/trick_swig/shortcuts.py\n" ; + print MAKEFILE "$swig_sim_dir/shortcuts.py : \${TRICK_HOME}/share/trick/swig/shortcuts.py\n" ; print MAKEFILE "\t/bin/cp \$< \$@\n\n" ; - print MAKEFILE "$swig_sim_dir/exception.py : \${TRICK_HOME}/trick_source/trick_swig/exception.py\n" ; + print MAKEFILE "$swig_sim_dir/exception.py : \${TRICK_HOME}/share/trick/swig/exception.py\n" ; print MAKEFILE "\t/bin/cp \$< \$@\n\n" ; - print MAKEFILE "$swig_sim_dir/unit_test.py : \${TRICK_HOME}/trick_source/trick_swig/unit_test.py\n" ; + print MAKEFILE "$swig_sim_dir/unit_test.py : \${TRICK_HOME}/share/trick/swig/unit_test.py\n" ; print MAKEFILE "\t/bin/cp \$< \$@\n\n" ; foreach (keys %swig_dirs) { diff --git a/share/trick/makefiles/Makefile.common b/share/trick/makefiles/Makefile.common index a915c37b..bfb329aa 100644 --- a/share/trick/makefiles/Makefile.common +++ b/share/trick/makefiles/Makefile.common @@ -11,13 +11,6 @@ export TRICK_VERSION := $(shell export TRICK_HOME=$(TRICK_HOME) && $(TRICK_HOME) export TRICK_MAJOR := $(shell export TRICK_HOME=$(TRICK_HOME) && $(TRICK_HOME)/bin/trick-version -y) export TRICK_MINOR := $(shell export TRICK_HOME=$(TRICK_HOME) && $(TRICK_HOME)/bin/trick-version -m) -UNAME_M := $(shell uname -m) -ifeq ($(UNAME_M),x86_64) -TRICK_LIB_DIR := ${TRICK_HOME}/lib64 -else -TRICK_LIB_DIR := ${TRICK_HOME}/lib -endif - include $(TRICK_HOME)/share/trick/makefiles/config_${TRICK_HOST_TYPE}.mk -include $(TRICK_HOME)/share/trick/makefiles/config_user.mk diff --git a/share/trick/makefiles/config_Darwin.mk b/share/trick/makefiles/config_Darwin.mk index 407f9275..766deeac 100644 --- a/share/trick/makefiles/config_Darwin.mk +++ b/share/trick/makefiles/config_Darwin.mk @@ -1,4 +1,6 @@ +INSTALL = /usr/bin/install + SHARED_LIB_OPT := -dynamiclib -Wl,-undefined,dynamic_lookup TRICK_LIB_DIR := ${TRICK_HOME}/lib diff --git a/share/trick/makefiles/config_Linux.mk b/share/trick/makefiles/config_Linux.mk index f922467b..fd06e857 100644 --- a/share/trick/makefiles/config_Linux.mk +++ b/share/trick/makefiles/config_Linux.mk @@ -1,4 +1,13 @@ +INSTALL = /bin/install + +UNAME_M := $(shell uname -m) +ifeq ($(UNAME_M),x86_64) +TRICK_LIB_DIR := ${TRICK_HOME}/lib64 +else +TRICK_LIB_DIR := ${TRICK_HOME}/lib +endif + SHARED_LIB_OPT := -shared TRICK_LIBS = -Wl,-rpath=${TRICK_HOME}/lib:${TRICK_HOME}/lib64 -L${TRICK_LIB_DIR} -ltrick -ltrick_pyip diff --git a/share/trick/makefiles/config_user.mk.in b/share/trick/makefiles/config_user.mk.in index b96cff9b..d5bd7249 100644 --- a/share/trick/makefiles/config_user.mk.in +++ b/share/trick/makefiles/config_user.mk.in @@ -27,6 +27,6 @@ GTEST_HOME = @GTEST_HOME@ LIBXML = @LIBXML@ -PREFIX = @prefix@ +PREFIX ?= @prefix@ CONFIG_MK = 1 diff --git a/trick_source/trick_swig/exception.py b/share/trick/swig/exception.py similarity index 100% rename from trick_source/trick_swig/exception.py rename to share/trick/swig/exception.py diff --git a/trick_source/trick_swig/shortcuts.py b/share/trick/swig/shortcuts.py similarity index 100% rename from trick_source/trick_swig/shortcuts.py rename to share/trick/swig/shortcuts.py diff --git a/trick_source/trick_swig/unit_test.py b/share/trick/swig/unit_test.py similarity index 100% rename from trick_source/trick_swig/unit_test.py rename to share/trick/swig/unit_test.py diff --git a/trick_source/trick_swig/Makefile b/trick_source/trick_swig/Makefile index 8d509101..fdc607ec 100644 --- a/trick_source/trick_swig/Makefile +++ b/trick_source/trick_swig/Makefile @@ -18,6 +18,12 @@ SWIG_OBJECT_FILES = \ $(OBJ_DIR)/swig_int_wrap.o \ $(OBJ_DIR)/swig_ref_wrap.o +PY_FILES = \ + ${TRICK_HOME}/share/trick/swig/sim_services.py \ + ${TRICK_HOME}/share/trick/swig/swig_double.py \ + ${TRICK_HOME}/share/trick/swig/swig_int.py \ + ${TRICK_HOME}/share/trick/swig/swig_ref.py + SWIG_SRC_FILES = $(addprefix swig_${TRICK_HOST_CPU}/, $(notdir $(subst .o,.cpp,$(SWIG_OBJECT_FILES)))) TRICK_CXXFLAGS += $(PYTHON_INCLUDES) -Wno-redundant-decls -Wno-shadow -Wno-unused-parameter -Wno-missing-field-initializers @@ -62,7 +68,7 @@ $(OBJECT_FILES): $(OBJ_DIR)/%.o : %.cpp $(TRICK_CPPC) $(TRICK_CXXFLAGS) -c $< -o $@ $(SWIG_SRC_FILES): swig_${TRICK_HOST_CPU}/%_wrap.cpp : %.i - $(SWIG) $(SWIG_DEFS) -I${TRICK_HOME}/trick_source -I${TRICK_HOME}/include -c++ -python -includeall -ignoremissing -w201,362,389,451 -o $@ $< + $(SWIG) $(SWIG_DEFS) -I${TRICK_HOME}/trick_source -I${TRICK_HOME}/include -c++ -python -includeall -ignoremissing -w201,362,389,451 -o $@ -outdir ${TRICK_HOME}/share/trick/swig $< $(TRICK_LIB) : $(SWIG_OBJECT_FILES) $(OBJECT_FILES) ar crs $@ $? @@ -70,13 +76,13 @@ $(TRICK_LIB) : $(SWIG_OBJECT_FILES) $(OBJECT_FILES) real_clean: clean clean: clean_python - $(RM) -rf $(OBJ_DIR) $(TEST_DIR) + $(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 +real_clean: clean # some depends swig_int_wrap.cpp: swig_int.cpp