temp solved a new pbm with the makefile and env var

This commit is contained in:
asus
2023-09-12 12:11:54 +02:00
parent 9b9c3c1357
commit ae8a2431dc
2 changed files with 17 additions and 4 deletions

View File

@@ -37,7 +37,9 @@ COMPOSE = ./srcs/docker-compose.yml
# - in sudo mode its value is the user (same as $USER in normal mode)
# - ~$SUDO_USER :
# - in linux "~USER" print the home directory of a user
USER_HOME := $(shell echo ~$$SUDO_USER)
# https://stackoverflow.com/questions/77088135/makefile-subst-doesnt-use-make-variable-as-expected
#USER_HOME := $(shell echo ~$$SUDO_USER)
USER_HOME := $(shell eval echo "~$$SUDO_USER")
# extract env variables in .env file
# then expend the home path
# then expend the pwd path
@@ -46,6 +48,8 @@ EXPENDED_ENV_VAR := $(shell grep "^#EXPEND_" ./srcs/.env)
EXPENDED_ENV_VAR := $(subst $$HOME_PATH,$(USER_HOME),$(EXPENDED_ENV_VAR))
EXPENDED_ENV_VAR := $(subst $$PWD_PATH,$(shell pwd),$(EXPENDED_ENV_VAR))
EXPENDED_ENV_VAR := $(EXPENDED_ENV_VAR:#EXPEND_%=%)
TESTVAR := $(subst $$HOME_PATH,$(USER_HOME),"$$HOME_PATH/project/dir")
TESTVAR := $(USER_HOME)/project/dir
# this creates a list of the path from the list of the variables :
# VAR_1=/path/to_1 VAR_2=/path/to_2
@@ -74,7 +78,16 @@ VOLUMES = $(shell docker volume ls -q)
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - #
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - #
all: require build up
#all: require build up
all: testt
testt:
@echo $(B_YELLOW)"user home:"$(RESET)
@echo $(USER_HOME)
@echo $(B_YELLOW)"expended env var:"$(RESET)
@echo $(EXPENDED_ENV_VAR)
@echo $(B_YELLOW)"test var:"$(RESET)
@echo $(TESTVAR)
require:
# remove all the lines starting with "HOST_VOLUME_" in .env