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