-
Notifications
You must be signed in to change notification settings - Fork 0
/
makefile
45 lines (33 loc) · 931 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
38
39
40
41
42
43
44
45
# This makefile has been taken from a previous project "nako"
# https://github.com/FanaticalFighter/nako
CC=gcc
CFLAGS=-c -Wall
LFLAGS=-Wall
DFLAGS=-g -Wextra -Werror
RM=rm
RMFLAGS=-f
# Source files in the project. Append new files here.
SRCS=body.c vector.c
# Create object files list from source files list.
OBJS= $(SRCS:.c=.o)
all: body
all: clean-objects
# clean completely wipes directory of all executables and objects
clean: clean-objects
$(RM) $(RMFLAGS) body
# only removes objects, not final executable
clean-objects:
$(RM) $(RMFLAGS) *.o
clean-data:
$(RM) $(RMFLAGS) *.dat
debug: CFLAGS+=$(DFLAGS)
debug: LFLAGS+=$(DFLAGS)
debug: all
body: $(OBJS)
$(CC) $(LFLAGS) $(OBJS) -o body -lm
# the following magic code is from here:
# http://www.cs.swarthmore.edu/~newhall/unixhelp/howto_makefiles.html
#
# Use with care. This automatically builds all .c files inside the folder.
.c.o:
$(CC) $(CFLAGS) $< -o $@