Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix fpga_compress race condition and isolate it in tools
- Loading branch information
Showing
8 changed files
with
87 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
# Hide full compilation line: | ||
ifneq ($(V),1) | ||
Q?=@ | ||
endif | ||
# To see full command lines, use make V=1 | ||
|
||
CC = gcc | ||
CXX = g++ | ||
LD = g++ | ||
RM = rm -f | ||
MV = mv | ||
|
||
VPATH = ../../common/zlib | ||
OBJDIR = obj | ||
|
||
# RPi Zero gcc requires -latomic | ||
# but MacOSX /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld | ||
# doesn't recognize option --as-needed | ||
ifneq ($(platform),Darwin) | ||
LDLIBS += -Wl,--as-needed -latomic -Wl,--no-as-needed | ||
endif | ||
|
||
LIBS = -I../../common/zlib | ||
INCLUDES_CLIENT = -I../../common_fpga $(LIBS) | ||
|
||
CFLAGS += -std=c99 -D_ISOC99_SOURCE -DPRESETS $(INCLUDES_CLIENT) -Wall -Werror -g -O3 | ||
|
||
# Flags to generate temporary dependency files | ||
DEPFLAGS = -MT $@ -MMD -MP -MF $(OBJDIR)/$*.Td | ||
# make temporary to final dependency files after successful compilation | ||
POSTCOMPILE = $(MV) -f $(OBJDIR)/$*.Td $(OBJDIR)/$*.d | ||
|
||
ZLIBSRCS = deflate.c adler32.c trees.c zutil.c inflate.c inffast.c inftrees.c | ||
ZLIBFLAGS = -DZ_SOLO -DZ_PREFIX -DNO_GZIP -DZLIB_PM3_TUNED | ||
#-DDEBUG -Dverbose=1 | ||
|
||
ZLIBOBJS = $(ZLIBSRCS:%.c=$(OBJDIR)/%.o) | ||
|
||
BINS = fpga_compress | ||
CLEAN = $(BINS) $(DEPENDENCY_FILES) $(ZLIBOBJS) $(OBJDIR)/*.o | ||
|
||
# need to assign dependancies to build these first... | ||
all: $(BINS) | ||
|
||
all-static: LDLIBS:=-static $(LDLIBS) | ||
all-static: $(BINS) | ||
|
||
fpga_compress: $(OBJDIR)/fpga_compress.o $(ZLIBOBJS) | ||
$(info [=] LD $@) | ||
$(Q)$(LD) $(LDFLAGS) $(ZLIBFLAGS) $^ $(LDLIBS) -o $@ | ||
|
||
clean: | ||
$(Q)$(RM) $(CLEAN) | ||
|
||
.PHONY: all clean | ||
|
||
%.o: %.c | ||
$(OBJDIR)/%.o : %.c $(OBJDIR)/%.d | ||
$(info [-] CC $<) | ||
$(Q)$(CC) $(DEPFLAGS) $(CFLAGS) $(ZLIBFLAGS) -c -o $@ $< | ||
$(Q)$(POSTCOMPILE) | ||
|
||
DEPENDENCY_FILES = $(patsubst %.c, $(OBJDIR)/%.d, $(ZLIBSRCS)) $(OBJDIR)/fpga_compress.d | ||
|
||
$(DEPENDENCY_FILES): ; | ||
.PRECIOUS: $(DEPENDENCY_FILES) | ||
|
||
-include $(DEPENDENCY_FILES) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.