include src/parts/Makefile-part
include src/sdlvf/Makefile-part
+
obj = $(src:.cpp=.o) $(csrc:.c=.o)
opt = -O1
opt = -g
-CXXFLAGS = -ansi -pedantic -Wall $(opt) -Isrc/3dengfx/src `src/3dengfx/3dengfx-config --cflags`
-CFLAGS = -std=c89 -pedantic -Wall $(opt) `src/3dengfx/3dengfx-config --cflags`
-libs = src/3dengfx/lib3dengfx.a `src/3dengfx/3dengfx-config --libs-no-3dengfx` -lGL -lvorbisfile
+incdir = -Isrc/3dengfx/src -Ilibs -Ilibs/png -Ilibs/jpeglib -Ilibs/ogg -Ilibs/vorbis
+CXXFLAGS = -ansi -pedantic -Wall $(opt) $(incdir) -MMD `sdl-config --cflags`
+CFLAGS = -std=c89 -pedantic -Wall $(opt) $(incdir) -MMD `sdl-config --cflags`
+libs = -Llibs src/3dengfx/lib3dengfx.a `sdl-config --libs` -lGL -lvorbis -logg \
+ -ljpeg -lpng -lz -l3ds
-$(bin): $(obj) src/3dengfx/lib3dengfx.a data/tex_list
+$(bin): $(obj) 3dengfx libs
$(CXX) -o $@ $(obj) $(libs)
-src/3dengfx/lib3dengfx.a:
- cd src/3dengfx;\
- ./configure --with-gfxlib=sdl --disable-ft --enable-opt --disable-debug && make
+.PHONY: 3dengfx
+3dengfx:
+ $(MAKE) -C src/3dengfx
-data/tex_list: $(src)
- tools/find_textures >$@
+.PHONY: 3dengfx-clean
+3dengfx-clean:
+ $(MAKE) -C src/3dengfx clean
-include $(obj:.o=.d)
-%.d: %.cpp
- @set -e; rm -f $@; $(CXX) -MM $(CXXFLAGS) $< > $@.$$$$; \
- sed 's,\($*\)\.o[ :]*,\1.o $@ : ,g' < $@.$$$$ > $@; rm -f $@.$$$$
-
-%.d: %.c
- @set -e; rm -f $@; $(CC) -MM $(CFLAGS) $< > $@.$$$$; \
- sed 's,\($*\)\.o[ :]*,\1.o $@ : ,g' < $@.$$$$ > $@; rm -f $@.$$$$
-
.PHONY: clean
clean:
$(RM) $(obj) $(bin)
+.PHONY: clean-all
+clean-all: clean 3dengfx-clean cleandep clean-libs
+
.PHONY: cleandep
cleandep:
- find src \( -name '*.d' -o -name '*.d.*' \) -exec $(RM) '{}' ';'
+ $(RM) $(obj:.o=.d)
+
+.PHONY: libs
+libs:
+ $(MAKE) -C libs
+
+.PHONY: clean-libs
+clean-libs:
+ $(MAKE) -C libs clean