Added .gitignore
[gfxprim.git] / targets / sdl / Makefile
blob6c088f8c232ad5db4e6cc285a292be330ca8e7d2
1 LIBRARY=libGP_SDL
3 HEADERS=GP_SDL.h \
4 GP_SDL_Context.h \
5 GP_SDL_VideoInit.h
7 EXTRA_DEPS=
9 OBJECTS=GP_SDL_Context.o \
10 GP_SDL_VideoInit.o
12 .PHONY: library tests clean tar install
14 all: library tests
16 library: $(LIBRARY)
18 tests:
19 cd tests && $(MAKE) all
21 $(LIBRARY): $(LIBRARY).a $(LIBRARY).so
23 $(OBJECTS): GP_SDL.h
25 #############################################################################
26 # Building rules.
27 #############################################################################
29 CFLAGS=-W -Wall -O2 -fPIC -I../.. -I../../core
31 %.o: %.c $(HEADERS)
32 $(CC) $(CFLAGS) $< -c -o $@
34 $(LIBRARY).a: $(OBJECTS) $(EXTRA_DEPS)
35 ar crus $@ $^
37 $(LIBRARY).so: $(OBJECTS) $(EXTRA_DEPS)
38 $(CC) -fPIC -dPIC --shared -Wl,-soname -Wl,$@.0 $(CFLAGS) $^ -o $@
39 ln -sf $@ $@.0
41 #############################################################################
42 # Installation, cleanup, and packing.
43 #############################################################################
45 HEADER_LOC=/usr/include/
46 LIB_LOC=/usr/lib/
48 install:
49 install -m 775 -d $(HEADER_LOC)GP/
50 install -m 664 *.h $(HEADER_LOC)GP/
51 install -m 775 -d $(HEADER_LOC)GP/backends/
52 install -m 664 backends/*.h $(HEADER_LOC)GP/backends/
53 install -m 664 *.so *.so.0 *.a $(LIB_LOC)
55 clean:
56 rm -f $(OBJECTS)
57 rm -f $(LIBRARY).a $(LIBRARY).so $(LIBRARY).so.0
58 cd tests && $(MAKE) clean
60 tar: clean
61 cd .. && tar cjf gfxprim-`date +%Y-%b-%d`.tar.bz2 gfxprim