aboutsummaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorGravatar Jonas Gunz <himself@jonasgunz.de> 2020-05-25 16:49:32 +0200
committerGravatar Jonas Gunz <himself@jonasgunz.de> 2020-05-25 16:49:32 +0200
commit5272a688ef7e6923ae5ee62ca150f75e47d16e57 (patch)
tree47840b945b3e26e7a62f037c29a2df5131d4da01 /Makefile
parentf7b85bb8dd71c4e63935dadf5465781240a7b258 (diff)
downloadAsciiMap-5272a688ef7e6923ae5ee62ca150f75e47d16e57.tar.gz
Update Makefile. directory structure + .gitignore
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile18
1 files changed, 11 insertions, 7 deletions
diff --git a/Makefile b/Makefile
index 0374be2..69b0c04 100644
--- a/Makefile
+++ b/Makefile
@@ -2,36 +2,40 @@ CC = clang
CFLAGS = -Wall
LDFLAGS = -lm
SOURCEDIR = src
-OUTPUT = asciimap
BUILDDIR = build
+OBJDIR = $(BUILDDIR)/obj
+OUTPUT = asciimap
PREFIX = /
FILE = 022.bmp
SRCS = $(wildcard $(SOURCEDIR)/*.c)
-OBJ = $(SRCS:.c=.o)
+OBJT = $(SRCS:.c=.o)
+OBJ = $(OBJT:$(SOURCEDIR)/%=$(OBJDIR)/%)
.PHONY: build
-build: $(OBJ)
- @mkdir -p $(BUILDDIR)
+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)
-%.o: %.c
+$(OBJDIR)/%.o: $(SOURCEDIR)/%.c
@echo [ CC ] $<
@$(CC) $(CFLAGS) -c $< -o $@
all: clean build
.PHONY: clean
-
clean:
- rm -df $(OBJ)
+ rm -Rdf $(OBJDIR)
rm -Rdf $(BUILDDIR)
run: build