-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmakefile
37 lines (29 loc) · 783 Bytes
/
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
TARGET = Polygons
# Compile
CC = gcc
CFLAGS = -std=c99 -Wall -c -I.
# Linker
LINKER = gcc
SDL = -I /usr/local/include/SDL2/ -F /Library/Frameworks -framework SDL2
LFLAGS = -Wall -I. -lm $(SDL)
# Directories
SRCDIR = src
OBJDIR = obj
BINDIR = bin
SOURCES := $(wildcard $(SRCDIR)/*.c)
INCLUDES := $(wildcard $(SRCDIR)/*.h)
OBJECTS := $(SOURCES:$(SRCDIR)/%.c=$(OBJDIR)/%.o)
$(BINDIR)/$(TARGET).exe: $(OBJECTS)
@$(LINKER) $(OBJECTS) $(LFLAGS) -o $@
@echo "Linking complete!"
$(OBJECTS): $(OBJDIR)/%.o : $(SRCDIR)/%.c
@$(CC) $(CFLAGS) -c $< -o $@
@echo "Compiled "$<" successfully!"
.PHONY: clean
clean:
@rm -f $(OBJECTS)
@echo "Cleanup complete!"
.PHONY: remove
remove: clean
@rm -f $(BINDIR)/$(TARGET)
@echo "Executable removed!"