M
M
Midzakikayo2022-02-15 14:08:35
linux
Midzakikayo, 2022-02-15 14:08:35

What is the correct way to compare strings in a Makefile?

Good afternoon! Please help! I am doing a study project. According to the assignment, I have to write a program that works with the minilibx library under MacOS. Unfortunately MacOS is not available... and development has to be done on Linux.
But in order to run a project, you need to be able to run it on MacOS by making it portable to another platform. As a solution for myself, I chose to load the necessary libraries at the build stage using the Makefile, but I ran into a system identification problem. It seems to be nothing complicated to describe if else fi. But as it turned out, not everything is so simple ...
using the code:

<br>
OSname = $(uname)<br>
if [ "${OSname}" = "Linux" ] ; then<br>
  MLX_DIR = minilibx-linux<br>
  DEFINE = include/init_mlx/linux/define.h<br>
  KEYSET = key_map/key_linux/key.c<br>
  GETLIB = git clone библиоткеа.git<br>
  MAPS = wget maps.zip<br>
  MLX = libmlx_Linux.a<br>
  MLX_FLAGS = -lXext -lX11 -lm<br>
else<br>
  MLX_DIR = minilibx_macos<br>
  MLX = libmlx.a<br>
  DEFINE = include/init_mlx/macos/define.h<br>
  KEYSET = key_map/key_mac/key.c<br>
  GETLIB = curl -O библиотека.tgz && tar -xf библиотека.tgz<br>
  MAPS = curl -O maps.zip<br>
  MLX_FLAGS = -g -L -l mlx -framework OpenGL -framework AppKit -lm<br>
fi<br>


I'm running into an error: Makefile:2: *** missing separator. stop. Which indicates the line of code : Please help me solve the issue please! What is the error and where is the separator missing?
if [ "${OSname}" = "Linux" ] ; then

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question