1 # $Id: Makefile,v 1.9 2007-10-22 18:53:12 rich Exp $
     
2 
     3 #BUILD_ID_NONE := -Wl,--build-id=none 
     
4 BUILD_ID_NONE := 
     
5 
     6 SHELL	:= /bin/bash
     
7 
     8 all:	jonesforth
     
9 
    10 jonesforth: jonesforth.S
    
11 	gcc -m32 -nostdlib -static $(BUILD_ID_NONE) -o $@ $<
    
12 
    13 run:
    
14 	cat jonesforth.f $(PROG) - | ./jonesforth
    
15 
    16 clean:
    
17 	rm -f jonesforth perf_dupdrop *~ core .test_*
    
18 
    19 # Tests.
    
20 
    21 TESTS	:= $(patsubst %.f,%.test,$(wildcard test_*.f))
    
22 
    23 test check: $(TESTS)
    
24 
    25 test_%.test: test_%.f jonesforth
    
26 	@echo -n "$< ... "
    
27 	@rm -f .$@
    
28 	@cat <(echo ': TEST-MODE ;') jonesforth.f $< <(echo 'TEST') | \
    
29 	  ./jonesforth 2>&1 | \
    
30 	  sed 's/DSP=[0-9]*//g' > .$@
    
31 	@diff -u .$@ $<.out
    
32 	@rm -f .$@
    
33 	@echo "ok"
    
34 
    35 # Performance.
    
36 
    37 perf_dupdrop: perf_dupdrop.c
    
38 	gcc -O3 -Wall -Werror -o $@ $<
    
39 
    40 run_perf_dupdrop: jonesforth
    
41 	cat <(echo ': TEST-MODE ;') jonesforth.f perf_dupdrop.f | ./jonesforth
    
42 
    43 .SUFFIXES: .f .test
    
44 .PHONY: test check run run_perf_dupdrop
    
45 
    46 remote:
    
47 	scp jonesforth.S jonesforth.f rjones@oirase:Desktop/
    
48 	ssh rjones@oirase sh -c '"rm -f Desktop/jonesforth; \
    
49 	  gcc -m32 -nostdlib -static -Wl,-Ttext,0 -o Desktop/jonesforth Desktop/jonesforth.S; \
    
50 	  cat Desktop/jonesforth.f - | Desktop/jonesforth arg1 arg2 arg3"'