summaryrefslogtreecommitdiffstats
path: root/rbutil/sansapatcher/Makefile
blob: 85c36c6d14a84ae91b52b1639caf3dcbcfeda25d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#             __________               __   ___.
#   Open      \______   \ ____   ____ |  | _\_ |__   _______  ___
#   Source     |       _//  _ \_/ ___\|  |/ /| __ \ /  _ \  \/  /
#   Jukebox    |    |   (  <_> )  \___|    < | \_\ (  <_> > <  <
#   Firmware   |____|_  /\____/ \___  >__|_ \|___  /\____/__/\_ \
#                     \/            \/     \/    \/            \/

TARGET_DIR ?= $(shell pwd)/
CFLAGS += -Wall -W -D_LARGEFILE64_SOURCE

OUTPUT = sansapatcher

# inputs
LIBSOURCES := sansapatcher.c sansaio-posix.c sansaio-win32.c
SOURCES := main.c
# additional link dependencies for the standalone executable
EXTRADEPS :=

# Releases of sansapatcher are created with "make RELEASE=1".  This
# enables BOOTOBJS and uses the VERSION string defined in main.c
ifdef RELEASE
CFLAGS += -DRELEASE
BOOTOBJS=1
endif

ifdef WITH_BOOTOBJS
BOOTSRC = bootimg_c200.c bootimg_e200.c
SOURCES += $(BOOTSRC)
CFLAGS += -DWITH_BOOTOBJS
endif

include ../libtools.make

# find out if we need to link the manifest resource.
# Since libtools.make sets up BINARY we check it for the file extension .exe.
ifeq ($(findstring exe,$(BINARY)),exe)
$(BINARY): $(OBJDIR)sansapatcher-rc.o
endif

$(OBJDIR)main.o: $(BOOTSRC)
$(OBJDIR)sansapatcher-rc.o: sansapatcher.rc sansapatcher.manifest
	@echo WINDRES $(notdir $<)
	$(SILENT)$(CROSS)$(WINDRES) -i sansapatcher.rc -o $@

bootimg_c200.c: firmware.mi4 $(BIN2C)
	@echo BIN2C $<
	$(SILENT)$(BIN2C) $< $*

bootimg_e200.c: PP5022.mi4 $(BIN2C)
	@echo BIN2C $< $*
	$(SILENT)$(BIN2C) $< $*