Trouble getting SDL2 to compile on m1 mac SOLVED:

Hello,
I am new to SDL and c programming. I was wondering if anyone can provide a link or source for setting up/ installing SDL2 on an m1 mac? I have not been able to find a guide that details the steps for getting it working on apple silicon.
I have tried installing through homebrew both through rosetta and natively and have followed the build from source instructions described on the SDL installation page.
When i try to compile from the command line using gcc/clang i get an error:

❯ make
gcc -Wall -std=c99 ./src/*.c -lSDL2 -lm -o renderer
ld: library not found for -lSDL2
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [build] Error 1

I do have it working well on an older dell laptop running Debian.

Thanks in advance.

How did you manage to solve this? I have the same problem!

Appreciate any insight.

Thanks in advance

You can tell the compiler where the library is installed on your machine by manually locating it and using the -L or -I compiler option flags to add the directory as a search path, or you can use sdl2-config to automatically add the necessary compiler flags:

On the command line:
$ gcc [your_sourcefile.c] -o [executable_name] $(sdl2-config --libs --cflags)

In a Makefile:
gcc [your_sourcefile.c] -o [executable_name] `sdl2-config --libs --cflags`