build: Fixed build, now we can create lib from directory.
[gfxprim.git] / lib.mk
blob52793ca5265b8489ea70866bcb8d851747256537
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 ln -s $(LIB).so $(LIBP)$(LIB).so.0
32 $(CC) -fPIC -dPIC --shared -Wl,-soname -Wl,$@.0 $(OBJECTS) -o $@
33 else
34 @rm -f $(LIBP)$(LIB).so.0
35 @ln -s $(LIB).so $(LIBP)$(LIB).so.0
36 @echo "LD $@"
37 @$(CC) -fPIC -dPIC --shared -Wl,-soname -Wl,$@.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)