Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build output goes into the bin folder. #936

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 19 additions & 17 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ INCLUDE += -I./lib/libchdr/include
INCLUDE += -I./lib/bluetooth
INCLUDE += -I./lib/serial_server/library

BUILDDIR = bin

PRJ = MiSTer
C_SRC = $(wildcard *.c) \
$(wildcard ./lib/miniz/*.c) \
Expand All @@ -34,63 +36,63 @@ C_SRC = $(wildcard *.c) \
$(wildcard ./lib/zstd/lib/common/*.c) \
$(wildcard ./lib/zstd/lib/decompress/*.c) \
$(wildcard ./lib/libchdr/*.c) \
lib/libco/arm.c
lib/libco/arm.c

CPP_SRC = $(wildcard *.cpp) \
$(wildcard ./lib/serial_server/library/*.cpp) \
$(wildcard ./support/*/*.cpp)
$(wildcard ./support/*/*.cpp)

IMG = $(wildcard *.png)

IMLIB2_LIB = -Llib/imlib2 -lfreetype -lbz2 -lpng16 -lz -lImlib2

OBJ = $(C_SRC:.c=.c.o) $(CPP_SRC:.cpp=.cpp.o) $(IMG:.png=.png.o)
DEP = $(C_SRC:.c=.c.d) $(CPP_SRC:.cpp=.cpp.d)
OBJ = $(C_SRC:%.c=$(BUILDDIR)/%.c.o) $(CPP_SRC:%.cpp=$(BUILDDIR)/%.cpp.o) $(IMG:%.png=$(BUILDDIR)/%.png.o)
DEP = $(C_SRC:%.c=$(BUILDDIR)/%.c.d) $(CPP_SRC:%.cpp=$(BUILDDIR)/%.cpp.d)

DFLAGS = $(INCLUDE) -D_7ZIP_ST -DPACKAGE_VERSION=\"1.3.3\" -DHAVE_LROUND -DHAVE_STDINT_H -DHAVE_STDLIB_H -DHAVE_SYS_PARAM_H -DENABLE_64_BIT_WORDS=0 -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -DVDATE=\"`date +"%y%m%d"`\"
CFLAGS = $(DFLAGS) -Wall -Wextra -Wno-strict-aliasing -Wno-stringop-overflow -Wno-stringop-truncation -Wno-format-truncation -Wno-psabi -Wno-restrict -c -O3
LFLAGS = -lc -lstdc++ -lm -lrt $(IMLIB2_LIB) -Llib/bluetooth -lbluetooth -lpthread

OUTPUT_FILTER = sed -e 's/\(.[a-zA-Z]\+\):\([0-9]\+\):\([0-9]\+\):/\1(\2,\ \3):/g'
OUTPUT_FILTER = sed -e 's/\(.[a-zA-Z]\+\):\([0-9]\+\):\([0-9]\+\):/\1(\2,\ \3):/g'

ifeq ($(PROFILING),1)
DFLAGS += -DPROFILING
endif

$(PRJ): $(OBJ)
$(BUILDDIR)/$(PRJ): $(OBJ)
$(Q)$(info $@)
$(Q)$(CC) -o $@ $+ $(LFLAGS)
$(Q)$(CC) -o $@ $+ $(LFLAGS)
$(Q)cp $@ [email protected]
$(Q)$(STRIP) $@

.PHONY: clean
clean:
$(Q)rm -f *.elf *.map *.lst *.user *~ $(PRJ)
$(Q)rm -rf obj DTAR* x64
$(Q)find . \( -name '*.o' -o -name '*.d' -o -name '*.bak' -o -name '*.rej' -o -name '*.org' \) -exec rm -f {} \;
$(Q)rm -rf bin

%.c.o: %.c
$(BUILDDIR)/%.c.o: %.c
$(Q)$(info $<)
$(Q)$(CC) $(CFLAGS) -std=gnu99 -o $@ -c $< 2>&1 | $(OUTPUT_FILTER)

%.cpp.o: %.cpp
$(BUILDDIR)/%.cpp.o: %.cpp
$(Q)$(info $<)
$(Q)$(CC) $(CFLAGS) -std=gnu++14 -Wno-class-memaccess -o $@ -c $< 2>&1 | $(OUTPUT_FILTER)

%.png.o: %.png
$(BUILDDIR)/%.png.o: %.png
$(Q)$(info $<)
$(Q)$(LD) -r -b binary -o $@ $< 2>&1 | $(OUTPUT_FILTER)

ifneq ($(MAKECMDGOALS), clean)
-include $(DEP)
endif
%.c.d: %.c
$(BUILDDIR)/%.c.d: %.c
@mkdir -p $(dir $(BUILDDIR)/$*)
$(Q)$(info $< >> $@)
$(Q)$(CC) $(DFLAGS) -MM $< -MT $@ -MT $*.c.o -MF $@ 2>&1 | $(OUTPUT_FILTER)

%.cpp.d: %.cpp
$(BUILDDIR)/%.cpp.d: %.cpp
@mkdir -p $(dir $(BUILDDIR)/$*)
$(Q)$(info $< >> $@)
$(Q)$(CC) $(DFLAGS) -MM $< -MT $@ -MT $*.cpp.o -MF $@ 2>&1 | $(OUTPUT_FILTER)

# Ensure correct time stamp
main.cpp.o: $(filter-out main.cpp.o, $(OBJ))
$(BUILDDIR)/main.cpp.o: $(filter-out $(BUILDDIR)/main.cpp.o, $(OBJ))
3 changes: 2 additions & 1 deletion build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
# create simple text file named 'host' in this folder with IP address of your MiSTer.

HOST=192.168.1.75
BUILDDIR=bin
[ -f host ] && HOST=$(cat host)

# make script fail if any command failed,
Expand All @@ -22,7 +23,7 @@ open $HOST
user root 1
passive
binary
put MiSTer /media/fat/MiSTer
put $(BUILDDIR)/MiSTer /media/fat/MiSTer
EOF

plink root@$HOST -pw 1 -batch 'sync;PATH=/media/fat:$PATH;MiSTer >/dev/ttyS0 2>/dev/ttyS0 </dev/null &'