-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
44 lines (34 loc) · 1.04 KB
/
Makefile
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
# Makefile for httpserver
# (C) Ramsey Kant 2011-2012
CC := g++
SRCDIR := src
BINDIR := bin
BUILDDIR := build
TARGET := httpserver
UNAME := $(shell uname)
# Debug Flags
DEBUGFLAGS := -g3 -O0 -Wall
RTCHECKS := -fmudflap -fstack-check -gnato
# Production Flags
PRODFLAGS := -Wall -O2
ifeq ($(UNAME), Linux)
# Linux Flags
CFLAGS := -std=c++11 -Iinclude/ $(DEBUGFLAGS)
LINK := -lpthread -lkqueue $(DEBUGFLAGS)
#LINK := -lpthread -lkqueue $(DEBUGFLAGS)
else
# OSX / BSD Flags
CFLAGS := -std=c++11 -stdlib=libc++ -Iinclude/ $(DEBUGFLAGS)
LINK := -stdlib=libc++ $(DEBUGFLAGS)
endif
SRCEXT := cpp
SOURCES := $(shell find $(SRCDIR) -type f -name *.$(SRCEXT))
OBJECTS := $(patsubst $(SRCDIR)/%,$(BUILDDIR)/%,$(SOURCES:.$(SRCEXT)=.o))
$(TARGET): $(OBJECTS)
@echo " Linking..."$(LINK); $(CC) $^ -o $(BINDIR)/$(TARGET) $(LINK)
$(BUILDDIR)/%.o: $(SRCDIR)/%.$(SRCEXT)
@mkdir -p $(BUILDDIR)
@echo " CC $<"; $(CC) $(CFLAGS) -c -o $@ $<
clean:
@echo " Cleaning..."; rm -r $(BUILDDIR) $(BINDIR)/$(TARGET)*
.PHONY: clean