I use two different OS.
- for MacOS: open the .pdf file (it opens pdf in the default PDF program on Mac)
- for Linux: xdg-open file.pdf (this is done on Linux)
If I change the command, this does not work. Is there any one set of commands, for example:
- open .pdf file or xdg-open file.pdf
I want the team (or teams) to work for both of them without any error. The place where I need this command is in the make file.
I have a make file like this:
all:
open file.pdf
xdg-open file.pdf
other things ..
Here, inside the makefile, how can I be sure that command execution is executed without error on both Mac and Linux?
Thanks to @rubiks, now the code works fine. The code is as follows:
UNAME_S := $(shell uname -s)
$(info $$UNAME_S == $(UNAME_S))
ifeq ($(UNAME_S),Linux)
PDFVIEWER := xdg-open
else ifeq ($(UNAME_S),Darwin)
PDFVIEWER := open
else
$(error unsupported system: $(UNAME_S))
endif
$(info $$PDFVIEWER == $(PDFVIEWER))
default: all
$(PDFVIEWER) my_pdf_filename.pdf