-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
58 lines (43 loc) · 1.02 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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
CC=gcc
# libs third party: pthread/allegro/math
LIBS=-pthread `allegro-config --libs` -lm
# Headers
IDIR=include
CFLAGS=-I$(IDIR)
DEPS=$(IDIR)/*.h
# Sources
SDIR = src
SRC = $(wildcard src/*.c)
# Objects
BDIR = build
OBJ=$(patsubst src/%.c, build/%.o, $(SRC))
$(BDIR)/%.o: $(SDIR)/%.c $(DEPS)
@mkdir -p $(BDIR)
$(CC) -c -o $@ $< $(CFLAGS)
city: $(OBJ)
@mkdir -p bin/
$(CC) -o bin/$@ $^ $(CFLAGS) $(LIBS)
git:
(git commit -a; git push)
clean:
rm -f $(BDIR)/*.o
# CC := gcc
# SRCDIR := src
# BUILDDIR := build
# TEST := test/test.c
# TARGET := bin/city
# TESTTARGET := bin/test_city
# SRC := $(shell find $(SRCDIR) -type f -name *.c)
# OBJ := $(patsubst $(SRCDIR)/%, $(BUILDDIR)/%, $(SRC:.c=.o))
# CFLAGS := -Wall
# LIB := -pthread -L lib
# INC := -I./include/
# $(BUILDDIR)/%.o: $(SRC) $(INC)
# @mkdir -p $(BUILDDIR)
# $(CC) -c -o $@ $< $(CFLAGS)
# $(TARGET): $(OBJ)
# $(CC) -o $@ $^ $(CFLAGS) $(LIB)
# clean:
# rm $(BUILDDIR)/*.o $(TARGET)
# test:
# $(CC) $(CFLAGS) $(test) $(INC) $(LIB) -o $(TESTTARGET)