-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove default petsc path in the Makefile and istallation #55
Conversation
- Remove the default path for pests a t ~ - Add instruction to add a symlinks of mpirun - Add instruction to create an env variable for PETSC_DIR before build Mandyoc
@victorsacek and @rafaelmds. |
Co-authored-by: Rafael Silva <rafaelmds@users.noreply.github.com>
Co-authored-by: Rafael Silva <rafaelmds@users.noreply.github.com>
@aguspesce, here some suggestions for Makefile file after some testing:
It's working fine on my environment (with either PETSC_ARCH set or unset). I found it easier to attach a patch (instead of using the github suggestion), so you can apply and test it as well. diff --git a/Makefile b/Makefile
index e415590..37ab8e1 100644
--- a/Makefile
+++ b/Makefile
@@ -1,3 +1,7 @@
+ifndef PETSC_DIR
+$(error PETSC_DIR environment variable is not set. Please, set/export it before continue.)
+endif
+
include ${PETSC_DIR}/lib/petsc/conf/variables
include ${PETSC_DIR}/lib/petsc/conf/rules
@@ -23,25 +27,25 @@ BIN_DIR = bin
MANDYOC = $(BIN_DIR)/mandyoc
LOCAL_BIN = $(HOME)/.local/bin
-.PHONY: help all install clear test
+.PHONY: help all install clear clean test
help:
@echo ""
@echo "Commands:"
@echo ""
- @echo " all Build Mandyoc"
+ @echo " all Build Mandyoc."
@echo " install Install MANDYOC in ~/.local/bin/"
@echo " test Run the MANDYOC tests using 1 core. It takes several minutes."
- @echo " clear Removes the files produced when building MANDYOC"
+ @echo " clear Removes the files produced when building MANDYOC."
@echo ""
all: $(MANDYOC)
@echo ""
@echo "Mandyoc built in bin/"
-install: $(MANDYOC)
+install: $(MANDYOC) | $(LOCAL_BIN)
@echo ""
- install $< $(LOCAL_BIN)
+ install $< $(LOCAL_BIN)/mandyoc
test:
@echo "Run MANDYOC test may take several minutes..."
@@ -49,14 +53,16 @@ test:
pytest -v test/testing_result.py
clear:
- rm $(SRC)/*.o
+ rm -f $(SRC)/*.o
rm -rf $(BIN_DIR)
+clean:: clear
+
%.o: %.cpp
${PCC} -Wall -fdiagnostics-color -c $< -o $@ ${INCFLAGS}
-$(BIN_DIR):
- mkdir $@
+$(BIN_DIR) $(LOCAL_BIN):
+ mkdir -p $@
$(MANDYOC): ${OBJECTS} | $(BIN_DIR)
-${CLINKER} -o $@ ${OBJECTS} ${PETSC_LIB}
|
…mes for directories
@rafaelmds I added your suggestion and improve the names of the directory variables:
But I didn't add this line:
Because it is not correct for Makefile to create a folder on the user's system. If the user doesn't have the |
I agree @aguspesce, best not to automatically/programmactically create that folder.
If user doesn't have ~/.local/bin dir, this is the error: make: *** No rule to make target '/home/rafael/.local/bin', needed by 'install'. Stop. This is because $(BINDIR) appears in rule requirements: install: $(MANDYOC) | $(BINDIR) If we remove $(BINDIR), I think the error points better to the problem: install bin/mandyoc /home/rafael/.local/bin/mandyoc
install: cannot create regular file '/home/rafael/.local/bin/mandyoc': No such file or directory
make: *** [Makefile:47: install] Error 1 |
Ok @rafaelmds! Now I understand the situation. I will remove BINDIR as a requirement, so the code will be:
|
I noticed there is no entry for |
@jamisonassuncao We are almost ready with this new Makefile. Could you test on macos and give your feedback? |
I tested on macos as well, and just have the "problem" with I suggest the following modification to print a message to the user to create the folder.
|
Add a note about the ~/.local/bin folder Co-authored-by: Rafael Silva <rafaelmds@users.noreply.github.com>
I understand the problem, but create the founder is not the solution because you need to add it to the PATH.
|
Thats fine! |
I think we can merge, right? @aguspesce |
@rafaelmds, I think that it is ok! |
In the Makefile and installation instruction, I removed the default path to $HOME/petsc.