1CC = gcc
2AR=ar rc
3RANLIB=ranlib
4
5prefix=c:/dev
6bin_dir=$(prefix)/bin
7include_dir=$(prefix)/include
8lib_dir=$(prefix)/lib
9
10CFLAGS = -O3 -march=athlon-xp -mmmx -msse -m3dnow -DBUILD_DLL -DWIN32 -I$(include_dir)/SDL
11LIBS = -L$(lib_dir) -lSDL
12
13OBJS = SDL_framerate.o SDL_gfxPrimitives.o SDL_imageFilter.o SDL_rotozoom.o
14
15STATIC_LIB=libSDL_gfx.a
16IMPORT_LIB=libSDL_gfx.dll.a
17SHARED_LIB=SDL_gfx.dll
18
19all: $(STATIC_LIB) $(SHARED_LIB)
20
21$(STATIC_LIB): $(OBJS)
22	$(AR) $@ $^
23	$(RANLIB) $@
24
25$(SHARED_LIB): $(OBJS)
26	gcc -s -shared -o $@ $^ -Wl,--enable-auto-import,--export-all -Wl,--out-implib=$(IMPORT_LIB) $(LIBS)
27
28test: $(SHARED_LIB) $(STATIC_LIB) Test/TestFramerate.exe Test/TestFonts.exe Test/TestGfxPrimitives.exe Test/TestImageFilter.exe Test/TestRotozoom.exe
29
30Test/TestFramerate.exe: Test/TestFramerate.c
31	gcc -c $^ -o Test/TestFramerate.o -O3 -march=athlon-xp -mmmx -msse -m3dnow -DWIN32 -Ic:/dev/local/include/SDL
32	gcc -o $@ Test/TestFramerate.o $(CFLAGS) -L../ -Lc:/dev/local/lib -lmingw32 -lSDLmain $(SHARED_LIB) -lSDL
33
34Test/TestFonts.exe: Test/TestFonts.c
35	gcc -c $^ -o Test/TestFonts.o -O3 -march=athlon-xp -mmmx -msse -m3dnow -DWIN32 -Ic:/dev/local/include/SDL
36	gcc -o $@ Test/TestFonts.o $(CFLAGS) -L../ -Lc:/dev/local/lib -lmingw32 -lSDLmain $(SHARED_LIB) -lSDL
37
38Test/TestGfxPrimitives.exe: Test/TestGfxPrimitives.c
39	gcc -c $^ -o Test/TestGfxPrimitives.o -O3 -march=athlon-xp -mmmx -msse -m3dnow -DWIN32 -Ic:/dev/local/include/SDL
40	gcc -o $@ Test/TestGfxPrimitives.o $(CFLAGS) -L../ -Lc:/dev/local/lib -lmingw32 -lSDLmain $(SHARED_LIB) -lSDL
41
42Test/TestImageFilter.exe: Test/TestImageFilter.c
43	gcc -c $^ -o Test/TestImageFilter.o -O3 -march=athlon-xp -mmmx -msse -m3dnow -DWIN32 -Ic:/dev/local/include/SDL
44	gcc -o $@ Test/TestImageFilter.o $(CFLAGS) -L../ -Lc:/dev/local/lib -lmingw32 -lSDLmain $(SHARED_LIB) -lSDL
45
46Test/TestRotozoom.exe: Test/TestRotozoom.c
47	gcc -c $^ -o Test/TestRotozoom.o -O3 -march=athlon-xp -mmmx -msse -m3dnow -DWIN32 -Ic:/dev/local/include/SDL
48	gcc -o $@ Test/TestRotozoom.o $(CFLAGS) -L../ -Lc:/dev/local/lib -lmingw32 -lSDLmain $(SHARED_LIB) -lSDL
49
50install: $(STATIC_LIB) $(SHARED_LIB)
51	cp $(STATIC_LIB) $(SHARED_LIB) $(IMPORT_LIB) $(lib_dir)
52	cp SDL_framerate.h SDL_gfxPrimitives.h SDL_imageFilter.h SDL_rotozoom.h $(include_dir)/SDL
53
54uninstall:
55	rm -f $(lib_dir)/$(STATIC_LIB)
56	rm -f $(lib_dir)/$(SHARED_LIB)
57	rm -f $(lib_dir)/$(IMPORT_LIB)
58	rm -f $(include_dir)/SDL/SDL_framerate.h
59	rm -f $(include_dir)/SDL/SDL_gfxPrimitives.h
60	rm -f $(include_dir)/SDL/SDL_imageFilter.h
61	rm -f $(include_dir)/SDL/SDL_rotozoom.h
62
63clean:
64	rm -f *.o *.a *.dll
65	rm -f Test/*.o Test/*.exe
66