Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: develop
Fetching contributors…

Cannot retrieve contributors at this time

file 78 lines (59 sloc) 1.36 kb
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 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78
#
# Makefile for restclient-cpp
#

# set compiler and linker
CC = gcc
LD = gcc

# binaries and folders
BINDIR = bin
LIBDIR = lib
TEST = $(BINDIR)/test
LIBNAME = chinstrap.so
LIB = $(LIBDIR)/$(LIBNAME)
STATIC = $(LIBDIR)/chinstrap.a

# set library and include paths
INCLUDE = -Iinclude -I/usr/local/include
TESTLIBS = -lcheck#-lyajl
LIBS =

# set compiler and linker flags
CCFLAGS = -fPIC -O3 -W -Wall -std=c99
LDFLAGS = -W -Wall -L/usr/local/lib

# source files
SRCS = $(wildcard source/*.c)

# test source files
TESTSRCS = $(SRCS)
TESTSRCS += $(wildcard tests/test_chinstrap*.c)

# dependencies
# object files
OBJS = $(SRCS:.c=.o)
TESTOBJS = $(TESTSRCS:.c=.o)

# linking rule
$(TEST): $(TESTOBJS) $(BINDIR)
$(LD) $(LDFLAGS) $(TESTOBJS) -o $(TEST) $(TESTLIBS)

# dynamic lib rule
$(LIB): $(OBJS) $(LIBDIR)
$(LD) $(LDFLAGS) -shared -soname,$(LIBNAME) -o $(LIB) $(OBJS) $(LIBS)

# static lib rule
$(STATIC): $(OBJS) $(LIBDIR)
ar rcs $(STATIC) $(OBJS)

# compile rule
.c.o:
$(CC) $(CCFLAGS) $(INCLUDE) -c $< -o $@

$(BINDIR):
@mkdir -p $(BINDIR)

$(LIBDIR):
@mkdir -p $(LIBDIR)

# tasks
.PHONY: clean todo

clean:
@rm -rf tests/*.o
@rm -rf source/*.o
@rm -rf bin
@rm -rf lib

test: $(TEST)
@./bin/test

todo:
@echo >> Existing TODOs in header and source files
@grep -R "TODO:" include/* source/*

dynamiclibrary: $(LIB)

staticlibrary: $(STATIC)
Something went wrong with that request. Please try again.