BINS = ascii class depipe_strings dup fpipe pipe realloc strpbrk strsep \
       tokenizer getopt prime_mask linked_list pi_bbp string_tokenizer  \
       tcpserver tcpclient regexp c99 asm playground_05-25-2011

CURL = curl_tomem curl_tofile

CC = gcc
CFLAGS = -Wall -std=gnu99 -pedantic
DBGFLAGS = -g -O0
ifdef DEBUG
    CFLAGS += $(DBGFLAGS) -D DEBUG
else
    CFLAGS += -O2 -mtune=native -march=native
endif
LDFLAGS = -lm

all: $(BINS) $(CURL)

$(BINS): %: %.c
	$(CC) $(CFLAGS) $^ -o $@

$(CURL): %: %.c
	$(CC) `curl-config --libs` $(CFLAGS) $^ -o $@

.PHONY: clean

clean:
	rm -f ./$(BINS) ./$(CURL)