First of all, there is no Yahweh in the Ugarit texts -- only yw in one damaged passage that occurs as an epithet of Yamm when he is conferred divine kingship, and this appears to be linguistically unrelated to the yhw, yh, or yhwh of the Hebrew Bible and inscriptions which is best explained as an imperfect causative of hyh "to be". Yamm, Leviathan, and Rahab appear in the Hebrew Bible as the dragons or chaos monsters that Yahweh defeated either as part of the creation of the cosmos or as the means through which Yahweh demonstrated his divine kingship.
The original Canaanite mythology had no Yahweh, or least had no deity that bore "Yahweh" as a title or epithet; basically the main figures were El (the creator god, the aged father of the pantheon), Asherah (the wife of El, the mother of the gods), Dagon (a deity of uncertain origin, the father of Baal), Baal-Hadad (a young god of the storm and rain, who was given divine kingship after vanquishing his enemy Yamm, and adopted as a "son of El"), Athtart/Ashtoreth (the consort of Baal, goddess of irrigation and fertility, she was originally the wife of Athtar but she joined Baal when Athtar lost his kingship), Anat (the other companion of Baal, originally a consort of El, and the goddess of war and hunting; she was possibly the sister of Athtart), and Horon (one of the gods of the underworld, responsible for healing). All these gods had temples and shrines throughout Israel; cf. Beth-El (Genesis 28:19), Beth-Dagon (Joshua 15:41), Ashteroth-Karnaim and the "shrines for Ashtoreth" (Genesis 14:5; 2 Kings 23:13), Beth-Horon (Joshua 10:10). El, under various epithets like El-Shaddai, El-Elyon, El-Olam, etc., was the dominant deity associated with the patriarchs in Genesis and so forth. Yahweh per se was an Israelite-Judahite innovation, but one which surely built on earlier Canaanite models.
The main problem is...who was Yahweh originally? Was this first an epithet of El who was later conflated with Baal, or was Yahweh originally a name for Baal who later merged with El? Frank Moore Cross takes the first position and believes that Yahweh took on Baalistic character during the United Monarchy, when the theme of divine kingship became a central issue. He also points out that the name itself suggests creation, which fits El far better than Baal. The fact that Asherah appears as a consort of Yahweh also indicates that at one point Yahweh was equated with El. Mark Smith takes something close to the second position and regards the conflation of Yahweh and Baal to be earliest. Certainly, in most of the oldest poetic and literary material in the OT, Yahweh is described in terms that are precisely that of Baal -- as a storm god. Psalm 29, for instance, is clearly a Baal poem that has been reworked into a Yahweh poem (the meter and alliteration even works better by replacing Yahweh with Baal). All of this, if one choses to believe in the historicity of the United Kingdom and its close relations with Phoenicia, could be explained as a result of a "revival" of the Baal cult under a royal ideology that did not exist previously. On the other hand, there are also texts (such as Deuteronomy 32:8-9) that appear to describe Yahweh as subordinate to El, and as the god who chose Israel as the people he would rule as king over. Then there is the very late vision of the divine assembly in Daniel 7, which distinguishes between the aged "Ancient of Days" on the throne and subordinate to him, the "one like a son of man" who walks on the clouds of heaven (precisely the language used of Yahweh in the OT and Baal in Canaanite mythology). The relationship between the Father and the Son in Christian theology (the latter who has kingship at the consent of the Father, and who dies and is raised from the dead like Baal) is also possibly derivative of this distinction.
What is clear, however, that Canaanite and Israelite polytheism gave way to monolatry during the reforms of the prophets and Yahwistic kings, and in the process Yahweh absorbed traits of other deities to himself as hypostases. Much of grim, bloody war language in the OT that is attributed to Yahweh (e.g. smashing skulls, heaping corpses in the "Day of Yahweh", etc.) is straight out of Canaanite descriptions of Anat. Asherah was also abstractized into a semi-feminine personified Wisdom (cf. Proverbs 8-9), which became an aspect of Yahweh, or as the semi-feminine "face" or "presence of Yahweh" (cf. Tannit/Asherah who was the "face" of El in Punic mythology, and the feminine Shekinah in medieval Qabbala, which represents a very late survival of this notion). The late Jewish and Christian version of this is the concept of the Holy Spirit. The other gods were basically forgotten, turned into angels or demons, or merged with Yahweh. The monolatry of the century or two before the destruction of Jerusalem then matured into full-blown monotheism during the Persian period -- particularly in the face of Persian dualism.