blob: 0e19cbfddb1a5bbb6f1181926e89712c16c72818 (
plain)
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
|
CC = clang
CFLAGS = -Wall
LDFLAGS = -lm
SOURCEDIR = src
BUILDDIR = build
OBJDIR = $(BUILDDIR)/obj
OUTPUT = asciimap
PREFIX = /
FILE = 022.bmp
SRCS = $(wildcard $(SOURCEDIR)/*.c)
OBJT = $(SRCS:.c=.o)
OBJ = $(OBJT:$(SOURCEDIR)/%=$(OBJDIR)/%)
.PHONY: build
build: dir $(OBJ)
@echo [LINK] $(OBJ)
@$(CC) $(CFLAGS) -o $(BUILDDIR)/$(OUTPUT) $(OBJ) $(LDFLAGS)
dir:
@mkdir -p $(OBJDIR)
@mkdir -p $(BUILDDIR)
debug: CFLAGS+= -g -D _DEBUG
debug: build;
gdb: debug
gdb $(BUILDDIR)/$(OUTPUT)
$(OBJDIR)/%.o: $(SOURCEDIR)/%.c
@echo [ CC ] $<
@$(CC) $(CFLAGS) -c $< -o $@
all: clean build
.PHONY: clean
clean:
rm -Rdf $(OBJDIR)
rm -Rdf $(BUILDDIR)
run: build
$(BUILDDIR)/$(OUTPUT) $(FILE)
install: build
@strip $(BUILDDIR)/$(OUTPUT)
@cp $(BUILDDIR)/$(OUTPUT) $(PREFIX)/bin/$(OUTPUT)
|