Improve firmware makefile

pull/45/head
Eugene Hutorny 2023-11-05 18:45:28 +02:00
rodzic 5e85ad0f79
commit 1812236529
2 zmienionych plików z 11 dodań i 8 usunięć

2
.gitignore vendored
Wyświetl plik

@ -10,9 +10,11 @@ output_files/
output_files_cl_016/
output_files_cl_025/
# Eclipse files
.cproject
.project
.settings/
# Build/stage directories
stage/
build/

Wyświetl plik

@ -1,5 +1,7 @@
CC=gcc
LINK=gcc
INSTALL = install
BLDDIR = $(BUILDDIR:%=%/)
OPTIONS=-g -O3
@ -7,7 +9,7 @@ LIBS=-lrt -lm -lpthread
COMPILE=$(CC) $(OPTIONS) $(INCLUDES)
PROGRAM=radioberry
PROGRAM=$(BLDDIR)radioberry
SOURCES= \
measure.c \
@ -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