-
Notifications
You must be signed in to change notification settings - Fork 0
/
my_needle.makefile
36 lines (31 loc) · 918 Bytes
/
my_needle.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
# Makefile for my_needle.cpp
CC = g++
CFLAGS = -Wall -O3
DEBUGFLAGS = -Wall -DDEBUG -ggdb
STATICFLAGS = -Wall -O3 -static
SRC = my_needle.cpp
OBJ = $(SRC:.cpp=.o)
DEBUGOBJ = $(SRC:.cpp=_debug.o)
STATICOBJ = $(SRC:.cpp=_static.o)
EXE = my_needle
DEBUGEXE = my_needle_debug
STATICEXE = my_needle_static
RM = /bin/rm -f
CP = /bin/cp -f
#compile and assemble C++/C source files into object files -c flag tells the compiler to create only OBJ files
$(EXE): $(OBJ)
$(CC) $(CFLAGS) $(OBJ) -o $(EXE)
$(OBJ): $(SRC)
$(CC) $(CFLAGS) -c $(SRC)
debug: $(DEBUGOBJ)
$(CC) $(DEBUGFLAGS) $(DEBUGOBJ) -o $(DEBUGEXE)
%_debug.o: %.cpp
$(CC) $(DEBUGFLAGS) -c $< -o $@
static: $(STATICOBJ)
$(CC) $(STATICFLAGS) $(STATICOBJ) -o $(STATICEXE)
%_static.o: %.cpp
$(CC) $(STATICFLAGS) -c $< -o $@
install:
$(CP) $(EXE) $(BINPATH)
clean:
$(RM) $(OBJ) $(DEBUGOBJ)