Ignore:
Timestamp:
Apr 5, 2017, 5:56:14 PM (8 years ago)
Author:
Aaron Moss <a3moss@…>
Branches:
ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, deferred_resn, demangler, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, with_gc
Children:
122aecd, 5671b8d
Parents:
75ac87e
Message:

Modify makefile to run simple benchmarks at both -O0 and -O2

File:
1 edited

Legend:

Unmodified
Added
Removed
  • doc/generic_types/evaluation/Makefile

    r75ac87e r4cfcf41  
    1 CFA=my-cfa
     1CFA = my-cfa
     2DEPFLAGS = -MMD -MP
    23
    3 # %.o : %.cf
    4 #       $(CFA) -c $(CFLAGS) $(CPPFLAGS) $< -o $@
     4.PHONY: all clean distclean bench
    55
    6 cfa-stack.o: cfa-stack.c cfa-stack.h
    7         $(CFA) -c $(CFLAGS) $(CPPFLAGS) $< -o $@
     6all: c-bench cpp-bench cfa-bench c2-bench cpp2-bench cfa2-bench
    87
    9 c-bench: c-bench.c bench.h c-stack.o
    10         $(CC) $(CFLAGS) $(CPPFLAGS) -o $@ $< c-stack.o
     8# rewrite object generation to auto-determine deps
     9COMPILE.c = $(CC) $(DEPFLAGS) $(CFLAGS) $(CPPFLAGS)
     10COMPILE.cpp = $(CXX) $(DEPFLAGS) $(CXXFLAGS) $(CPPFLAGS)
     11COMPILE.cfa = $(CFA) $(DEPFLAGS) $(CFLAGS) $(CPPFLAGS)
    1112
    12 cpp-bench: cpp-bench.cpp bench.h cpp-stack.h
    13         $(CXX) $(CXXFLAGS) $(CPPFLAGS) -o $@ $<
     13c-%.o : c-%.c
     14c-%.o : c-%.c c-%.d
     15        $(COMPILE.c) -O0 $(OUTPUT_OPTION) -c $<
    1416
    15 cfa-bench: cfa-bench.c bench.h cfa-stack.o
    16         $(CFA) $(CFLAGS) $(CPPFLAGS) -o $@ $< cfa-stack.o
     17cpp-%.o : cpp-%.cpp
     18cpp-%.o : cpp-%.cpp cpp-%.d
     19        $(COMPILE.cpp) -O0 $(OUTPUT_OPTION) -c $<
     20
     21cfa-%.o : cfa-%.c
     22cfa-%.o : cfa-%.c cfa-%.d
     23        $(COMPILE.cfa) -O0 $(OUTPUT_OPTION) -c $<
     24
     25c2-%.o : c-%.c
     26c2-%.o : c-%.c c-%.d
     27        $(COMPILE.c) -O2 $(OUTPUT_OPTION) -c $<
     28
     29cpp2-%.o : cpp-%.cpp
     30cpp2-%.o : cpp-%.cpp cpp-%.d
     31        $(COMPILE.cpp) -O2 $(OUTPUT_OPTION) -c $<
     32
     33cfa2-%.o : cfa-%.c
     34cfa2-%.o : cfa-%.c cfa-%.d
     35        $(COMPILE.cfa) -O2 $(OUTPUT_OPTION) -c $<
     36
     37COBJS = c-stack.o
     38CPPOBJS =
     39CFAOBJS = cfa-stack.o
     40C2OBJS = $(patsubst c-%,c2-%, $(COBJS))
     41CPP2OBJS = $(patsubst cpp-%,cpp2-%, $(CPPOBJS))
     42CFA2OBJS = $(patsubst cfa-%,cfa2-%, $(CFAOBJS))
     43
     44c-bench: c-bench.c c-bench.d $(COBJS)
     45        $(COMPILE.c) -O0 -o $@ $< $(COBJS) $(LDFLAGS)
     46
     47cpp-bench: cpp-bench.cpp cpp-bench.d $(CPPOBJS)
     48        $(COMPILE.cpp) -O0 -o $@ $< $(CPPOBJS) $(LDFLAGS)
     49
     50cfa-bench: cfa-bench.c cfa-bench.d $(CFAOBJS)
     51        $(COMPILE.cfa) -O0 -o $@ $< $(CFAOBJS) $(LDFLAGS)
     52
     53c2-bench: c-bench.c c-bench.d $(C2OBJS)
     54        $(COMPILE.c) -O2 -o $@ $< $(C2OBJS) $(LDFLAGS)
     55
     56cpp2-bench: cpp-bench.cpp cpp-bench.d $(CPP2OBJS)
     57        $(COMPILE.cpp) -O2 -o $@ $< $(CPP2OBJS) $(LDFLAGS)
     58
     59cfa2-bench: cfa-bench.c cfa-bench.d $(CFA2OBJS)
     60        $(COMPILE.cfa) -O2 -o $@ $< $(CFA2OBJS) $(LDFLAGS)
    1761
    1862clean:
    19         -rm *.o
    20         -rm c-bench
    21         -rm cpp-bench
    22         -rm cfa-bench
     63        -rm $(COBJS) c-bench
     64        -rm $(CPPOBJS) cpp-bench
     65        -rm $(CFAOBJS) cfa-bench
     66        -rm $(C2OBJS) c2-bench
     67        -rm $(CPP2OBJS) cpp2-bench
     68        -rm $(CFA2OBJS) cfa2-bench
     69
     70distclean: clean
     71        -rm $(COBJS:.o=.d) c-bench.d
     72        -rm $(CPPOBJS:.o=.d) cpp-bench.d
     73        -rm $(CFAOBJS:.o=.d) cfa-bench.d
     74
     75bench: c-bench cpp-bench cfa-bench c2-bench cpp2-bench cfa2-bench
     76        @echo '## C ##'
     77        @./c-bench
     78        @echo '## C++ ##'
     79        @./cpp-bench
     80        @echo '## Cforall ##'
     81        @./cfa-bench
     82        @echo '## C -O2 ##'
     83        @./c2-bench
     84        @echo '## C++ -O2 ##'
     85        @./cpp2-bench
     86        @echo '## Cforall -O2 ##'
     87        @./cfa2-bench
     88
     89# so make doesn't fail without dependency files
     90%.d: ;
     91
     92# so make won't delete dependency files
     93.PRECIOUS: %.d
     94
     95# include dependency files
     96-include: $(COBJS:.o=.d)
     97-include: $(CPPOBJS:.o=.d)
     98-include: $(CFAOBJS:.o=.d)
     99-include: c-bench.d
     100-include: cpp-bench.d
     101-include: cfa-bench.d
Note: See TracChangeset for help on using the changeset viewer.