| [pok-devel] [Patch] Partition library | 
[ Thread Index | 
Date Index
| More lists.tuxfamily.org/pok-devel Archives
] 
Hi,
during my GSoC Project for RTEMS, I changed some source code in POK.
I need a library consisting of all object files of a partition. 
Therefore I need libpok and the $(OBJS) files mentioned in the 
partition's makefile.
I tried to introduce a new file misc/mk/rules-libpart.mk, to get the 
code generator to include it and to add libpart to the target array of 
the partition Makefile. But to do this, I have to change the backend 
code in ocarina.
I don't want to do this. So I decided to use the libpok target to build 
this library, too.
This change affects the compile time on the host, but neither the 
execution time nor the final binary.
I ran 'make test' and all tests completed successfully.
* The patch is attached and I would commit it Friday, if nobody objects.*
Further information on this can be read here:
http://phipse.github.io/rtems/blog/2013/07/28/generation-of-libpart-target/
Cheers,
Philipp
Index: misc/mk/rules-partition.mk
===================================================================
--- misc/mk/rules-partition.mk	(revision 46)
+++ misc/mk/rules-partition.mk	(working copy)
@@ -12,9 +12,15 @@
 COPTS += -include $(DEPLOYMENT_HEADER)
 endif
 
-libpok: 
+# This target produces libpok and a new library consisting of the contents of libpok and the partition's object files.
+libpok: $(OBJS) 
 	$(CD) $(POK_PATH)/libpok && $(MAKE) distclean all
 	$(CP) $(POK_PATH)/libpok/libpok.a `pwd`/
+	$(ECHO) $(ECHO_FLAGS) $(ECHO_FLAGS_ONELINE) "[AR] libpart.a "
+	/bin/ar -x libpok.a
+	/bin/ar -csr libpart.a $(OBJS) *.lo
+	if test $$? -eq 0; then $(ECHO) $(ECHO_FLAGS) $(ECHO_GREEN) " OK "; else $(ECHO) $(ECHO_FLAGS) $(ECHO_RED) " KO"; fi
+	rm *.lo
 
 $(TARGET): $(OBJS)
 	$(ECHO) $(ECHO_FLAGS) $(ECHO_FLAGS_ONELINE) "[Assemble partition $@ "