The word למען appears frequently in Tanach and in prayers. When in prayers, it usually means "for the sake of". (e.g. עשה למען שמך). However, the meaning in Tanach is less clear:
לֹא תֹאכַל עָלָיו חָמֵץ שִׁבְעַת יָמִים תֹּאכַל עָלָיו מַצּוֹת לֶחֶם עֹנִי כִּי בְחִפָּזוֹן יָצָאתָ מֵאֶרֶץ מִצְרַיִם לְמַעַן תִּזְכֹּר אֶת יוֹם צֵאתְךָ מֵאֶרֶץ מִצְרַיִם כֹּל יְמֵי חַיֶּיךָ (Devarim 16:3)
In this case it seems to mean "in order that" which is similar to the meaning used in prayers.
וְהָיָה בְּשָׁמְעוֹ אֶת דִּבְרֵי הָאָלָה הַזֹּאת וְהִתְבָּרֵךְ בִּלְבָבוֹ לֵאמֹר שָׁלוֹם יִהְיֶה לִּי כִּי בִּשְׁרִרוּת לִבִּי אֵלֵךְ לְמַעַן סְפוֹת הָרָוָה אֶת הַצְּמֵאָה (Devarim 29:19)
Here it makes little sense that he's ignoring the Tochacha "in order to" have his unintentional sins treated seriously (using Rashi's interpretation). Perhaps here it means "thereby" or "resulting in".
כִּי יְדַעְתִּיו לְמַעַן אֲשֶׁר יְצַוֶּה אֶת בָּנָיו וְאֶת בֵּיתוֹ אַחֲרָיו וְשָׁמְרוּ דֶּרֶךְ ה' לַעֲשׂוֹת צְדָקָה וּמִשְׁפָּט לְמַעַן הָבִיא ה' עַל אַבְרָהָם אֵת אֲשֶׁר דִּבֶּר עָלָיו (Bereishit 18:19)
With regard to the first למען, Hashem knows Avraham, "thereby" or "in order that" Avraham will command his sons to be righteous? Neither alternative seems logical. Maybe here it means "because".
For the second למען, it might mean "therefore", similar to the usage in the verse in Devarim 16:3.
Thus, my question is: Does למען actually have a specific meaning? Or is it a multipurpose word, so that it can mean anything to fit the context?