| 1 | # wrapper to build SINA together with arb |
|---|
| 2 | # |
|---|
| 3 | |
|---|
| 4 | SHELL = bash -o pipefail |
|---|
| 5 | |
|---|
| 6 | # uncomment next line to debug the makefile: |
|---|
| 7 | # MAKEFLAGS += --trace --debug=a |
|---|
| 8 | |
|---|
| 9 | BUILDDIR=builddir |
|---|
| 10 | |
|---|
| 11 | SINA_INST_BIN=$(ARBHOME)/bin/sina |
|---|
| 12 | SINA_MADE_BIN=$(BUILDDIR)/src/sina |
|---|
| 13 | |
|---|
| 14 | # AFAIK adding onlyC_flags has no effect, because plain C compiler is not really used (just configured) |
|---|
| 15 | CC = $(A_CC) $(onlyC_flags) |
|---|
| 16 | CXX = $(A_CXX) |
|---|
| 17 | |
|---|
| 18 | # special flags needed if arb is build sanitized |
|---|
| 19 | CFLAGS = -g -O2 $(SANI_CFLAGS) |
|---|
| 20 | LDFLAGS =$(SANI_CLFLAGS) |
|---|
| 21 | |
|---|
| 22 | # hack needed until sina build properly detects libtirpc: |
|---|
| 23 | ifdef LIBS |
|---|
| 24 | LIBS := $(LIBS) $(ARB_RPC_LIBS) |
|---|
| 25 | else |
|---|
| 26 | LIBS := $(ARB_RPC_LIBS) |
|---|
| 27 | endif |
|---|
| 28 | |
|---|
| 29 | # configure: |
|---|
| 30 | CONFIGURE_OPTS := |
|---|
| 31 | |
|---|
| 32 | CONFIGURE_OPTS += --disable-silent-rules # be verbose |
|---|
| 33 | CONFIGURE_OPTS += --enable-shared=no --enable-static=yes |
|---|
| 34 | CONFIGURE_OPTS += --disable-docs # do not generate documentation |
|---|
| 35 | CONFIGURE_OPTS += "--with-buildinfo=patched for arb r19248" # add patch info |
|---|
| 36 | # detect revision for patchinfo using: |
|---|
| 37 | # svn log ./builddir | head -30 | grep '^r[1-9]' | head -1 |
|---|
| 38 | |
|---|
| 39 | # do not warn about undefined make variables in calls to submakefiles: |
|---|
| 40 | ARB_ORG_MAKEFLAGS:=$(subst --warn-undefined-variables,,$(ARB_ORG_MAKEFLAGS)) |
|---|
| 41 | |
|---|
| 42 | SUBMAKEFLAGS:=MAKEFLAGS="$(ARB_ORG_MAKEFLAGS)" LIBS="$(LIBS)" CFLAGS="$(CFLAGS)" LDFLAGS="$(LDFLAGS)" |
|---|
| 43 | |
|---|
| 44 | SED:=$(ARBHOME)/SH/arb_sed |
|---|
| 45 | |
|---|
| 46 | ## targets called by "upsteam makefile": |
|---|
| 47 | |
|---|
| 48 | all: $(SINA_INST_BIN) |
|---|
| 49 | |
|---|
| 50 | clean_builddir: |
|---|
| 51 | test ! -e $(BUILDDIR)/Makefile || (export $(SUBMAKEFLAGS) ; $(MAKE) -C $(BUILDDIR) mostlyclean clean-binPROGRAMS clean-libLTLIBRARIES clean-libtool) |
|---|
| 52 | |
|---|
| 53 | clean: |
|---|
| 54 | rm -f *.stamp |
|---|
| 55 | rm -f $(SINA_INST_BIN) |
|---|
| 56 | ls -al $(BUILDDIR)/ |
|---|
| 57 | -( test -e $(BUILDDIR)/config.status && test -e $(BUILDDIR)/configure && \ |
|---|
| 58 | test $(BUILDDIR)/config.status -nt $(BUILDDIR)/configure ) && \ |
|---|
| 59 | $(MAKE) clean_builddir |
|---|
| 60 | rm -f $(BUILDDIR)/config.status |
|---|
| 61 | |
|---|
| 62 | ## internal targets |
|---|
| 63 | |
|---|
| 64 | build: $(SINA_MADE_BIN) |
|---|
| 65 | |
|---|
| 66 | # reset MAKEFLAGS to value initially found in main ARB makefile |
|---|
| 67 | |
|---|
| 68 | $(SINA_INST_BIN): $(SINA_MADE_BIN) |
|---|
| 69 | cp -p $(SINA_MADE_BIN) $@ |
|---|
| 70 | |
|---|
| 71 | $(SINA_MADE_BIN): check_configured |
|---|
| 72 | (export $(SUBMAKEFLAGS) ; $(MAKE) -C $(BUILDDIR)) |
|---|
| 73 | |
|---|
| 74 | check_configured: configure.stamp |
|---|
| 75 | |
|---|
| 76 | configure.stamp: Makefile |
|---|
| 77 | ifeq ($(ARB_ORG_MAKEFLAGS),) |
|---|
| 78 | $(error ARB_ORG_MAKEFLAGS is empty) |
|---|
| 79 | endif |
|---|
| 80 | ( export $(SUBMAKEFLAGS) ; \ |
|---|
| 81 | cd $(BUILDDIR) && \ |
|---|
| 82 | ( ./autogen.sh 2>&1 ) | $(SED) -e 's/^\(.*\)/\[hide\]: \1/' && \ |
|---|
| 83 | ./configure $(CONFIGURE_OPTS) ) |
|---|
| 84 | touch $@ |
|---|
| 85 | $(MAKE) clean_builddir |
|---|
| 86 | |
|---|
| 87 | # prevent make from deleting intermediate targets: |
|---|
| 88 | .SECONDARY: |
|---|
| 89 | |
|---|
| 90 | .PHONY: all clean_builddir clean build check_configured |
|---|
| 91 | |
|---|