[m-users.] Pass options to gcc compiler
Sean Charles (emacstheviking)
objitsu at gmail.com
Thu Nov 17 07:26:00 AEDT 2022
Hi,
For the first time tonight I've tried building an SDL2 project that used to build but never before on my M1.
➜ gfx git:(master) ✗ make
mmc -s hlc.gc -O4 -lsdl2 `pkg-config --libs sdl2` -lSDL2_mixer -lSDL2_image -lSDL2_ttf --make main
Making Mercury/int3s/main.int3
Making Mercury/int3s/sdl2.int3
Making Mercury/int3s/sdl2_ttf.int3
Making Mercury/ints/main.int
Making Mercury/ints/sdl2.int
Making Mercury/ints/sdl2_ttf.int
Making Mercury/cs/main.c
Making Mercury/cs/sdl2.c
Making Mercury/cs/sdl2_ttf.c
Making Mercury/os/main.o
In file included from Mercury/cs/main.c:49:
./Mercury/mihs/sdl2.mih:36:10: fatal error: 'SDL.h' file not found
#include <SDL.h>
^~~~~~~
1 error generated.
** Error making `Mercury/os/main.o'.
make: *** [main] Error 1
the Mercury pragma:
:- pragma foreign_decl("C", "#include <SDL.h>").
From the command line, when I run pkg-config it shows:
➜ gfx git:(master) ✗ pkg-config --cflags sdl2
-D_THREAD_SAFE -I/opt/homebrew/include -I/opt/homebrew/include/SDL2
➜ gfx git:(master) ✗ pkg-config --libs sdl2
-L/opt/homebrew/lib -lSDL2
And I know the file exists and is readable:
➜ gfx git:(master) ✗ ls -l /opt/homebrew/include/SDL2/SDL.h
-rw-r--r-- 1 seancharles admin 8084 5 Oct 00:48 /opt/homebrew/include/SDL2/SDL.h
And finally, the makefile:
BIN=agame
DEPS=agame.m
FILES=$(patsubst %.m,%,$(DEPS))
GENEXT=d,o,mh,err,c,c_date,mh,mih
GRADE=hlc.gc
SDL2_FLAGS=`pkg-config --cflags sdl2`
SDL2_LFLAGS=`pkg-config --libs sdl2`
FLAGS=-s $(GRADE) -O4 -E -lsdl2 $(SDL_FLAGS) $(SDL2_LFLAGS)
all:: $(BIN)
install:: $(BIN)
mv -f -v $(BIN) $(HOME)/bin/
%: %.m $(DEPS)
mmc $(FLAGS) --make $@
$(BIN): $(DEPS)
mmc $(FLAGS) --make $(BIN)
mv -fv $(BIN) $(BIN)
clean::
rm -rf Mercury
rm -fv $$(for x in $(FILES); do echo $$x.{$(GENEXT)}; done)
rm -fv $(BIN)
Is there a way to ask the compiler to show what include paths it has when compiling the generated C code ?
Thanks,
Sean
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mercurylang.org/archives/users/attachments/20221116/02bd20e4/attachment.html>
More information about the users
mailing list