summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile34
1 files changed, 19 insertions, 15 deletions
diff --git a/Makefile b/Makefile
index 903b7e9..f6d01c7 100644
--- a/Makefile
+++ b/Makefile
@@ -1,22 +1,26 @@
-SDL_HEADERS=/usr/include/SDL2
+name=core
-#CFLAGS=-g -Wall -fsanitize=undefined -fsanitize=address -I$(SDL_HEADERS)
-CFLAGS=-g -Wall -I$(SDL_HEADERS)
-#LFLAGS=-lSDL2 -fsanitize=undefined -fsanitize=address
-LFLAGS=-lSDL2 -lm
+CFLAGS= -g \
+ $(shell pkg-config --cflags sdl3) \
+ $(pkg-config --cflags sdl3-ttf)
-core: core.o procfs.o memview.o
- $(CC) -o $@ $^ $(LFLAGS)
+LDFLAGS= \
+ $(shell pkg-config --libs sdl3) \
+ $(shell pkg-config --libs sdl3-ttf)
-core.c: procfs.h memview.h
-memview.c: procfs.h memview.h
-procfs.c: procfs.h
+srcs=$(shell find src -name '*.c')
+objs=$(srcs:%.c=build/%.o)
+deps=$(objs:.o=.d)
-evilize: evilize.o
+./build/$(name): $(objs)
+ $(CC) $(objs) -o $@ $(LDFLAGS)
-.SUFFIXES: .c .o
-.c.o:
- $(CC) $(CFLAGS) -c -o $@ $<
+./build/%.o: %.c
+ mkdir -p $(dir $@)
+ $(CC) $(CFLAGS) -MMD -MP -c $< -o $@
+.PHONY: clean
clean:
- rm -f *.o core
+ rm -rf build
+
+-include $(deps)