| Line |  | 
|---|
| 1 | # | 
|---|
| 2 | # lib.mk - Common rules to build libraries | 
|---|
| 3 | # | 
|---|
| 4 |  | 
|---|
| 5 | TGTDIR=almos-$(ARCH)-$(CPU)/almos | 
|---|
| 6 |  | 
|---|
| 7 | LIBDIR=$(ALMOS_DISTRIB)/lib | 
|---|
| 8 | INCDIR=$(ALMOS_DISTRIB)/include | 
|---|
| 9 |  | 
|---|
| 10 | include $(SRCDIR)../../common.mk | 
|---|
| 11 |  | 
|---|
| 12 | ifneq ($(SRCDIR), ) | 
|---|
| 13 |  | 
|---|
| 14 | CFLAGS = -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 |  | 
|---|
| 20 | VPATH ?=$(SRCDIR) | 
|---|
| 21 | OBJS   =$(filter %.o, $(SRCS:.c=.o) $(SRCS:.S=.o)) | 
|---|
| 22 |  | 
|---|
| 23 |  | 
|---|
| 24 | all: checktgt lib$(LIB).a install | 
|---|
| 25 |  | 
|---|
| 26 | lib$(LIB).a:: $(OBJS) | 
|---|
| 27 | @rm -f $@ | 
|---|
| 28 | @$(AR) -r $@ $^ | 
|---|
| 29 |  | 
|---|
| 30 | install: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 |  | 
|---|
| 36 | checktgt: | 
|---|
| 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 |  | 
|---|
| 40 | clean: | 
|---|
| 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 | 
|---|
| 47 | else | 
|---|
| 48 |  | 
|---|
| 49 | MAKEFLAGS+= --no-print-directory | 
|---|
| 50 |  | 
|---|
| 51 | $(OBJDIR): | 
|---|
| 52 | @[ -d $@ ] || mkdir -p $@ | 
|---|
| 53 | @cd $@ && $(MAKE) -f $(CURDIR)/Makefile SRCDIR=$(CURDIR)/ $(MAKECMDGOALS) | 
|---|
| 54 |  | 
|---|
| 55 | Makefile : ; | 
|---|
| 56 |  | 
|---|
| 57 | % :: $(OBJDIR) ; | 
|---|
| 58 |  | 
|---|
| 59 | clean: | 
|---|
| 60 | @rmdir $(OBJDIR) | 
|---|
| 61 |  | 
|---|
| 62 | .PHONY: $(OBJDIR) clean | 
|---|
| 63 | endif | 
|---|
       
      
      Note: See 
TracBrowser
        for help on using the repository browser.