diff options
author | quou <quou@disroot.org> | 2024-07-13 23:46:14 +1000 |
---|---|---|
committer | quou <quou@disroot.org> | 2024-07-13 23:46:31 +1000 |
commit | d7160d62b5d78e9191b4d61d7f491deb728cb478 (patch) | |
tree | 0bbb087df0fa32b2e47f00d8fc602f4921eec5a7 /Makefile | |
parent | a43eb70ebe7844db0a4ffece47c22ae12384781b (diff) |
Model loading and basic lighting.
Diffstat (limited to 'Makefile')
-rw-r--r-- | Makefile | 42 |
1 files changed, 40 insertions, 2 deletions
@@ -1,22 +1,37 @@ compiler = gcc +tool_compiler = gcc linker = gcc cflags = -I./ -g -DDEBUG -Dplat_x11 -Dplat_x86 \ -Dplat_posix -Dallocation_default_alignment=8 \ -Wall -Wextra -pedantic -std=c90 lflags = -lX11 +int_dir = intermediate +data_dir = data target = 3de +convmesh = convmesh +packassets = packassets +pack = pack sources = \ 3de.c \ + asset.c \ maths.c \ memory.c \ plat.c \ rect.c \ - render.c + render.c \ + standard.c objects = $(sources:%.c=%.o) -all: $(target) +mesh_sources = \ + $(int_dir)/monkey.obj \ + $(int_dir)/cube.obj + +meshes = $(mesh_sources:$(int_dir)/%.obj=$(data_dir)/%.msh) +assets = $(meshes) + +all: $(target) $(pack) $(objects): %.o : %.c $(compiler) -MMD -MF $(basename $@).d $(cflags) -o $@ -c $< @@ -24,7 +39,30 @@ $(objects): %.o : %.c $(target): $(objects) $(linker) $(objects) -o $@ $(lflags) +$(meshes): $(data_dir)/%.msh : $(int_dir)/%.obj | $(convmesh) $(data_dir) + ./$(convmesh) $< $@ + +$(convassets): convassets.c + $(tool_compiler) $(cflags) -o $@ $< + +$(convmesh): convmesh.c + $(tool_compiler) $(cflags) -o $@ $< + +$(packassets): packassets.c + $(tool_compiler) packassets.c $(cflags) -o $@ + +$(pack): $(packassets) $(meshes) + ./$(packassets) \ + $(data_dir) \ + $(notdir $(meshes)) + +$(data_dir): + mkdir -p $(data_dir) + clean: + rm -f $(packassets) + rm -f $(convmesh) + rm -rf data rm *.d rm *.o rm $(target) |