]> git.cworth.org Git - glaze/blob - Makefile
Add a new libglaze library
[glaze] / Makefile
1 all:
2
3 # Get settings from the output of configure by running it to generate
4 # Makefile.config if it doesn't exist yet.
5
6 # If Makefile.config doesn't exist, then srcdir won't be
7 # set. Conditionally set it (assuming a plain srcdir build) so that
8 # the rule to generate Makefile.config can actually work.
9 srcdir ?= .
10
11 include Makefile.config
12 Makefile.config: $(srcdir)/configure
13 ifeq ($(configure_options),)
14         @echo ""
15         @echo "Note: Calling ./configure with no command-line arguments. This is often fine,"
16         @echo "      but if you want to specify any arguments (such as an alternate prefix"
17         @echo "      into which to install), call ./configure explicitly and then make again."
18         @echo "      See \"./configure --help\" for more details."
19         @echo ""
20 endif
21         $(srcdir)/configure $(configure_options)
22
23 LIBGLAZE_LINKER_NAME = libglaze.so
24 LIBGLAZE_SONAME = $(LIBGLAZE_LINKER_NAME).$(MAJOR)
25 LIBGLAZE_LIBNAME = $(LIBGLAZE_SONAME).$(MINOR).$(RELEASE)
26
27 TARGETS = $(LIBGLAZE_LIBNAME) lib64/libGL.so.1 lib32/libGL.so.1
28
29 all: $(TARGETS)
30
31 $(LIBGLAZE_LIBNAME): glaze.c
32         $(CC) $(CFLAGS) -fPIC -shared -Wl,-Bsymbolic,-soname=$(LIBGLAZE_SONAME) -o $@ $<
33
34 lib64/libGL.so.1: glaze-gl.c glapi.def
35         mkdir -p lib64
36         $(CC) $(CFLAGS) -m64 -fPIC -shared -Wl,-Bsymbolic -o $@ $<
37
38 lib32/libGL.so.1: glaze-gl.c specs/gl.def
39         mkdir -p lib32
40         $(CC) $(CFLAGS) -m32 -fPIC -shared -Wl,-Bsymbolic -o $@ $<
41
42 .PHONY: install
43 install: all
44         mkdir -p $(DESTDIR)$(LIBDIR)/glaze/lib64
45         install -m0644 lib64/libGL.so.1 $(DESTDIR)$(LIBDIR)/glaze/lib64
46         mkdir -p $(DESTDIR)$(LIBDIR)/glaze/lib32
47         install -m0644 lib32/libGL.so.1 $(DESTDIR)$(LIBDIR)/glaze/lib32
48         install -m0644 $(LIBGLAZE_LIBNAME) $(DESTDIR)$(LIBDIR)
49         ln -sf $(LIBGLAZE_LIBNAME) $(DESTDIR)$(LIBDIR)/$(LIBGLAZE_SONAME)
50         ln -sf $(LIBGLAZE_LIBNAME) $(DESTDIR)$(LIBDIR)/$(LIBGLAZE_LINKER_NAME)
51         mkdir -p $(DESTDIR)$(LIBDIR)/pkgconfig
52         install glaze.pc $(DESTDIR)$(LIBDIR)/pkgconfig
53         mkdir -p $(DESTDIR)$(INCLUDEDIR)/glaze
54         install -m0644 glaze.h $(DESTDIR)$(INCLUDEDIR)/glaze
55
56 clean:
57         rm -f $(TARGETS)