Fork us on GitHub Follow us on Facebook Follow us on Twitter

Changeset e160bfe8 in mainline


Ignore:
Timestamp:
2017-10-23T18:51:34Z (3 years ago)
Author:
Ondřej Hlavatý <aearsis@…>
Branches:
master
Children:
327f147
Parents:
31cca4f3 (diff), 367db39a (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

merge mainline (again) to fix build

Perhaps it wasn't so good idea to start merging mainline in these unstable times :)

Files:
17 edited

Legend:

Unmodified
Added
Removed
  • .bzrignore

    r31cca4f3 re160bfe8  
    55*.prev
    66*.so.*
     7*.d
    78Makefile.ag.depend
    89Makefile.common
    910Makefile.config
    10 Makefile.depend
    1111autotool/
    1212boot/distroot/
  • Makefile

    r31cca4f3 re160bfe8  
    4141COMMON_MAKEFILE = Makefile.common
    4242COMMON_HEADER = common.h
    43 COMMON_HEADER_PREV = $(COMMON_HEADER).prev
    4443
    4544CONFIG_MAKEFILE = Makefile.config
    4645CONFIG_HEADER = config.h
    4746
    48 .PHONY: all precheck cscope cscope_parts autotool config_auto config_default config distclean clean check releasefile release
     47.PHONY: all precheck cscope cscope_parts autotool config_auto config_default config distclean clean check releasefile release common boot kernel uspace
    4948
    50 all: $(COMMON_MAKEFILE) $(COMMON_HEADER) $(CONFIG_MAKEFILE) $(CONFIG_HEADER)
    51         cp -a $(COMMON_HEADER) $(COMMON_HEADER_PREV)
     49all: kernel uspace
     50        $(MAKE) -r -C boot PRECHECK=$(PRECHECK)
     51
     52common: $(COMMON_MAKEFILE) $(COMMON_HEADER) $(CONFIG_MAKEFILE) $(CONFIG_HEADER)
     53
     54kernel: common
    5255        $(MAKE) -r -C kernel PRECHECK=$(PRECHECK)
     56
     57uspace: common
    5358        $(MAKE) -r -C uspace PRECHECK=$(PRECHECK)
    54         $(MAKE) -r -C boot PRECHECK=$(PRECHECK)
    5559
    5660precheck: clean
     
    7983# Autotool (detects compiler features)
    8084
    81 autotool $(COMMON_MAKEFILE) $(COMMON_HEADER): $(CONFIG_MAKEFILE)
     85autotool $(COMMON_MAKEFILE) $(COMMON_HEADER): $(CONFIG_MAKEFILE) $(AUTOTOOL)
    8286        $(AUTOTOOL)
    83         -[ -f $(COMMON_HEADER_PREV) ] && diff -q $(COMMON_HEADER_PREV) $(COMMON_HEADER) && mv -f $(COMMON_HEADER_PREV) $(COMMON_HEADER)
     87        diff -q $(COMMON_HEADER).new $(COMMON_HEADER) 2> /dev/null; if [ $$? -ne 0 ]; then mv -f $(COMMON_HEADER).new $(COMMON_HEADER); fi
    8488
    8589# Build-time configuration
     
    109113
    110114distclean: clean
    111         rm -f $(CSCOPE).out $(COMMON_MAKEFILE) $(COMMON_HEADER) $(COMMON_HEADER_PREV) $(CONFIG_MAKEFILE) $(CONFIG_HEADER) tools/*.pyc tools/checkers/*.pyc release/HelenOS-*
     115        rm -f $(CSCOPE).out $(COMMON_MAKEFILE) $(COMMON_HEADER) $(CONFIG_MAKEFILE) $(CONFIG_HEADER) tools/*.pyc tools/checkers/*.pyc release/HelenOS-*
    112116
    113117clean:
  • boot/Makefile

    r31cca4f3 re160bfe8  
    117117                cp "$(USPACE_PATH)/$(DRVS_PATH)/$$file_dir/$$file_name/$$file_name.fw" "$(DIST_PATH)/$(DRVS_PATH)/$$file_name/" ; \
    118118        done
    119         if ls $(DIST_OVERLAY_PATH)/* >/dev/null; then \
     119        if ls $(DIST_OVERLAY_PATH)/* >/dev/null 2>/dev/null; then \
    120120                cp -r -L $(DIST_OVERLAY_PATH)/* "$(DIST_PATH)"; \
    121121        fi
     
    126126        $(MAKE) -r -f $(POSTBUILD) clean PRECHECK=$(PRECHECK)
    127127endif
    128         rm -f $(POST_OUTPUT) $(BOOT_OUTPUT) $(DEPEND) $(DEPEND_PREV) arch/*/include/common.h
     128        rm -f $(POST_OUTPUT) $(BOOT_OUTPUT) arch/*/include/common.h
    129129        find generic/src/ arch/*/src/ genarch/src/ -name '*.o' -follow -exec rm \{\} \;
     130        find generic/src/ arch/*/src/ genarch/src/ -name '*.d' -follow -exec rm \{\} \;
    130131
    131132clean_dist:
  • boot/Makefile.build

    r31cca4f3 re160bfe8  
    2727#
    2828
    29 .PHONY: all clean
     29.PHONY: all clean depend
    3030
    3131include Makefile.common
     
    6464endif
    6565
    66 ifeq ($(COMPILER),gcc_native)
    67         CFLAGS = $(COMMON_CFLAGS) $(GCC_CFLAGS) $(EXTRA_CFLAGS)
    68         DEPEND_DEFS = $(DEFS) $(CONFIG_DEFS)
    69 endif
    70 
    71 ifeq ($(COMPILER),gcc_cross)
    72         CFLAGS = $(COMMON_CFLAGS) $(GCC_CFLAGS) $(EXTRA_CFLAGS)
    73         DEPEND_DEFS = $(DEFS) $(CONFIG_DEFS)
    74 endif
    75 
    76 ifeq ($(COMPILER),gcc_helenos)
    77         CFLAGS = $(COMMON_CFLAGS) $(GCC_CFLAGS) $(EXTRA_CFLAGS)
    78         DEPEND_DEFS = $(DEFS) $(CONFIG_DEFS)
    79 endif
    80 
    8166ifeq ($(COMPILER),clang)
    8267        CFLAGS = $(COMMON_CFLAGS) $(CLANG_CFLAGS) $(EXTRA_CFLAGS)
    83         DEPEND_DEFS = $(DEFS) $(CONFIG_DEFS)
     68else
     69        CFLAGS = $(COMMON_CFLAGS) $(GCC_CFLAGS) $(EXTRA_CFLAGS)
    8470endif
    8571
    8672OBJECTS := $(addsuffix .o,$(basename $(SOURCES)))
     73DEPENDS := $(addsuffix .d,$(basename $(SOURCES)))
    8774
    8875all: $(VERSION_DEF) $(COMMON_MAKEFILE) $(COMMON_HEADER) $(CONFIG_MAKEFILE) $(CONFIG_HEADER) $(BOOT_OUTPUT)
    89         -[ -f $(DEPEND) ] && cp -a $(DEPEND) $(DEPEND_PREV)
    9076
    9177clean:
    9278        rm -f $(RAW) $(MAP) $(ARCH_INCLUDE) $(GENARCH_INCLUDE)
    9379
    94 ifneq ($(MAKECMDGOALS),clean)
    95 -include $(DEPEND)
    96 endif
     80-include $(DEPENDS)
    9781
    9882AS_CFLAGS := $(addprefix -Xassembler ,$(AFLAGS))
     
    10488        $(LD) -n $(LFLAGS) -T $(LINK) -M -Map $(MAP) -o $@ $(OBJECTS)
    10589
    106 $(LINK): $(DEPEND)
     90$(LINK): | depend
    10791        $(CC) $(DEFS) $(CFLAGS) -D__ASM__ -D__LINKER__ -E -x c $(LINK).in | grep -v "^\#" > $(LINK)
    10892
    109 %.o: %.S $(DEPEND)
    110         $(CC) $(DEFS) $(CFLAGS) $(AS_CFLAGS) -D__ASM__ -c $< -o $@
     93%.o: %.S | depend
     94        $(CC) -MD $(DEFS) $(CFLAGS) $(AS_CFLAGS) -D__ASM__ -c $< -o $@
    11195ifeq ($(PRECHECK),y)
    11296        $(JOBFILE) $(JOB) $< $@ as asm/preproc $(DEFS) $(CFLAGS) -D__ASM__
    11397endif
    11498
    115 %.o: %.c $(DEPEND)
    116         $(CC) $(DEFS) $(CFLAGS) -c $< -o $@
     99%.o: %.c | depend
     100        $(CC) -MD $(DEFS) $(CFLAGS) -c $< -o $@
    117101ifeq ($(PRECHECK),y)
    118102        $(JOBFILE) $(JOB) $< $@ cc core $(DEFS) $(CFLAGS)
    119103endif
    120104
    121 %.o: %.s $(DEPEND)
    122         $(CC) $(DEFS) $(CFLAGS) $(AS_CFLAGS) -D__ASM__ -c $< -o $@
     105%.o: %.s | depend
     106        $(CC) -MD $(DEFS) $(CFLAGS) $(AS_CFLAGS) -D__ASM__ -c $< -o $@
    123107ifeq ($(PRECHECK),y)
    124108        $(JOBFILE) $(JOB) $< $@ as asm
    125109endif
    126110
    127 $(DEPEND): $(ARCH_INCLUDE) $(GENARCH_INCLUDE) $(COMMON_HEADER_ARCH) $(PRE_DEPEND)
    128         makedepend -f - -- $(DEPEND_DEFS) $(CFLAGS) -- $(SOURCES) > $@ 2> /dev/null
    129         -[ -f $(DEPEND_PREV) ] && diff -q $(DEPEND_PREV) $@ && mv -f $(DEPEND_PREV) $@
     111depend: $(ARCH_INCLUDE) $(GENARCH_INCLUDE) $(COMMON_HEADER_ARCH) $(PRE_DEPEND)
    130112
    131113$(COMPS).s: $(COMPS).zip
  • boot/Makefile.common

    r31cca4f3 re160bfe8  
    6363GENARCH_INCLUDE = generic/include/genarch
    6464
    65 DEPEND = Makefile.depend
    66 DEPEND_PREV = $(DEPEND).prev
    6765DISTROOT = distroot
    6866INITRD = initrd
  • kernel/Makefile

    r31cca4f3 re160bfe8  
    4949
    5050AGDEPEND = Makefile.ag.depend
    51 DEPEND = Makefile.depend
    52 DEPEND_PREV = $(DEPEND).prev
    5351RAW = kernel.raw
    5452BIN = kernel.bin
     
    6765SIZEOK_MAP = generic/src/debug/sizeok_map.o
    6866
    69 .PHONY: all clean autogen_clean
     67.PHONY: all clean autogen_clean depend
    7068
    7169all: $(VERSION_DEF) $(COMMON_MAKEFILE) $(COMMON_HEADER) $(CONFIG_MAKEFILE) $(CONFIG_HEADER) $(BIN) $(DISASM)
    72         -[ -f $(DEPEND) ] && cp -a $(DEPEND) $(DEPEND_PREV)
    7370
    7471clean: autogen_clean
    75         rm -f $(DEPEND) $(DEPEND_PREV) $(RAW) $(BIN) $(MAP) $(JOB) $(MAP_PREV) $(DISASM) $(DUMP) $(REAL_MAP).* arch/*/_link.ld arch/*/include/arch/common.h
     72        rm -f $(RAW) $(BIN) $(MAP) $(JOB) $(MAP_PREV) $(DISASM) $(DUMP) $(REAL_MAP).* arch/*/_link.ld arch/*/include/arch/common.h
    7673        find generic/src/ arch/*/src/ genarch/src/ test/ -name '*.o' -follow -exec rm '{}' \;
     74        find generic/src/ arch/*/src/ genarch/src/ test/ -name '*.d' -follow -exec rm '{}' \;
    7775
    7876## Common compiler flags
     
    129127-include arch/$(KARCH)/Makefile.inc
    130128-include genarch/Makefile.inc
    131 -include $(DEPEND)
    132129-include $(AGDEPEND)
    133130
     
    152149#
    153150
    154 ifeq ($(COMPILER),gcc_native)
    155         CFLAGS = $(COMMON_CFLAGS) $(GCC_CFLAGS)
    156         DEPEND_DEFS = $(DEFS) $(CONFIG_DEFS)
    157         INSTRUMENTATION = -finstrument-functions
    158 endif
    159 
    160 ifeq ($(COMPILER),gcc_cross)
    161         CFLAGS = $(COMMON_CFLAGS) $(GCC_CFLAGS)
    162         DEPEND_DEFS = $(DEFS) $(CONFIG_DEFS)
    163         INSTRUMENTATION = -finstrument-functions
    164 endif
    165 
    166 ifeq ($(COMPILER),gcc_helenos)
    167         CFLAGS = $(COMMON_CFLAGS) $(GCC_CFLAGS)
    168         DEPEND_DEFS = $(DEFS) $(CONFIG_DEFS)
    169         INSTRUMENTATION = -finstrument-functions
    170 endif
    171 
    172151ifeq ($(COMPILER),clang)
    173152        CFLAGS = $(COMMON_CFLAGS) $(CLANG_CFLAGS)
    174         DEPEND_DEFS = $(DEFS) $(CONFIG_DEFS)
    175         INSTRUMENTATION = -finstrument-functions
    176 endif
    177 
     153else
     154        CFLAGS = $(COMMON_CFLAGS) $(GCC_CFLAGS)
     155endif
     156
     157INSTRUMENTATION = -finstrument-functions
    178158
    179159## Generic kernel sources
     
    364344GENARCH_OBJECTS := $(addsuffix .o,$(basename $(GENARCH_SOURCES)))
    365345
     346GENERIC_DEPENDS := $(addsuffix .d,$(basename $(GENERIC_SOURCES)))
     347ARCH_DEPENDS := $(addsuffix .d,$(basename $(ARCH_SOURCES)))
     348GENARCH_DEPENDS := $(addsuffix .d,$(basename $(GENARCH_SOURCES)))
     349
    366350GENARCH_AUTOGENS_H := $(addsuffix .h,$(basename $(GENARCH_AUTOGENS_AG)))
    367351GENARCH_AUTOGENS_PROBE_C := $(addsuffix .ag.probe.c,$(basename $(GENARCH_AUTOGENS_AG)))
     
    378362LD_CFLAGS := $(addprefix -Xlinker ,$(LFLAGS))
    379363
     364-include $(GENERIC_DEPENDS)
     365-include $(ARCH_DEPENDS)
     366-include $(GENARCH_DEPENDS)
     367
    380368ifeq ($(COMPILER),clang)
    381369        AS_CFLAGS += -mllvm -asm-macro-max-nesting-depth=1000
     
    408396endif
    409397
    410 $(LINK): $(LINK).in $(DEPEND)
     398$(LINK): $(LINK).in | depend
    411399        $(CC) $(DEFS) $(CFLAGS) -D__ASM__ -D__LINKER__ -E -x c $< | grep -v "^\#" > $@
    412400
     
    416404        $(AUTOGEN) generate $< <$<.probe.s >$@   
    417405
    418 %.o: %.S $(DEPEND)
    419         $(CC) $(DEFS) $(CFLAGS) $(AS_CFLAGS) -D__ASM__ -c -o $@ $<
     406%.o: %.S | depend
     407        $(CC) -MD $(DEFS) $(CFLAGS) $(AS_CFLAGS) -D__ASM__ -c -o $@ $<
    420408ifeq ($(PRECHECK),y)
    421409        $(JOBFILE) $(JOB) $< $@ as asm/preproc $(DEFS) $(CFLAGS) -D__ASM__
    422410endif
    423411
    424 %.o: %.s $(DEPEND)
    425         $(CC) $(DEFS) $(CFLAGS) $(AS_CFLAGS) -D__ASM__ -c -o $@ $<
     412%.o: %.s | depend
     413        $(CC) -MD $(DEFS) $(CFLAGS) $(AS_CFLAGS) -D__ASM__ -c -o $@ $<
    426414ifeq ($(PRECHECK),y)
    427415        $(JOBFILE) $(JOB) $< $@ as asm $(DEFS) $(CFLAGS) $(EXTRA_FLAGS)
    428416endif
    429417
    430 %.o: %.c $(DEPEND)
    431         $(CC) $(DEFS) $(CFLAGS) $(EXTRA_FLAGS) $(FPU_NO_CFLAGS) $(if $(findstring $<,$(INSTRUMENTED_SOURCES)),$(INSTRUMENTATION)) -c -o $@ $<
     418%.o: %.c | depend
     419        $(CC) -MD $(DEFS) $(CFLAGS) $(EXTRA_FLAGS) $(FPU_NO_CFLAGS) $(if $(findstring $<,$(INSTRUMENTED_SOURCES)),$(INSTRUMENTATION)) -c -o $@ $<
    432420ifeq ($(PRECHECK),y)
    433421        $(JOBFILE) $(JOB) $< $@ cc core $(DEFS) $(CFLAGS) $(EXTRA_FLAGS) $(FPU_NO_CFLAGS)
     
    470458        done
    471459
    472 $(DEPEND): $(COMMON_HEADER_ARCH) $(AUTOGENS_H)
    473         makedepend -f - -- $(DEPEND_DEFS) $(CFLAGS) -- $(ARCH_SOURCES) $(GENARCH_SOURCES) $(GENERIC_SOURCES) > $@ 2> /dev/null
    474         -[ -f $(DEPEND_PREV) ] && diff -q $(DEPEND_PREV) $@ && mv -f $(DEPEND_PREV) $@
     460depend: $(COMMON_HEADER_ARCH) $(AUTOGENS_H)
    475461
    476462$(COMMON_HEADER_ARCH): $(COMMON_HEADER)
  • tools/autotool.py

    r31cca4f3 re160bfe8  
    4242CONFIG = 'Makefile.config'
    4343MAKEFILE = 'Makefile.common'
    44 HEADER = 'common.h'
     44HEADER = 'common.h.new'
    4545GUARD = 'AUTOTOOL_COMMON_H_'
    4646
     
    850850                check_app(["diff", "--version"], "Diff utility", "usually part of diffutils")
    851851                check_app(["make", "--version"], "Make utility", "preferably GNU Make")
    852                 check_app(["makedepend", "-f", "-"], "Makedepend utility", "usually part of imake or xutils")
    853852                check_app(["unzip"], "unzip utility", "usually part of zip/unzip utilities")
    854853               
  • tools/toolchain.sh

    r31cca4f3 re160bfe8  
    6464GDB_VERSION="7.12.1"
    6565## GDB_PATCHES="toolchain-gdb-7.6.1.patch"
     66ISL_VERSION="0.18"
    6667
    6768BASEDIR="`pwd`"
     
    7071GCC="gcc-${GCC_VERSION}.tar.bz2"
    7172GDB="gdb-${GDB_VERSION}.tar.gz"
     73ISL="isl-${ISL_VERSION}.tar.bz2"
    7274
    7375REAL_INSTALL=true
    7476USE_HELENOS_TARGET=false
     77BUILD_ISL=false
    7578
    7679#
     
    97100       
    98101        if [ "$RC" -ne "0" ] ; then
    99                 echo " ${DEPENDENCY} not found, too old or compiler error."
    100                 echo " Please recheck manually the source file \"${FNAME}.c\"."
    101                 echo " The compilation of the toolchain is probably going to fail,"
    102                 echo " you have been warned."
    103                 echo
    104                 echo " ===== Compiler output ====="
    105                 cat "${FNAME}.log"
    106                 echo " ==========================="
    107                 echo
     102                if [ "${DEPENDENCY}" == "isl" ]; then
     103                        BUILD_ISL=true
     104                       
     105                        echo " isl not found. Will be downloaded and built with GCC."
     106                else
     107                        echo " ${DEPENDENCY} not found, too old or compiler error."
     108                        echo " Please recheck manually the source file \"${FNAME}.c\"."
     109                        echo " The compilation of the toolchain is probably going to fail,"
     110                        echo " you have been warned."
     111                        echo
     112                        echo " ===== Compiler output ====="
     113                        cat "${FNAME}.log"
     114                        echo " ==========================="
     115                        echo
     116                fi
    108117        else
    109118                echo " ${DEPENDENCY} found"
     
    237246        if [ ! -f "${FILE}" ] ; then
    238247                change_title "Downloading ${FILE}"
    239                 wget -c "${SOURCE}${FILE}"
     248                wget -c "${SOURCE}${FILE}" -O "${FILE}".part
    240249                check_error $? "Error downloading ${FILE}."
     250               
     251                mv "${FILE}".part "${FILE}"
    241252        fi
    242253       
     
    350361        GCC_SOURCE="ftp://ftp.gnu.org/gnu/gcc/gcc-${GCC_VERSION}/"
    351362        GDB_SOURCE="ftp://ftp.gnu.org/gnu/gdb/"
     363        ISL_SOURCE="http://isl.gforge.inria.fr/"
    352364       
    353365        download_fetch "${BINUTILS_SOURCE}" "${BINUTILS}" "9e8340c96626b469a603c15c9d843727"
    354366        download_fetch "${GCC_SOURCE}" "${GCC}" "6bf56a2bca9dac9dbbf8e8d1036964a8"
    355367        download_fetch "${GDB_SOURCE}" "${GDB}" "06c8f40521ed65fe36ebc2be29b56942"
     368       
     369        if $BUILD_ISL ; then
     370                download_fetch "${ISL_SOURCE}" "${ISL}" "11436d6b205e516635b666090b94ab32"
     371        fi
    356372}
    357373
     
    423439        BINUTILSDIR="${WORKDIR}/binutils-${BINUTILS_VERSION}"
    424440        GCCDIR="${WORKDIR}/gcc-${GCC_VERSION}"
     441        ISLDIR="${WORKDIR}/isl-${ISL_VERSION}"
    425442        OBJDIR="${WORKDIR}/gcc-obj"
    426443        GDBDIR="${WORKDIR}/gdb-${GDB_VERSION}"
     
    436453        source_check "${BASEDIR}/${GCC}"
    437454        source_check "${BASEDIR}/${GDB}"
     455        if $BUILD_ISL ; then
     456                source_check "${BASEDIR}/${ISL}"
     457        fi
    438458       
    439459        echo ">>> Removing previous content"
     
    451471        unpack_tarball "${BASEDIR}/${GCC}" "GCC"
    452472        unpack_tarball "${BASEDIR}/${GDB}" "GDB"
     473        if $BUILD_ISL ; then
     474                unpack_tarball "${BASEDIR}/${ISL}" "isl"
     475                mv "${ISLDIR}" "${GCCDIR}"/isl
     476        fi
    453477       
    454478        echo ">>> Applying patches"
     
    471495                "--target=${TARGET}" \
    472496                "--prefix=${PREFIX}" "--program-prefix=${TARGET}-" \
    473                 --disable-nls --disable-werror --enable-gold
     497                --disable-nls --disable-werror --enable-gold \
     498                --enable-deterministic-archives
    474499        check_error $? "Error configuring binutils."
    475500       
  • uspace/Makefile.common

    r31cca4f3 re160bfe8  
    100100endif
    101101
    102 DEPEND = Makefile.depend
    103 DEPEND_PREV = $(DEPEND).prev
    104 
    105102LIB_PREFIX = $(USPACE_PREFIX)/lib
    106103
     
    223220endif
    224221
    225 .PHONY: all clean
     222.PHONY: all clean depend
    226223
    227224all: $(VERSION_DEF) $(COMMON_MAKEFILE) $(CONFIG_MAKEFILE) $(CONFIG_HEADER) $(LIBS) $(OUTPUT) $(LOUTPUT) $(EXTRA_OUTPUT)
    228         -[ -f $(DEPEND) ] && cp -a $(DEPEND) $(DEPEND_PREV)
    229225
    230226all-test: $(TEST_OUTPUT) $(TEST_DISASM)
    231227
    232228clean:
    233         rm -f $(DEPEND) $(DEPEND_PREV) $(JOB) $(OUTPUT) $(LARCHIVE) $(LOUTPUT) $(EXTRA_OUTPUT) $(EXTRA_CLEAN)
     229        rm -f $(JOB) $(OUTPUT) $(LARCHIVE) $(LOUTPUT) $(EXTRA_OUTPUT) $(EXTRA_CLEAN)
    234230        find . -name '*.o' -follow -exec rm \{\} \;
    235231        find . -name '*.lo' -follow -exec rm \{\} \;
     232        find . -name '*.d' -follow -exec rm \{\} \;
    236233
    237234COMMON_CFLAGS = $(INCLUDES_FLAGS) -O$(OPTIMIZATION) -imacros $(CONFIG_HEADER) \
     
    276273JOBFILE = $(LIBC_PREFIX)/../../../tools/jobfile.py
    277274
    278 ifeq ($(COMPILER),gcc_cross)
    279         CFLAGS += $(COMMON_CFLAGS) $(GCC_CFLAGS)
    280         DEPEND_DEFS = $(DEFS) $(CONFIG_DEFS)
    281 endif
    282 
    283 ifeq ($(COMPILER),gcc_helenos)
    284         CFLAGS += $(COMMON_CFLAGS) $(GCC_CFLAGS)
    285         DEPEND_DEFS = $(DEFS) $(CONFIG_DEFS)
    286 endif
    287 
    288 ifeq ($(COMPILER),gcc_native)
    289         CFLAGS += $(COMMON_CFLAGS) $(GCC_CFLAGS)
    290         DEPEND_DEFS = $(DEFS) $(CONFIG_DEFS)
    291 endif
    292 
    293275ifeq ($(COMPILER),clang)
    294276        CFLAGS += $(COMMON_CFLAGS) $(CLANG_CFLAGS)
    295         DEPEND_DEFS = $(DEFS) $(CONFIG_DEFS)
     277else
     278        CFLAGS += $(COMMON_CFLAGS) $(GCC_CFLAGS)
    296279endif
    297280
    298281LIB_CFLAGS = $(CFLAGS) -fPIC
    299282LIB_LFLAGS = $(LFLAGS) -shared -soname $(LSONAME) --whole-archive
    300 
    301 ifneq ($(MAKECMDGOALS),clean)
    302 -include $(DEPEND)
    303 endif
    304283
    305284AS_CFLAGS := $(addprefix -Xassembler ,$(AFLAGS))
     
    309288LOBJECTS := $(addsuffix .lo,$(basename $(SOURCES)))
    310289TEST_OBJECTS := $(addsuffix .test.o,$(basename $(TEST_SOURCES)))
     290DEPENDS := $(addsuffix .d,$(basename $(SOURCES))) $(addsuffix .test.d,$(basename $(TEST_SOURCES)))
     291
     292-include $(DEPENDS)
    311293
    312294ifneq ($(BINARY),)
     
    367349endif
    368350
    369 %.o: %.S $(DEPEND)
    370         $(CC) $(DEFS) $(CFLAGS) $(EXTRA_CFLAGS) $(AS_CFLAGS) -D__ASM__ -c $< -o $@
     351%.o: %.S | depend
     352        $(CC) -MD $(DEFS) $(CFLAGS) $(EXTRA_CFLAGS) $(AS_CFLAGS) -D__ASM__ -c $< -o $@
    371353ifeq ($(PRECHECK),y)
    372354        $(JOBFILE) $(JOB) $< $@ as asm/preproc $(DEFS) $(CFLAGS) $(EXTRA_CFLAGS) -D__ASM__
    373355endif
    374356
    375 %.o: %.s $(DEPEND)
    376         $(CC) $(DEFS) $(CFLAGS) $(EXTRA_CFLAGS) $(AS_CFLAGS) -D__ASM__ -c $< -o $@
     357%.o: %.s | depend
     358        $(CC) -MD $(DEFS) $(CFLAGS) $(EXTRA_CFLAGS) $(AS_CFLAGS) -D__ASM__ -c $< -o $@
    377359ifeq ($(PRECHECK),y)
    378360        $(JOBFILE) $(JOB) $< $@ as asm
    379361endif
    380362
    381 %.o: %.c $(DEPEND)
    382         $(CC) $(DEFS) $(CFLAGS) $(EXTRA_CFLAGS) -c $< -o $@
     363%.o: %.c | depend
     364        $(CC) -MD $(DEFS) $(CFLAGS) $(EXTRA_CFLAGS) -c $< -o $@
    383365ifeq ($(PRECHECK),y)
    384366        $(JOBFILE) $(JOB) $< $@ cc core $(DEFS) $(CFLAGS) $(EXTRA_CFLAGS)
    385367endif
    386368
    387 %.test.o: %.c $(DEPEND)
    388         $(CC) $(DEFS) $(CFLAGS) $(EXTRA_CFLAGS) $(TEST_CFLAGS) -c $< -o $@
     369%.test.o: %.c | depend
     370        $(CC) -MD $(DEFS) $(CFLAGS) $(EXTRA_CFLAGS) $(TEST_CFLAGS) -c $< -o $@
    389371ifeq ($(PRECHECK),y)
    390372        $(JOBFILE) $(JOB) $< $@ cc core $(DEFS) $(CFLAGS) $(EXTRA_CFLAGS) $(TEST_CFLAGS)
    391373endif
    392374
    393 %.lo: %.S $(DEPEND)
    394         $(CC) $(DEFS) $(LIB_CFLAGS) $(EXTRA_CFLAGS) $(AS_CFLAGS) -D__ASM__ -c $< -o $@
     375%.lo: %.S | depend
     376        $(CC) -MD $(DEFS) $(LIB_CFLAGS) $(EXTRA_CFLAGS) $(AS_CFLAGS) -D__ASM__ -c $< -o $@
    395377ifeq ($(PRECHECK),y)
    396378        $(JOBFILE) $(JOB) $< $@ as asm/preproc $(DEFS) $(LIB_CFLAGS) $(EXTRA_CFLAGS) -D__ASM__
    397379endif
    398380
    399 %.lo: %.s $(DEPEND)
    400         $(CC) $(DEFS) $(LIB_CFLAGS) $(EXTRA_CFLAGS) $(AS_CFLAGS) -D__ASM__ -c $< -o $@
     381%.lo: %.s | depend
     382        $(CC) -MD $(DEFS) $(LIB_CFLAGS) $(EXTRA_CFLAGS) $(AS_CFLAGS) -D__ASM__ -c $< -o $@
    401383ifeq ($(PRECHECK),y)
    402384        $(JOBFILE) $(JOB) $< $@ as asm
    403385endif
    404386
    405 %.lo: %.c $(DEPEND)
    406         $(CC) $(DEFS) $(LIB_CFLAGS) $(EXTRA_CFLAGS) -c $< -o $@
     387%.lo: %.c | depend
     388        $(CC) -MD $(DEFS) $(LIB_CFLAGS) $(EXTRA_CFLAGS) -c $< -o $@
    407389ifeq ($(PRECHECK),y)
    408390        $(JOBFILE) $(JOB) $< $@ cc core $(DEFS) $(LIB_CFLAGS) $(EXTRA_CFLAGS)
    409391endif
    410392
    411 $(DEPEND): $(PRE_DEPEND)
    412         makedepend -f - -- $(DEPEND_DEFS) $(CFLAGS) $(EXTRA_CFLAGS) -- $(SOURCES) > $@ 2> /dev/null
    413         makedepend -f - -o.test.o -- $(DEPEND_DEFS) $(CFLAGS) $(EXTRA_CFLAGS) $(TEST_CFLAGS) -- $(TEST_SOURCES) >> $@ 2> /dev/null
    414         -[ -f $(DEPEND_PREV) ] && diff -q $(DEPEND_PREV) $@ && mv -f $(DEPEND_PREV) $@
     393depend: $(PRE_DEPEND)
    415394
    416395##
  • uspace/app/devctl/devctl.c

    r31cca4f3 re160bfe8  
    337337}
    338338
     339static int drv_unload(const char *drvname)
     340{
     341        int rc;
     342        devman_handle_t drvh;
     343
     344        rc = devman_driver_get_handle(drvname, &drvh);
     345        if (rc != EOK) {
     346                printf("Failed resolving driver '%s' (%d).\n", drvname, rc);
     347                return rc;
     348        }
     349
     350        rc = devman_driver_unload(drvh);
     351        if (rc != EOK) {
     352                printf("Failed unloading driver '%s' (%d).\n", drvname, rc);
     353                return rc;
     354        }
     355
     356        return EOK;
     357}
     358
    339359static void print_syntax(void)
    340360{
     
    346366        printf("\tdevctl show-drv <driver-name>\n");
    347367        printf("\tdevctl load-drv <driver-name>\n");
     368        printf("\tdevctl unload-drv <driver-name>\n");
    348369}
    349370
     
    412433                if (rc != EOK)
    413434                        return 2;
     435        } else if (str_cmp(argv[1], "unload-drv") == 0) {
     436                if (argc < 3) {
     437                        printf(NAME ": Argument missing.\n");
     438                        print_syntax();
     439                        return 1;
     440                }
     441
     442                rc = drv_unload(argv[2]);
     443                if (rc != EOK)
     444                        return 2;
    414445        } else {
    415446                printf(NAME ": Invalid argument '%s'.\n", argv[1]);
  • uspace/lib/c/generic/devman.c

    r31cca4f3 re160bfe8  
    719719}
    720720
     721int devman_driver_unload(devman_handle_t drvh)
     722{
     723        async_exch_t *exch = devman_exchange_begin(INTERFACE_DDF_CLIENT);
     724        if (exch == NULL)
     725                return ENOMEM;
     726       
     727        int rc = async_req_1_0(exch, DEVMAN_DRIVER_UNLOAD, drvh);
     728       
     729        devman_exchange_end(exch);
     730        return rc;
     731}
     732
    721733/** @}
    722734 */
  • uspace/lib/c/include/devman.h

    r31cca4f3 re160bfe8  
    8282extern int devman_driver_get_state(devman_handle_t, driver_state_t *);
    8383extern int devman_driver_load(devman_handle_t);
     84extern int devman_driver_unload(devman_handle_t);
    8485
    8586#endif
  • uspace/lib/c/include/ipc/devman.h

    r31cca4f3 re160bfe8  
    156156        DRIVER_FUN_ONLINE,
    157157        DRIVER_FUN_OFFLINE,
     158        DRIVER_STOP
    158159} devman_to_driver_t;
    159160
     
    176177        DEVMAN_DRIVER_GET_NAME,
    177178        DEVMAN_DRIVER_GET_STATE,
    178         DEVMAN_DRIVER_LOAD
     179        DEVMAN_DRIVER_LOAD,
     180        DEVMAN_DRIVER_UNLOAD
    179181} client_to_devman_t;
    180182
  • uspace/lib/drv/generic/driver.c

    r31cca4f3 re160bfe8  
    6868FIBRIL_MUTEX_INITIALIZE(functions_mutex);
    6969
     70FIBRIL_RWLOCK_INITIALIZE(stopping_lock);
     71static bool stopping = false;
     72
    7073static ddf_dev_t *create_device(void);
    7174static void delete_device(ddf_dev_t *);
     
    127130        }
    128131       
     132        fibril_rwlock_read_lock(&stopping_lock);
     133
     134        if (stopping) {
     135                fibril_rwlock_read_unlock(&stopping_lock);
     136                async_answer_0(iid, EIO);
     137                return;
     138        }
     139       
    129140        ddf_dev_t *dev = create_device();
    130141        if (!dev) {
     142                fibril_rwlock_read_unlock(&stopping_lock);
    131143                free(dev_name);
    132144                async_answer_0(iid, ENOMEM);
     
    148160       
    149161        if (res != EOK) {
     162                fibril_rwlock_read_unlock(&stopping_lock);
    150163                dev_del_ref(dev);
    151164                async_answer_0(iid, res);
     
    156169        list_append(&dev->link, &devices);
    157170        fibril_mutex_unlock(&devices_mutex);
     171        fibril_rwlock_read_unlock(&stopping_lock);
    158172       
    159173        async_answer_0(iid, res);
     
    282296       
    283297        async_answer_0(iid, (sysarg_t) rc);
     298}
     299
     300static void driver_stop(ipc_callid_t iid, ipc_call_t *icall)
     301{
     302        /* Prevent new devices from being added */
     303        fibril_rwlock_write_lock(&stopping_lock);
     304        stopping = true;
     305
     306        /* Check if there are any devices */
     307        fibril_mutex_lock(&devices_mutex);
     308        if (list_first(&devices) != NULL) {
     309                /* Devices exist, roll back */
     310                fibril_mutex_unlock(&devices_mutex);
     311                stopping = false;
     312                fibril_rwlock_write_unlock(&stopping_lock);
     313                async_answer_0(iid, EBUSY);
     314                return;
     315        }
     316
     317        fibril_rwlock_write_unlock(&stopping_lock);
     318
     319        /* There should be no functions at this point */
     320        fibril_mutex_lock(&functions_mutex);
     321        assert(list_first(&functions) == NULL);
     322        fibril_mutex_unlock(&functions_mutex);
     323
     324        /* Reply with success and terminate */
     325        async_answer_0(iid, EOK);
     326        exit(0);
    284327}
    285328
     
    312355                case DRIVER_FUN_OFFLINE:
    313356                        driver_fun_offline(callid, &call);
     357                        break;
     358                case DRIVER_STOP:
     359                        driver_stop(callid, &call);
    314360                        break;
    315361                default:
  • uspace/srv/devman/client_conn.c

    r31cca4f3 re160bfe8  
    726726}
    727727
     728/** Unload a driver by user request. */
     729static void devman_driver_unload(ipc_callid_t iid, ipc_call_t *icall)
     730{
     731        driver_t *drv;
     732        int rc;
     733       
     734        drv = driver_find(&drivers_list, IPC_GET_ARG1(*icall));
     735        if (drv == NULL) {
     736                async_answer_0(iid, ENOENT);
     737                return;
     738        }
     739       
     740        fibril_mutex_lock(&drv->driver_mutex);
     741        rc = stop_driver(drv);
     742        fibril_mutex_unlock(&drv->driver_mutex);
     743
     744        async_answer_0(iid, rc);
     745}
     746
    728747/** Function for handling connections from a client to the device manager. */
    729748void devman_connection_client(ipc_callid_t iid, ipc_call_t *icall, void *arg)
     
    794813                        devman_driver_load(callid, &call);
    795814                        break;
     815                case DEVMAN_DRIVER_UNLOAD:
     816                        devman_driver_unload(callid, &call);
     817                        break;
    796818                default:
    797819                        async_answer_0(callid, ENOENT);
  • uspace/srv/devman/driver.c

    r31cca4f3 re160bfe8  
    298298        drv->state = DRIVER_STARTING;
    299299        return true;
     300}
     301
     302/** Stop a driver
     303 *
     304 * @param drv           The driver's structure.
     305 * @return              True if the driver's task is successfully spawned, false
     306 *                      otherwise.
     307 */
     308int stop_driver(driver_t *drv)
     309{
     310        async_exch_t *exch;
     311        sysarg_t retval;
     312       
     313        log_msg(LOG_DEFAULT, LVL_DEBUG, "stop_driver(drv=\"%s\")", drv->name);
     314
     315        exch = async_exchange_begin(drv->sess);
     316        retval = async_req_0_0(exch, DRIVER_STOP);
     317        loc_exchange_end(exch);
     318       
     319        if (retval != EOK)
     320                return retval;
     321       
     322        drv->state = DRIVER_NOT_STARTED;
     323        async_hangup(drv->sess);
     324        drv->sess = NULL;
     325        return EOK;
    300326}
    301327
  • uspace/srv/devman/driver.h

    r31cca4f3 re160bfe8  
    5050extern void detach_driver(dev_tree_t *, dev_node_t *);
    5151extern bool start_driver(driver_t *);
     52extern int stop_driver(driver_t *);
    5253extern void add_device(driver_t *, dev_node_t *, dev_tree_t *);
    5354extern int driver_dev_remove(dev_tree_t *, dev_node_t *);
Note: See TracChangeset for help on using the changeset viewer.