Finished moving and cleaning templates from .py to .t
[gfxprim.git] / lib.mk
blob397515a033dd9718bd18f52e9ba0ca1c67a52b3b
1 ifndef LIBNAME
2 $(error LIBNAME not defined, fix your library Makefile)
3 endif
5 LIB=libGP_$(LIBNAME)
6 LIBP=$(TOPDIR)/build/
9 # If set to yes, builds single library for directory
11 ifeq ($(BUILDLIB),yes)
12 all: $(LIBP)$(LIB).so $(LIBP)$(LIB).a
13 endif
15 ifeq ($(BUILDLIB),yes)
16 CLEAN+=$(LIBP)$(LIB).so $(LIBP)$(LIB).so.0 $(LIBP)$(LIB).a
17 endif
20 # Trigger libGP.XX library rebuild
22 all: $(OBJECTS)
23 @$(MAKE) --no-print-directory -C $(TOPDIR)/build/
26 # Rules for single library
28 $(LIBP)$(LIB).so: $(OBJECTS)
29 ifdef VERBOSE
30 rm -f $(LIBP)$(LIB).so.0
31 cd $(LIBP) && ln -s $(LIB).so $(LIB).so.0
32 $(CC) -fPIC -dPIC --shared -Wl,-soname -Wl,$(LIB).so.0 $(OBJECTS) -o $@
33 else
34 @rm -f $(LIBP)$(LIB).so.0
35 @cd $(LIBP) && ln -s $(LIB).so $(LIB).so.0
36 @echo "LD $@"
37 @$(CC) -fPIC -dPIC --shared -Wl,-soname -Wl,$(LIB).so.0 $(OBJECTS) -o $@
38 endif
40 $(LIBP)$(LIB).a: $(OBJECTS)
41 ifdef VERBOSE
42 $(AR) rcs $@ $(OBJECTS)
43 else
44 @echo "AR $@"
45 @$(AR) rcs $@ $(OBJECTS)
46 endif
48 CLEAN+=$(OBJECTS)