source: trunk/mkspecs/features/vxworks.prf@ 1010

Last change on this file since 1010 was 846, checked in by Dmitry A. Kuminov, 15 years ago

trunk: Merged in qt 4.7.2 sources from branches/vendor/nokia/qt.

  • Property svn:eol-style set to native
File size: 3.5 KB
Line 
1# VxWorks Munching Feature
2# When compiling C++ sources on VxWorks in kernel mode, all .o files have to
3# be processed by the so-called 'munch' script which will generate
4# additional code for static c'tors and d'tors. The resulting .c file has to
5# be compiled in turn and linked to the executable.
6# This can only been done when linking applications, since the munch script
7# generates a .c file containing static symbols: linking a lib that was
8# already munched to a munched application would lead to duplicate symbols!
9
10isEmpty(VXWORKS_MUNCH_EXT):VXWORKS_MUNCH_EXT = vxm
11isEmpty(VXWORKS_MUNCH_TOOL):VXWORKS_MUNCH_TOOL = $(WIND_BASE)/host/resource/hutils/tcl/munch.tcl
12
13
14!exists($$VXWORKS_MUNCH_TOOL) {
15 error("Could not find VxWorks Munch tool: '$${VXWORKS_MUNCH_TOOL}'. Please set the environment variable WIND_BASE correctly.")
16}
17
18# The following scope is entered for any project that specifies 'shared' as well
19# as for any project specifying neither 'shared', nor 'lib', nor 'staticlib'.
20# This means that for a static build only the executable is munched, while for
21# a shared build, every lib, plugin and executable is munched separately.
22
23shared|!staticlib:!lib {
24 *-dcc {
25 VXWORKS_MUNCH_CMD = targ=`basename $(TARGET)`; \
26 ddump -Ng \"$(TARGET)\" | tclsh $$VXWORKS_MUNCH_TOOL -c $$VXWORKS_ARCH_MUNCH >\"$(OBJECTS_DIR)/\$\${targ}_ctdt.c\" && \
27 $$QMAKE_CC -c $$QMAKE_CFLAGS \"$(OBJECTS_DIR)/\$\${targ}_ctdt.c\" -o \"$(OBJECTS_DIR)/\$\${targ}_ctdt.o\" && \
28 $$QMAKE_LINK $$QMAKE_LFLAGS -X -r5 -r4 \"$(OBJECTS_DIR)/\$\${targ}_ctdt.o\" \"$(TARGET)\" -o \"$(TARGET).munched\" && \
29 mv \"$(TARGET).munched\" \"$(TARGET)\" && \
30 chmod +x \"$(TARGET)\"
31 }
32 *-g++ {
33 VXWORKS_MUNCH_CMD = targ=`basename $(TARGET)`; \
34 nm \"$(DESTDIR)$(TARGET)\" | tclsh $$VXWORKS_MUNCH_TOOL -c $$VXWORKS_ARCH_MUNCH >\"$(OBJECTS_DIR)/\$\${targ}_ctdt.c\" && \
35 $$QMAKE_CC -c $$QMAKE_CFLAGS -fdollars-in-identifiers \"$(OBJECTS_DIR)/\$\${targ}_ctdt.c\" -o \"$(OBJECTS_DIR)/\$\${targ}_ctdt.o\" && \
36 $$QMAKE_LINK $$QMAKE_LFLAGS -nostdlib -Wl,-X -T $(WIND_BASE)/target/h/tool/gnu/ldscripts/link.OUT \"$(OBJECTS_DIR)/\$\${targ}_ctdt.o\" \"$(DESTDIR)$(TARGET)\" -o \"$(DESTDIR)$(TARGET).munched\" && \
37 mv \"$(DESTDIR)$(TARGET).munched\" \"$(DESTDIR)$(TARGET)\" && \
38 chmod +x \"$(DESTDIR)$(TARGET)\"
39 }
40
41 # We need to create a dummy lib.a in case someone links against this lib.
42 # In VxWorks it's the responsibility of the run-time linker ld to resolve
43 # symbols, since there are no real shared libraries for the toolchain linker
44 # to link against.
45
46 shared:contains(TEMPLATE, lib) {
47 VXWORKS_MUNCH_CMD += "&&"
48 VXWORKS_MUNCH_CMD += (atarg=`basename $(TARGET) .so.$${VERSION}`.a ; touch \"$(DESTDIR)\$\${atarg}\")
49 }
50
51 !isEmpty(QMAKE_POST_LINK):QMAKE_POST_LINK = $$escape_expand(\\n\\t)$$QMAKE_POST_LINK
52 QMAKE_POST_LINK = $$VXWORKS_MUNCH_CMD$$QMAKE_POST_LINK
53 silent:QMAKE_POST_LINK = @echo creating $@.$$VXWORKS_MUNCH_EXT && $$QMAKE_POST_LINK
54
55 isEmpty(DESTDIR) {
56 target.targets += "`basename $(TARGET)`.$$VXWORKS_MUNCH_EXT"
57 QMAKE_DISTCLEAN += "`basename $(TARGET)`.$$VXWORKS_MUNCH_EXT"
58 } else {
59 target.targets += "$(DESTDIR)/`basename $(TARGET)`.$$VXWORKS_MUNCH_EXT"
60 QMAKE_DISTCLEAN += "$(DESTDIR)/`basename $(TARGET)`.$$VXWORKS_MUNCH_EXT"
61 }
62 *-g++:LIBS += -lgcc
63}
64
Note: See TracBrowser for help on using the repository browser.