All pastes #1178705 Raw Edit

Untitled

public text v1 · immutable
#1178705 ·published 2008-08-19 14:47 UTC
rendered paste body
# $Id: Makefile,v 1.26 2008/08/18 15:08:39 eric Exp $
# SWObjects build rules -- see http://www.w3.org/2008/04/SPARQLfed/

# recipies:
#   normal build:
#     make SPARQLfed
#   force the use of the tracing facilities (and redirect to stdout):
#     make -W sample_RuleMap1.cc test
#   have valgrind start a debugger (works as M-x gdb invocation command):
#     valgrind --db-attach=yes --leak-check=yes sample_RuleMap1 query_HealthCare1.rq ruleMap_HealthCare1.rq
#   same, if you aren't working in gdb:
#     make valgrind
#   debugging in emacs:
#     gdb --annotate=3 sample_RuleMap1    (set args query_HealthCare1.rq ruleMap_HealthCare1.rq)

# BUGS:
#   .hh dependency probs -- use .deps?

%.d : %.ll 
	touch $@	
	makedepend -f $@ $^ $(DEFS) $(INC)

%.d : %.yy
	touch $@	
	makedepend -f $@ $^ $(DEFS) $(INC) 

%.d :  %.cc  
	touch $@	
	makedepend -f $@ $^ $(DEFS) $(INC) 

%.d :  %.hh 
	touch $@	
	makedepend -f $@ $^ $(DEFS) $(INC) 

#VERY hackish
%.cc %.hh : %.yy 
	$(YACC) -o $@ -b $(subst .yy,,$<)  $< 

#%.cc : %.yy
#	$(YACC) -o $@ -o $(subst .hh,.cc,$@)   $< 

%.cc : %.ll
	$(FLEX) -o $@  $< 

FLEX=flex
YACC=bison

#LIBS
DEBUG=-g
#OPT=-O4
DEFS=-DYYTEXT_POINTER=1
WARN=-W -Wall -Wextra 
TOONOISEY=-ansi
#for macports
CFLAGS += $(DEFS) $(OPT) $(DEBUG) $(WARN) $(INCLUDES) -pipe 
CXXFLAGS += $(CFLAGS) 

### absolutely neccessry for c++ linking ###
LD = $(CXX)
LDFLAGS += $(LIBINC) 
VER=0.1

#some progressive macports 
#CC=llvm-gcc
#CXX=llvm-g++
#LLVMCFLAGS = ` llvm-config --cflags` -O4 
#LLVMCXXFLAGS = ` llvm-config --cxxflags` -O4
#LLVMLDFLAGS = ` llvm-config --ldflags --libs `
#LLVMLIBS= ` llvm-config --libs`
# ... you get the idea...
CFLAGS += $(LLVMCFLAGS)   
INCLUDES+=-I${PWD} -I/opt/include
LIBINC+= -L${PWD} -L/opt/local/lib -lm
#just for a sample 

    
### dirt simple generic static module ### 
    
BISONOBJ =  $(subst .yy,.o,$(wildcard *.yy))
FLEXOBJ=  $(subst .ll,.o,$(wildcard *.ll))
OBJ = $(BISONOBJ) $(FLEXOBJ) $(subst .cc,.o,$(wildcard *.cc))

LIBNAME=libSWObjects
LIBAR=$(LIBNAME).a
LIBOBJ=$(LIBAR)($(OBJ))
LIBS = $(LIBAR)
LIBS: depend $(LIBOBJ)



# Sample apps
#   sample_TopicN - sample app number N for a given topic.
#   Vsample_TopicN - valgrind test of the this sample
## RuleMap1 - convert a SPARQL query on an interface graph to one that
##            works on a privage graph

tests/sample_RuleMap1: $(LIBS) tests/sample_RuleMap1.o 
	$(LD) $(LDFLAGS) $(LIBINC) -o $@  $^

SAMPLES= tests/sample_RuleMap1 #tests/Vsample_RuleMap1
TEST_SEQ= tests/sample_RuleMap1 query_HealthCare1.rq ruleMap_HealthCare1.rq

tests/Vsample_RuleMap1: $(TEST_SEQ)
	valgrind --leak-check=yes --xml=no $^ 

# Tests
#   test: includes all samples
#   valgrind: valgrinds all samples

test: $(SAMPLES)
	$(TEST_SEQ)

valgrind: $(SAMPLES)

# Distributions

dist: $(LIBS)
	$(RM) -f SWObjects_$(VER).tar.gz README.html
	lynx -dump -source http://www.w3.org/2008/04/SPARQLfed/ | perl -pe 's{href="\.\./\.\./\.\.}{href="http://www.w3.org}g;s{href="\.\./\.\.}{href="http://www.w3.org/2008}g'> README.html
	$(ECHO) "Generating the inclusion from the manifest (HEADER.html)"
	$(PERL) -ne 'print join("\n", "README.html", m/href="([a-zA-Z]{2}[a-zA-Z0-9._]+)"/g, undef)' HEADER.html | xargs tar czf SWObjects_$(VER).tar.gz --transform s,,SWObjects_$(VER)/,1
	$(RM) README.html
# Clean - rm everything we remember to rm.

clean:
	$(RM) *.o *.d *.a *.dylib *.so *.la *.d.bak \
        $(subst .ll,.cc,$(wildcard *.ll)) \
        $(subst .yy,.cc,$(wildcard *.yy)) \
        $(subst .yy,.hh,$(wildcard *.yy)) \
        $(SAMPLES) $(SAMPLES:=.o)

.PHONY:  depend all test dist

depend: Makefile $(BISONOBJ:.o=.d) $(OBJ:.o=.d) 

all: $(LIBS) test 

include $(subst .o,.d,$(OBJ))