aboutsummaryrefslogtreecommitdiff
path: root/Makefile
blob: 78d7bcc812d8d37168ade76d27ced780ea7cbc34 (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
CC      = /usr/bin/gcc
CFLAGS  = -Wall
LDFLAGS = -lm
SOURCEDIR = src
OUTPUT = asciimap
BUILDDIR = build
PREFIX = /

FILE = 022.bmp
SRCS = $(wildcard $(SOURCEDIR)/*.c)
OBJ = $(SRCS:.c=.o)

build: $(OBJ)
	mkdir -p $(BUILDDIR)
	$(CC) $(CFLAGS) -o $(BUILDDIR)/$(OUTPUT) $(OBJ) $(LDFLAGS)

debug: CFLAGS+= -g -D _DEBUG
debug: build;

gdb: debug
	gdb $(BUILDDIR)/$(OUTPUT)

%.o: %.c
	@echo [ CC ] $<
	@$(CC) $(CFLAGS) -c $< -o $@

all: clean build

.PHONY: clean

clean:
	rm -df  $(OBJ)
	rm -Rdf $(BUILDDIR)

run: build
	$(BUILDDIR)/$(OUTPUT) $(FILE)

install: build
	@cp $(BUILDDIR)/$(OUTPUT) $(PREFIX)/bin/$(OUTPUT)