Skip to content

Commit

Permalink
Improve firmware makefile
Browse files Browse the repository at this point in the history
  • Loading branch information
hutorny committed Nov 23, 2023
1 parent 5e85ad0 commit 1812236
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,11 @@ output_files/
output_files_cl_016/
output_files_cl_025/

# Eclipse files
.cproject
.project
.settings/
# Build/stage directories
stage/
build/

Expand Down
17 changes: 9 additions & 8 deletions SBC/rpi-4/device_driver/firmware/Makefile
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
CC=gcc
LINK=gcc
INSTALL = install
BLDDIR = $(BUILDDIR:%=%/)

OPTIONS=-g -O3

LIBS=-lrt -lm -lpthread

COMPILE=$(CC) $(OPTIONS) $(INCLUDES)

PROGRAM=radioberry
PROGRAM=$(BLDDIR)radioberry

SOURCES= \
measure.c \
Expand All @@ -28,22 +30,21 @@ bias.o \
measure.o \
radioberry.o

all: prebuild $(PROGRAM) $(HEADERS) $(SOURCES)
all: prebuild $(PROGRAM) | $(HEADERS) $(SOURCES)

prebuild:
rm -f version.o

$(PROGRAM): $(OBJS)
$(LINK) -o $(PROGRAM) $(OBJS) $(LIBS)
$(PROGRAM): $(OBJS:%.o=$(BLDDIR)%.o)
$(LINK) -o $(PROGRAM) $^ $(LIBS)

.c.o:
$(BLDDIR)%.o: %.c
$(COMPILE) -c -o $@ $<


clean:
-rm -f *.o
-rm -f $(BLDDIR)*.o
-rm -f $(PROGRAM)

install: $(PROGRAM)
cp $(PROGRAM) /usr/local/bin
$(INSTALL) $(PROGRAM) $(DESTDIR)/usr/local/bin

0 comments on commit 1812236

Please sign in to comment.