Hi,
On 15 March 2018 at 14:36, Mathieu Poirier mathieu.poirier@linaro.org wrote:
On 14 March 2018 at 23:03, Wookey wookey@wookware.org wrote:
On 2018-03-13 16:19 +0000, Wookey wrote:
On 2018-03-08 05:18 +0000, Wookey wrote: (this is not working quite right, so I'll send this mail now, as relevant to the discussion or the first set of patches, and a finished patch later)
OK. Attached is the patch. As well as adding the SONAME setting, and installing, it sets out the actual dependencies for the links and libraries, using order-only dependencies for the directories. This is -j safe, unlike using mkdir -p, and avoids using a sentinel file for each dir (which would also work if you prefer that for some reason).
I've set it to use the release version, rather than 0.0.0, assuming that you want to go with that. (I guess I should move on to 0.8.1 before uploading this?)
What would be the rationale for moving to 0.8.1? Or perhaps I missed something...
Strictly speaking, the current version of OpenCSD is 0.8.1 (as of 26/01/2018), so when any patches for adjusting makefiles for packaging purposes are added in, then the release number will increment to 0.8.2. If any file changes in the project then that is at a minimum a patch release, across both supported platforms. For that I will have to increment the source and docs files that quote the latest version number too, before creating a release version.
Wookey: I'll be at connect next week so if we need to thrash out any final details then that may be a chance.
Mike.
No doubt this could be improved, but it is now at least reasonably correct and only builds things that need building.
I note that the changed sections for the two submakefiles in rctdl_c_api_lib and ref_trace_decode_lib only differ by one word (the rctdl_c_api_lib shared lib build has $(SO_LIB_DEPS) where ref_trace_decode_lib doesn't). I do wonder if there is room for some merging to only have one set of rules for all that?
Index: libopencsd-0.8.0/decoder/build/linux/makefile
--- libopencsd-0.8.0.orig/decoder/build/linux/makefile +++ libopencsd-0.8.0/decoder/build/linux/makefile @@ -104,6 +104,13 @@ export LIB_TARGET_DIR=$(OCSD_LIB_ROOT)/$ export LIB_TEST_TARGET_DIR=$(OCSD_TESTS)/lib/$(PLAT_DIR) export BIN_TEST_TARGET_DIR=$(OCSD_TESTS)/bin/$(PLAT_DIR)
+# verion +export SO_MAJOR_VER = 0 +SO_MINOR_VER = 8 +SO_PATCH_VER = 0 +export SO_VER = $(SO_MAJOR_VER).$(SO_MINOR_VER).$(SO_PATCH_VER)
########################################################### # build targets
@@ -113,8 +120,12 @@ libs: $(LIB_BASE_NAME)_lib $(LIB_CAPI_N
install: libs mkdir -p $(INSTALL_LIB_DIR) $(INSTALL_INCLUDE_DIR)
$(INSTALL) --mode=644 $(LIB_TARGET_DIR)/lib$(LIB_BASE_NAME).so $(INSTALL_LIB_DIR)/
$(INSTALL) --mode=644 $(LIB_TARGET_DIR)/lib$(LIB_CAPI_NAME).so $(INSTALL_LIB_DIR)/
cp -d $(LIB_TARGET_DIR)/lib$(LIB_BASE_NAME).so $(INSTALL_LIB_DIR)/
cp -d $(LIB_TARGET_DIR)/lib$(LIB_BASE_NAME).so.$(SO_MAJOR_VER) $(INSTALL_LIB_DIR)/
$(INSTALL) --mode=644 $(LIB_TARGET_DIR)/lib$(LIB_BASE_NAME).so.$(SO_VER) $(INSTALL_LIB_DIR)/
cp -d $(LIB_TARGET_DIR)/lib$(LIB_CAPI_NAME).so $(INSTALL_LIB_DIR)/
cp -d $(LIB_TARGET_DIR)/lib$(LIB_CAPI_NAME).so.$(SO_MAJOR_VER) $(INSTALL_LIB_DIR)/
$(INSTALL) --mode=644 $(LIB_TARGET_DIR)/lib$(LIB_CAPI_NAME).so.$(SO_VER) $(INSTALL_LIB_DIR)/ $(INSTALL) --mode=644 $(LIB_TARGET_DIR)/lib$(LIB_BASE_NAME).a $(INSTALL_LIB_DIR)/ $(INSTALL) --mode=644 $(LIB_TARGET_DIR)/lib$(LIB_CAPI_NAME).a $(INSTALL_LIB_DIR)/ cd $(OCSD_ROOT)/build/linux/rctdl_c_api_lib && make install_inc
Index: libopencsd-0.8.0/decoder/build/linux/rctdl_c_api_lib/makefile
--- libopencsd-0.8.0.orig/decoder/build/linux/rctdl_c_api_lib/makefile +++ libopencsd-0.8.0/decoder/build/linux/rctdl_c_api_lib/makefile @@ -55,13 +55,31 @@ OBJECTS=$(BUILD_DIR)/ocsd_c_api.o \ INST_INC_SRC=$(OCSD_INCLUDE)/$(LIB_UAPI_INC_DIR) INST_INC_DST=$(INSTALL_INCLUDE_DIR)/$(LIB_UAPI_INC_DIR)
-all: build_dir $(OBJECTS)
mkdir -p $(LIB_TARGET_DIR)
+all: links
+links: $(LIB_TARGET_DIR)/$(LIB_NAME).so.$(SO_MAJOR_VER) $(LIB_TARGET_DIR)/$(LIB_NAME).so +.PHONY: links
+LIBS:= $(LIB_TARGET_DIR)/$(LIB_NAME).a $(LIB_TARGET_DIR)/$(LIB_NAME).so.$(SO_VER)
+$(LIB_TARGET_DIR):
mkdir $(LIB_TARGET_DIR)
+$(BUILD_DIR):
mkdir $(BUILD_DIR)
+$(LIB_TARGET_DIR)/$(LIB_NAME).a: $(OBJECTS) | $(BUILD_DIR) $(LIB_TARGET_DIR) $(LIB) $(LIB_FLAGS) $(LIB_TARGET_DIR)/$(LIB_NAME).a $(OBJECTS)
$(LINKER) $(LINKER_FLAGS) -o $(LIB_TARGET_DIR)/$(LIB_NAME).so -Wl,-soname,$(LIB_NAME).so $(OBJECTS) $(SO_LIB_DEPS)
-build_dir:
mkdir -p $(BUILD_DIR)
+$(LIB_TARGET_DIR)/$(LIB_NAME).so.$(SO_VER): $(OBJECTS) | $(BUILD_DIR) $(LIB_TARGET_DIR)
$(LINKER) $(LINKER_FLAGS) -o $(LIB_TARGET_DIR)/$(LIB_NAME).so.$(SO_VER) -Wl,-soname,$(LIB_NAME).so.$(SO_MAJOR_VER) $(OBJECTS) $(SO_LIB_DEPS)
+$(LIB_TARGET_DIR)/$(LIB_NAME).so.$(SO_MAJOR_VER): $(LIBS) | $(LIB_TARGET_DIR)
( cd $(LIB_TARGET_DIR); ln -s $(LIB_NAME).so.$(SO_VER) $(LIB_NAME).so.$(SO_MAJOR_VER) )
+$(LIB_TARGET_DIR)/$(LIB_NAME).so: $(LIB_TARGET_DIR)/$(LIB_NAME).so.$(SO_MAJOR_VER) | $(LIB_TARGET_DIR)
( cd $(LIB_TARGET_DIR); ln -s $(LIB_NAME).so.$(SO_MAJOR_VER) $(LIB_NAME).so )
##### build rules
@@ -81,7 +99,7 @@ clean: rm -f $(OBJECTS) rm -f $(DEPS) rm -f $(LIB_TARGET_DIR)/$(LIB_NAME).a
rm -f $(LIB_TARGET_DIR)/$(LIB_NAME).so
rm -f $(LIB_TARGET_DIR)/$(LIB_NAME).so*
#### install the necessary include files for the c-api library on linux install_inc: Index: libopencsd-0.8.0/decoder/build/linux/ref_trace_decode_lib/makefile =================================================================== --- libopencsd-0.8.0.orig/decoder/build/linux/ref_trace_decode_lib/makefile +++ libopencsd-0.8.0/decoder/build/linux/ref_trace_decode_lib/makefile @@ -114,13 +114,31 @@ OBJECTS=$(BUILD_DIR)/ocsd_code_follower. $(PTMOBJ) \ $(PKTPRNTOBJ)
-all: build_dir $(OBJECTS)
mkdir -p $(LIB_TARGET_DIR)
+all: links
+links: $(LIB_TARGET_DIR)/$(LIB_NAME).so.$(SO_MAJOR_VER) $(LIB_TARGET_DIR)/$(LIB_NAME).so +.PHONY: links
+LIBS:= $(LIB_TARGET_DIR)/$(LIB_NAME).a $(LIB_TARGET_DIR)/$(LIB_NAME).so.$(SO_VER)
+$(LIB_TARGET_DIR):
mkdir $(LIB_TARGET_DIR)
+$(BUILD_DIR):
mkdir $(BUILD_DIR)
+$(LIB_TARGET_DIR)/$(LIB_NAME).a: $(OBJECTS) | $(BUILD_DIR) $(LIB_TARGET_DIR) $(LIB) $(LIB_FLAGS) $(LIB_TARGET_DIR)/$(LIB_NAME).a $(OBJECTS)
$(LINKER) $(LINKER_FLAGS) -o $(LIB_TARGET_DIR)/$(LIB_NAME).so -Wl,-soname,$(LIB_NAME).so $(OBJECTS)
-build_dir:
mkdir -p $(BUILD_DIR)
+$(LIB_TARGET_DIR)/$(LIB_NAME).so.$(SO_VER): $(OBJECTS) | $(BUILD_DIR) $(LIB_TARGET_DIR)
$(LINKER) $(LINKER_FLAGS) -o $(LIB_TARGET_DIR)/$(LIB_NAME).so.$(SO_VER) -Wl,-soname,$(LIB_NAME).so.$(SO_MAJOR_VER) $(OBJECTS)
+$(LIB_TARGET_DIR)/$(LIB_NAME).so.$(SO_MAJOR_VER): $(LIBS) | $(LIB_TARGET_DIR)
( cd $(LIB_TARGET_DIR); ln -s $(LIB_NAME).so.$(SO_VER) $(LIB_NAME).so.$(SO_MAJOR_VER) )
+$(LIB_TARGET_DIR)/$(LIB_NAME).so: $(LIB_TARGET_DIR)/$(LIB_NAME).so.$(SO_MAJOR_VER) | $(LIB_TARGET_DIR)
( cd $(LIB_TARGET_DIR); ln -s $(LIB_NAME).so.$(SO_MAJOR_VER) $(LIB_NAME).so )
##### build rules
@@ -140,4 +158,4 @@ clean: rm -f $(OBJECTS) rm -f $(DEPS) rm -f $(LIB_TARGET_DIR)/$(LIB_NAME).a
rm -f $(LIB_TARGET_DIR)/$(LIB_NAME).so
rm -f $(LIB_TARGET_DIR)/$(LIB_NAME).so*
I'll look at the flags next.
Wookey
Principal hats: Linaro, Debian, Wookware, ARM http://wookware.org/
CoreSight mailing list CoreSight@lists.linaro.org https://lists.linaro.org/mailman/listinfo/coresight
CoreSight mailing list CoreSight@lists.linaro.org https://lists.linaro.org/mailman/listinfo/coresight