-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmakefile
40 lines (27 loc) · 1.47 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
38
39
40
#This sample makefile has been setup for a project which contains the following files: main.h, ap-main.c, ap-main.h, ap-gen.c, ap-gen.h Edit as necessary for your project
#Change output_file_name.a below to your desired executible filename
#Set all your object files (the object files of all the .c files in your project, e.g. main.o)
OBJS = main.o AXP209.o log.o
#Set any dependant header files so that if they are edited they cause a complete re-compile (e.g. main.h some_subfunctions.h some_definitions_file.h ), or leave blank
DEPS = battery.h AXP209.h log.h
#Any special libraries you are using in your project (e.g. -lbcm2835 -lrt `pkg-config --libs gtk+-3.0` ), or leave blank
#LIBS = -lpthread -lwiringPi
DEBUG = -g
#Set any compiler flags you want to use (e.g. -I/usr/include/somefolder `pkg-config --cflags gtk+-3.0` ), or leave blank
CFLAGS = -Wall -c $(DEBUG)
LFLAGS = -Wall $(DEBUG)
#Set the compiler you are using ( gcc for C or g++ for C++ )
CC = g++
#Set the filename extensiton of your C files (e.g. .c or .cpp )
EXTENSION = .cpp
#define a rule that applies to all files ending in the .o suffix, which says that the .o file depends upon the .c version of the file and all the .h files included in the DEPS macro. Compile each object file
%.o: %$(EXTENSION) $(DEPS)
$(CC) -c -o $@ $< $(CFLAGS)
#Combine them into the output file
#Set your desired exe output file name here
onewire: $(OBJS)
$(CC) -o $@ $^ $(LFLAGS) $(LIBS)
#Cleanup
.PHONY: clean
clean:
rm -f $(OBJS)