+COMMON_FLAGS = -Os
+
+OBJS = $(OBJDIR)/fullimage.s19
+FPGA_COMPRESSOR = ../client/fpga_compress
+
+all: $(OBJS)
+
+.DELETE_ON_ERROR:
+
+$(OBJDIR)/fpga_all.o: $(OBJDIR)/fpga_all.bit.z
+ $(OBJCOPY) -O elf32-littlearm -I binary -B arm --prefix-sections=fpga_all_bit $^ $@
+
+$(OBJDIR)/fpga_all.bit.z: $(FPGA_BITSTREAMS) $(FPGA_COMPRESSOR)
+ $(FPGA_COMPRESSOR) $(filter %.bit,$^) $@
+
+$(FPGA_COMPRESSOR):
+ make -C ../client $(notdir $(FPGA_COMPRESSOR))
+
+$(OBJDIR)/fullimage.stage1.elf: $(VERSIONOBJ) $(OBJDIR)/fpga_all.o $(THUMBOBJ) $(ARMOBJ)
+ $(CC) $(LDFLAGS) -Wl,-T,ldscript,-Map,$(patsubst %.elf,%.map,$@) -o $@ $^ $(LIBS)
+
+$(OBJDIR)/fullimage.nodata.bin: $(OBJDIR)/fullimage.stage1.elf
+ $(OBJCOPY) -O binary -I elf32-littlearm --remove-section .data $^ $@
+
+$(OBJDIR)/fullimage.nodata.o: $(OBJDIR)/fullimage.nodata.bin
+ $(OBJCOPY) -O elf32-littlearm -I binary -B arm --rename-section .data=stage1_image $^ $@