2 # Open \______ \ ____ ____ | | _\_ |__ _______ ___
3 # Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
4 # Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
5 # Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
10 INCLUDES
= -I
$(APPSDIR
) -I..
-I.
-I
$(APPSDIR
)/plugins
/lib \
11 $(TARGET_INC
) -I
$(FIRMDIR
)/include -I
$(FIRMDIR
)/export \
12 -I
$(FIRMDIR
)/common
-I
$(FIRMDIR
)/drivers
-I
$(OUTDIR
) -I
$(BUILDDIR
) \
13 -I
$(BUILDDIR
)/pluginbitmaps
14 CFLAGS
= $(INCLUDES
) $(GCCOPTS
) $(TARGET
) $(EXTRA_DEFINES
) \
15 -DTARGET_ID
=$(TARGET_ID
) -DMEM
=${MEMORYSIZE} -DPLUGIN
18 INCLUDES
+= $(patsubst %,-I
$(APPSDIR
)/%,$(subst :, ,$(APPEXTRA
)))
21 LINKFILE
:= $(OBJDIR
)/link.lds
22 DEPFILE
= $(OBJDIR
)/dep-clock
24 # This sets up 'SRC' based on the files mentioned in SOURCES
25 include $(TOOLSDIR
)/makesrc.inc
28 OBJS
:= $(SRC
:%.c
=$(OBJDIR
)/%.o
)
33 OUTPUT
= $(OUTDIR
)/clock.rock
35 OUTPUT
= $(OUTDIR
)/clock.rock
41 $(OBJDIR
)/clock.elf
: $(OBJS
) $(LINKFILE
) $(BITMAPLIBS
)
42 $(call PRINTS
,LD
$(@F
))$(CC
) $(GCCOPTS
) -O
-nostdlib
-o
$@
$(OBJS
) -L
$(BUILDDIR
) -lplugin
-lgcc \
43 $(LINKBITMAPS
) -T
$(LINKFILE
) -Wl
,--gc-sections
-Wl
,-Map
,$(OBJDIR
)/clock.map
45 $(OUTPUT
): $(OBJDIR
)/clock.elf
46 $(call PRINTS
,OBJCOPY
$(@F
))$(OC
) -O binary
$< $@
50 ###################################################
51 # This is the X11 simulator version
54 $(call PRINTS
,LD
$(@F
))$(CC
) $(CFLAGS
) $(SHARED_FLAG
) $(OBJS
) -L
$(BUILDDIR
) -lplugin
$(LINKBITMAPS
) -o
$@
55 ifeq ($(findstring CYGWIN
,$(UNAME
)),CYGWIN
)
56 # 'x' must be kept or you'll have "Win32 error 5"
57 # $ fgrep 5 /usr/include/w32api/winerror.h | head -1
58 # #define ERROR_ACCESS_DENIED 5L
63 else # end of x11-simulator
65 ###################################################
66 # This is the SDL simulator version
69 $(call PRINTS
,LD
$(@F
))$(CC
) $(CFLAGS
) $(SHARED_FLAG
) $(OBJS
) -L
$(BUILDDIR
) -lplugin
$(LINKBITMAPS
) -o
$@
70 ifeq ($(findstring CYGWIN
,$(UNAME
)),CYGWIN
)
71 # 'x' must be kept or you'll have "Win32 error 5"
72 # $ fgrep 5 /usr/include/w32api/winerror.h | head -1
73 # #define ERROR_ACCESS_DENIED 5L
78 else # end of sdl-simulator
79 ###################################################
80 # This is the win32 simulator version
81 DLLTOOLFLAGS
= --export-all
82 DLLWRAPFLAGS
= -s
--entry _DllMain@
12 --target
=i386-mingw32
-mno-cygwin
85 $(call PRINTS
,DLL
$(@F
))$(DLLTOOL
) $(DLLTOOLFLAGS
) -z
$(OBJDIR
)/$*.def
$(OBJS
)
86 $(SILENT
)$(DLLWRAP
) $(DLLWRAPFLAGS
) --def
$(OBJDIR
)/$*.def
$(OBJS
) \
87 $(BUILDDIR
)/libplugin.a
$(BITMAPLIBS
) -o
$@
88 ifeq ($(findstring CYGWIN
,$(UNAME
)),CYGWIN
)
89 # 'x' must be kept or you'll have "Win32 error 5"
90 # $ fgrep 5 /usr/include/w32api/winerror.h | head -1
91 # #define ERROR_ACCESS_DENIED 5L
95 endif # end of win32-simulator
97 endif # end of simulator section
100 include $(TOOLSDIR
)/make.inc
102 # MEMORYSIZE should be passed on to this makefile with the chosen memory size
103 # given in number of MB
105 $(call PRINTS
,build
$(@F
))cat
$< |
$(CC
) -DMEMORYSIZE
=$(MEMORYSIZE
) $(INCLUDES
) $(TARGET
) \
106 $(DEFINES
) -E
-P
- >$@
109 $(call PRINTS
,cleaning clock
)rm -rf
$(OBJDIR
)/clock
110 $(SILENT
)rm -f
$(OBJDIR
)/clock.
* $(DEPFILE
)