source: trunk/sys/lib.mk @ 112

Last change on this file since 112 was 1, checked in by alain, 8 years ago

First import

File size: 1.3 KB
RevLine 
[1]1#
2# lib.mk - Common rules to build libraries
3#
4
5TGTDIR=almos-$(ARCH)-$(CPU)/almos
6
7LIBDIR=$(ALMOS_DISTRIB)/lib
8INCDIR=$(ALMOS_DISTRIB)/include
9
10include $(SRCDIR)../../common.mk
11
12ifneq ($(SRCDIR), )
13
14CFLAGS = -W -Wall -Wextra -Wchar-subscripts -Werror \
15         -Wno-switch -Wno-unused -Wredundant-decls  \
16         -fno-strict-aliasing -fno-pic -static -O3  \
17         -DUSR_LIB_COMPILER -D_ALMOS_ -DZ_PREFIX -DHAVE_GOMP \
18         $(CPUCFLAGS) $(INCFLAGS) 
19
20VPATH ?=$(SRCDIR)
21OBJS   =$(filter %.o, $(SRCS:.c=.o) $(SRCS:.S=.o))
22
23
24all: checktgt lib$(LIB).a install
25
26lib$(LIB).a:: $(OBJS)
27        @rm -f $@
28        @$(AR) -r $@ $^
29
30install:lib$(LIB).a
31        @[ -d $(LIBDIR) ] || mkdir -p $(LIBDIR)
32        @[ -d $(INCDIR) ] || mkdir -p $(INCDIR)
33        cp -r $(SRCDIR)/include/* $(INCDIR)/.
34        cp $^ $(LIBDIR)/.
35
36checktgt:
37        @if [ -z $$ALMOS_DISTRIB ]; then echo "ERROR: Missing ALMOS_DISTRIB macro, no target directory has been specified"; \
38        exit 1; else exit 0; fi
39
40clean:
41        rm -f lib$(LIB).a $(OBJS)
42
43
44# Set of rules to for a multi-architecture build.
45#
46# See http://make.paulandlesley.org/multi-arch.html for more information
47else
48
49MAKEFLAGS+= --no-print-directory
50
51$(OBJDIR):
52        @[ -d $@ ] || mkdir -p $@
53        @cd $@ && $(MAKE) -f $(CURDIR)/Makefile SRCDIR=$(CURDIR)/ $(MAKECMDGOALS)
54
55Makefile : ;
56
57% :: $(OBJDIR) ;
58
59clean:
60        @rmdir $(OBJDIR)
61
62.PHONY: $(OBJDIR) clean
63endif
Note: See TracBrowser for help on using the repository browser.