-
Notifications
You must be signed in to change notification settings - Fork 0
/
makefile
38 lines (29 loc) · 1.13 KB
/
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
###############################################################################
# makefile
# by Mohamad Elzohbi.
#
# A makefile script for building mixed C & Assembly programs RPI3
#
# *** Note from Paul & Sahil: We were permitted use of this file by a TA,
# *** it taken from the GPIO-V1.1 folder uploaded under "Project" on d2l.
#
###############################################################################
# The intermediate directory for compiled object files.
BUILD = build/
# The directory in which source files are stored.
SOURCE = source/
# The names of all object files that must be generated. Deduced from the
# assembly code files in source.
OBJECTS := $(patsubst $(SOURCE)%.s,$(BUILD)%.o,$(wildcard $(SOURCE)*.s))
COBJECTS := $(patsubst $(SOURCE)%.c,$(BUILD)%.o,$(wildcard $(SOURCE)*.c))
# Rule to make the executable files.
myProg: $(OBJECTS) $(COBJECTS)
gcc -pthread -lwiringPi -o myProg $(OBJECTS) $(COBJECTS)
# Rule to make the object files.
$(BUILD)%.o: $(SOURCE)%.s
as --gstabs -I $(SOURCE) $< -o $@
$(BUILD)%.o: $(SOURCE)%.c
gcc -g -c -O0 -Wall -I $(SOURCE) $< -o $@
# Rule to clean files.
clean :
-rm -f $(BUILD)*.o myProg