makefile 819 Bytes
Newer Older
denis's avatar
denis committed
1
CC = clang
2 3 4 5
CXX = g++
CSRCPATH = $(wildcard src/*.c)
CXXSRCPATH = $(wildcard src/*.cpp)
OBJPATH = $(addprefix build/,$(notdir $(CSRCPATH:.c=.o) $(CXXSRCPATH:.cpp=.o)))
denis's avatar
denis committed
6 7
INCLUDES = -I/usr/include/mysql
LIBS = -L/usr/lib/mysql -lmysqlclient -lm
8
CFLAGS = -Wall -O2 -pedantic -Wextra -std=c99
9 10
CCFLAGS=-Wall -std=c++11
LDFLAGS=-Wall -lstdc++
denis's avatar
denis committed
11

12
.PHONY: all clean debug
13

denis's avatar
denis committed
14 15
all:ichinscratchy

16 17
debug: CFLAGS := $(filter-out -O2, $(CFLAGS))
debug: CCFLAGS:= $(filter-out -O2, $(CCFLAGS))
18 19
debug: CFLAGS += -DDEBUG -g -O0
debug: CCFLAGS += -DDEBUG -g -O0
20 21
debug: ichinscratchy

denis's avatar
denis committed
22
ichinscratchy: $(OBJPATH)
23
	$(CC) -o $@ $^ $(LIBS) $(LDFLAGS) -lm -L/usr/lib/mysql/ -lmysqlclient
denis's avatar
denis committed
24 25

build/%.o: src/%.c
26
	$(CC) $(CFLAGS) -c $(INCLUDES) -o $@ $<
27 28

build/%.o: src/%.cpp
29
	$(CXX) $(CCFLAGS) -c -o $@ $<
denis's avatar
denis committed
30
	
31
clean:
denis's avatar
denis committed
32 33
	rm -f $(OBJPATH)
	rm -f ichinscratchy