Changeset dfeb4e2 in mainline for uspace/Makefile


Ignore:
Timestamp:
2018-01-06T02:37:59Z (7 years ago)
Author:
Jiří Zárevúcky <zarevucky.jiri@…>
Children:
c9e09f2
Parents:
3d95c9d
git-author:
Jiří Zárevúcky <zarevucky.jiri@…> (2018-01-02 18:06:21)
git-committer:
Jiří Zárevúcky <zarevucky.jiri@…> (2018-01-06 02:37:59)
Message:

Integrate ports into the main tree as a submodule.

A stripped down version of hsct.sh is added to tools, and Makefiles
gain new targets that implement part of hsct's prior functionality.

This arrangement improves usability and maintainability of ports,
reduces the likelihood of ports being broken by mainline changes,
and partially solves the issue with build logic being duplicated
in multiple places.

It is newly possible to build individual ports using make ports-NAME,
and all ports using make ports-all. This also installs the outputs to
uspace/dist, so ideally, simple make ports-all && make would create
an image with all ports included. This currently doesn't work only
because some ports fail to build.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/Makefile

    r3d95c9d rdfeb4e2  
    255255CLEANS := $(addsuffix .clean,$(DIRS) $(LIBS) $(BASE_LIBS))
    256256
    257 .PHONY: all $(BASE_BUILDS) $(BUILDS) $(BUILDS_TESTS) $(CLEANS) clean
     257PORTS_BUILD_DIR := ../build/ports
     258PORT_CFLAGS := \
     259        -specs $(abspath lib/posix/gcc.specs) \
     260        -isystem $(abspath $(PORTS_BUILD_DIR)/include) \
     261        -isystem $(abspath $(PORTS_BUILD_DIR)/include/posix) \
     262        -isystem $(abspath $(PORTS_BUILD_DIR)/include/libc) \
     263        -L$(abspath $(PORTS_BUILD_DIR)/lib) \
     264        -Wl,-T,link.ld \
     265        -Wl,--whole-archive,-lc,-lmath,--no-whole-archive
     266
     267.PHONY: all $(BASE_BUILDS) $(BUILDS) $(BUILDS_TESTS) $(CLEANS) clean ports_cache
    258268
    259269all: $(BUILDS) $(BUILDS_TESTS)
     270
     271ports_cache: lib/posix.build lib/math.build lib/clui.build
     272        git submodule update --init -- ports
     273       
     274        # Copy libs
     275        mkdir -p $(PORTS_BUILD_DIR)/lib
     276        cp lib/posix/link.ld $(PORTS_BUILD_DIR)/lib/link.ld
     277        cp lib/posix/libc.a $(PORTS_BUILD_DIR)/lib/libc.a
     278        # We don't currently build a dedicated debug-enabled libc version.
     279        cp lib/posix/libc.a $(PORTS_BUILD_DIR)/lib/libg.a
     280        cp lib/math/libmath.a $(PORTS_BUILD_DIR)/lib/libmath.a
     281        cp lib/clui/libclui.a $(PORTS_BUILD_DIR)/lib/libclui.a
     282       
     283        # Copy headers
     284        mkdir -p $(PORTS_BUILD_DIR)/include
     285        cp -L -R lib/posix/include/posix/ $(PORTS_BUILD_DIR)/include/
     286        mkdir -p $(PORTS_BUILD_DIR)/include/libc
     287        cp -L -R lib/c/include/* $(PORTS_BUILD_DIR)/include/libc
     288        cp -L -R lib/c/arch/$(UARCH)/include/libarch $(PORTS_BUILD_DIR)/include/
     289        cp -L -R lib/math/include/* $(PORTS_BUILD_DIR)/include/libc
     290        cp -L -R lib/math/arch/$(UARCH)/include/libarch/ $(PORTS_BUILD_DIR)/include/
     291        cp -L -R ../abi/include/* $(PORTS_BUILD_DIR)/include/
     292        ln -s -f -n libc $(PORTS_BUILD_DIR)/include/libmath
     293       
     294        # FIXME: Just for temporary compatibility.
     295        touch $(PORTS_BUILD_DIR)/coastline.specs
     296       
     297        mkdir -p $(PORTS_BUILD_DIR)/include/libclui
     298        cp -L lib/clui/tinput.h $(PORTS_BUILD_DIR)/include/libclui/
     299       
     300        # TODO: Get rid of this.
     301        find $(PORTS_BUILD_DIR)/include/libc $(PORTS_BUILD_DIR)/include/libarch -name '*.h' -exec sed \
     302                -e 's:#include <:#include <libc/:' \
     303                -e 's:#include <libc/libarch/:#include <libarch/:' \
     304                -e 's:#include <libc/abi/:#include <abi/:' \
     305                -e 's:#include <libc/_bits/:#include <_bits/:' \
     306                -e 's:#include <libc/libc/:#include <libc/:' \
     307                -i {} \;
     308       
     309        mkdir -p overlay
     310
     311ports-all: ports_cache
     312        for x in ports/*; do if [ -d "$$x" ]; then $(MAKE) ports-install-`basename $$x` || exit 1; fi; done
     313
     314ports-%: ports_cache
     315        $(MAKE) $(@:ports-%=ports-install-%)
     316
     317# This is a separate target to avoid running ports_cache multiple times.
     318ports-install-%:
     319        PATH="$(CROSS_PREFIX)/$(TARGET)/bin:$$PATH" \
     320        HSCT_HELENOS_ROOT="$(abspath ..)" \
     321        HSCT_HOME="$(abspath ports)" \
     322        HSCT_HSCT="$(abspath ../tools/hsct.sh)" \
     323        HSCT_SOURCES_DIR="$(abspath $(PORTS_BUILD_DIR)/sources)" \
     324        HSCT_BUILD_DIR="$(abspath $(PORTS_BUILD_DIR)/build)" \
     325        HSCT_INCLUDE_DIR="$(abspath $(PORTS_BUILD_DIR)/include)" \
     326        HSCT_LIB_DIR="$(abspath $(PORTS_BUILD_DIR)/lib)" \
     327        HSCT_CACHE_DIR="$(abspath $(PORTS_BUILD_DIR))" \
     328        HSCT_CACHE_LIB="$(abspath $(PORTS_BUILD_DIR)/lib)" \
     329        HSCT_DIST_DIR="$(abspath $(PORTS_BUILD_DIR)/dist)" \
     330        HSCT_ARCHIVE_DIR="$(abspath $(PORTS_BUILD_DIR)/archives)" \
     331        HSCT_PARALLELISM="$(JOBS)" \
     332        HSCT_GNU_TARGET="$(TARGET)" \
     333        HSCT_CC="$(CC) $(PORT_CFLAGS)" \
     334        HSCT_CFLAGS="" \
     335        HSCT_LDFLAGS_FOR_CC="" \
     336        HSCT_LD="$(LD)" \
     337        HSCT_AR="$(AR)" \
     338        HSCT_RANLIB="$(RANLIB)" \
     339        HSCT_OBJDUMP="$(OBJDUMP)" \
     340        HSCT_OBJCOPY="$(OBJCOPY)" \
     341        HSCT_AS="$(AS)" \
     342        HSCT_STRIP="$(STRIP)" \
     343        ../tools/hsct.sh install $(@:ports-install-%=%)
    260344
    261345$(BUILDS_TESTS): $(BASE_BUILDS) $(BUILDS)
Note: See TracChangeset for help on using the changeset viewer.