Makefile
changeset 24 d3b6f9ccbe20
parent 22 822094314703
child 29 c5d00a24af56
equal deleted inserted replaced
23:fb178359336f 24:d3b6f9ccbe20
     5 
     5 
     6 UNAME       := $(shell uname)
     6 UNAME       := $(shell uname)
     7 DEPS_DEBUG   = libprofiler
     7 DEPS_DEBUG   = libprofiler
     8 CFLAGS       = -O2
     8 CFLAGS       = -O2
     9 CFLAGS_DEBUG = -DDEBUG -DPROG='"volta (debugmode)"' -ggdb -ansi -Wall
     9 CFLAGS_DEBUG = -DDEBUG -DPROG='"volta (debugmode)"' -ggdb -ansi -Wall
    10 LIBS         = -lcdb -llua -lm
    10 LIBS         = -lcdb
    11 OBJS         = $(patsubst %.c,%.o,$(wildcard *.c))
    11 OBJS         = $(patsubst %.c,%.o,$(wildcard *.c))
    12 
    12 
    13 .PHONY : parsegraph profile clean clobber release
    13 .PHONY : parsegraph profile clean clobber release
    14 
    14 
    15 # Ubuntu: perftools doesn't currently register a .pc file
    15 
       
    16 ########################################################################
       
    17 ### P L A T F O R M  T A R G E T S
       
    18 ########################################################################
       
    19 
       
    20 # I hate this.  Tools like pkg-config are supposed to make finding
       
    21 # libraries easy across platforms.  They only work when everyone names
       
    22 # the libraries the same thing, unfortunately.  (Why name the libs with
       
    23 # the version number, when pkg-config supports built in versioning??)
       
    24 # And no, I'm not going to use autoconf, which just takes your build
       
    25 # problems and makes a whole bunch of new baby problems for you to
       
    26 # deal with.  Gaaarrgghghh.
       
    27 #
       
    28 # If you have problems building volta, manually pass the correct CFLAGS
       
    29 # and LIBS to the 'make' command line for your platform.
       
    30 #
       
    31 # The following works for OSX with macports or homebrew (10.6/10.7),
       
    32 # FreeBSD 8.x and 9.x, and Ubuntu 11.10 and 12.04.
       
    33 
       
    34 # Ubuntu
       
    35 #  - perftools doesn't currently register a .pc file at all
       
    36 #  - lua is called 'lua5.1'
    16 ifeq ($(UNAME), Linux)
    37 ifeq ($(UNAME), Linux)
       
    38 volta: CFLAGS += -L/usr/lib -I/usr/include
       
    39 volta: CFLAGS += $(shell pkg-config --cflags-only-I --libs-only-L lua5.1)
       
    40 volta: LIBS   += $(shell pkg-config --libs-only-l lua5.1)
    17 debug: CFLAGS += $(CFLAGS_DEBUG)
    41 debug: CFLAGS += $(CFLAGS_DEBUG)
    18 debug: LIBS += -lprofiler
    42 debug: CFLAGS += $(CFLAGS_DEBUG)\
       
    43 	$(shell pkg-config --cflags-only-I --libs-only-L lua5.1)
       
    44 debug: LIBS   += $(shell pkg-config --libs-only-l lua5.1) -lprofiler
       
    45 
       
    46 # FreeBSD
       
    47 # - lua is called 'lua-5.1'
       
    48 else ifeq ($(UNAME), FreeBSD)
       
    49 volta: CFLAGS += -L/usr/local/lib -I/usr/local/include
       
    50 volta: CFLAGS += $(shell pkg-config --cflags-only-I --libs-only-L lua-5.1)
       
    51 volta: LIBS   += $(shell pkg-config --libs-only-l lua-5.1)
       
    52 debug: CFLAGS += $(CFLAGS_DEBUG)\
       
    53     $(shell pkg-config --cflags-only-I --libs-only-L lua-5.1 $(DEPS_DEBUG))
       
    54 debug: LIBS += $(shell pkg-config --libs-only-l lua-5.1 $(DEPS_DEBUG))
       
    55 
       
    56 # Darwin, everyone else (best guess?)
       
    57 # - lua is called 'lua', hopefully!
    19 else
    58 else
    20 volta: CFLAGS += -L/opt/local/lib -I/opt/local/include -L/usr/local/lib -I/usr/local/include
    59 volta: CFLAGS += $(shell pkg-config --cflags-only-I --libs-only-L lua)
       
    60 volta: LIBS   += $(shell pkg-config --libs-only-l lua) 
    21 debug: CFLAGS += $(CFLAGS_DEBUG)\
    61 debug: CFLAGS += $(CFLAGS_DEBUG)\
    22 	$(shell pkg-config --cflags-only-I --libs-only-L $(DEPS_DEBUG))
    62     $(shell pkg-config --cflags-only-I --libs-only-L lua $(DEPS_DEBUG))
    23 debug: LIBS += $(shell pkg-config --libs-only-l $(DEPS_DEBUG))
    63 debug: LIBS += $(shell pkg-config --libs-only-l lua $(DEPS_DEBUG))
    24 endif
    64 endif
       
    65 
    25 
    66 
    26 # Fix parser line number display in debug mode
    67 # Fix parser line number display in debug mode
    27 ifeq (,$(findstring debug,$(MAKECMDGOALS)))
    68 ifeq (,$(findstring debug,$(MAKECMDGOALS)))
    28 	RAGEL_FLAGS = -LCe -G2
    69 	RAGEL_FLAGS = -LCe -G2
    29 else
    70 else