File: fastbuild.mk

package info (click to toggle)
smlsharp 1.2.0-2.1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 31,180 kB
  • sloc: ansic: 13,471; sh: 3,207; makefile: 352; ruby: 295; ml: 265; pascal: 256; awk: 225; asm: 97; sql: 24
file content (44 lines) | stat: -rw-r--r-- 1,579 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
FASTBUILD_FUNCS = \
  check () { \
    echo "checking for fast build on $$1 ..." 1>&2; \
    $(SMLSHARP) -Bsrc -nostdpath -fprint-main-ids "$$1" \
    | sed 's/\.smi$$/.sml/' > fastbuild1.tmp; \
    $(SMLSHARP) -Bsrc --sha1 `cut -d\  -f2 fastbuild1.tmp` \
    | awk 'BEGIN{while((getline < "fastbuild1.tmp"))h[$$2]=$$1} \
           {printf "%s:%s %s\n",h[$$2],$$1,$$2}' \
    > fastbuild2.tmp; \
    trap "rm -f fastbuild1.tmp fastbuild2.tmp" EXIT; \
  }; \
  compile () { \
    asm="$$1"; \
    sum="$$2"; \
    sml="$$3"; \
    smi=`echo "$$sml" | sed 's,\.sml$$,.smi,'`; \
    obj=`echo "$$sml" | sed 's,\.sml$$,.o,'`; \
    test -f "$$obj" && return; \
    test "x$$sum" = "x`grep "$$sml" fastbuild2.tmp | cut -d\  -f1`" || return; \
    echo $(CC) -c -o "$$obj" "precompiled/$(NATIVE_TARGET)/$$asm"; \
    $(CC) -c -o "$$obj" "precompiled/$(NATIVE_TARGET)/$$asm"; \
    return; \
  }

# reproduce text to normalize line break characters.
# this is an workaround for mingw.
NORMALIZE_CRLF = \
  normalize () { \
    tmp=fastbuild3.tmp; \
    for i; do sed -n p "$$i" > "$$tmp" && cp "$$tmp" "$$i"; done; \
    rm -f "$$tmp"; \
  }; normalize

fast-all: $(SMLSHARP_DEP)
	$(FASTBUILD_FUNCS); set +e; . precompiled/fastbuild1; :
	$(MAKE) sources
	case '$(host_os)' in *mingw*) \
	  $(NORMALIZE_CRLF) \
	    `for i in $(GEN_SOURCES); do \
	       case "$$i" in src/compiler/*) echo "$$i";; esac; \
	     done`;; esac
	$(FASTBUILD_FUNCS); set +e; . precompiled/fastbuild2; :
	-awk 'BEGIN{print "/^include.*fastbuild.mk$$/s/^/\043/\nw\nq"}' | ed Makefile > /dev/null
	$(MAKE) all