core: GP_Debug.c: Fix code ordering.
[gfxprim.git] / lib.mk
blobd9a6f0bcd838c27abcbc549966a1002facd96647
2 # Most of the libraries just generate object files that
3 # are later linked in build into the libGP.so
5 ifndef LIBNAME
6 $(error LIBNAME not defined, fix your library Makefile)
7 endif
10 # Rules for single library, applied only when objects
11 # are not linked to the libGP.so. This generates libGP_$(LIBNAME).
13 ifeq ($(BUILDLIB),yes)
14 # BUILDLIB = yes
16 LIB=libGP_$(LIBNAME)
17 LIBP=$(TOPDIR)/build/
19 ALL+=$(LIBP)$(LIB).so $(LIBP)$(LIB).a
20 CLEAN+=$(LIBP)$(LIB).so $(LIBP)$(LIB).so.0 $(LIBP)$(LIB).a
21 OBJS=$(CSOURCES:.c=.o)
24 $(LIBP)$(LIB).so: $(OBJS)
25 ifdef VERBOSE
26 rm -f $(LIBP)$(LIB).so.0
27 cd $(LIBP) && ln -s $(LIB).so $(LIB).so.0
28 $(CC) -fPIC --shared -Wl,-soname -Wl,$(LIB).so.0 $(OBJECTS) -o $@
29 else
30 @rm -f $(LIBP)$(LIB).so.0
31 @cd $(LIBP) && ln -s $(LIB).so $(LIB).so.0
32 @echo "LD $@"
33 @$(CC) -fPIC --shared -Wl,-soname -Wl,$(LIB).so.0 $(OBJECTS) -o $@
34 endif
36 $(LIBP)$(LIB).a: $(OBJS)
37 ifdef VERBOSE
38 $(AR) rcs $@ $(OBJECTS)
39 else
40 @echo "AR $@"
41 @$(AR) rcs $@ $(OBJECTS)
42 endif
44 else
45 # BUILDLIB = no
46 include $(TOPDIR)/config.mk
48 ifeq ($(REBUILD_LIBGP),yes)
49 ALL+=rebuild_lib
51 rebuild_lib:
52 @$(MAKE) --no-print-directory -C $(TOPDIR)/build/
53 endif
54 endif