Brushed up, made it more like the win32 makefile

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@4928 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Linus Nielsen Feltzing 2004-07-23 21:06:03 +00:00
parent f215562afd
commit 865effac7e

View file

@ -21,41 +21,55 @@ APPDIR = ../../apps
RECDIR = $(APPDIR)/recorder
PLAYDIR = $(APPDIR)/player
PLUGINDIR = $(APPDIR)/plugins
SIMCOMMON = ../common
ifeq ($(DISPLAY),-DHAVE_LCD_BITMAP)
MACHINEDIR = $(RECDIR)
# not very nice to set RTC like this, but...
RTC += -DHAVE_RTC
# not very nice to set RADIO like this, but...
RADIO += -DHAVE_FMRADIO
MACHINEDIR = $(RECDIR)
# not very nice to set config stuff like this, but...
RTC += -DHAVE_RTC
RADIO += -DHAVE_FMRADIO
else
MACHINEDIR = $(PLAYDIR)
MACHINEDIR = $(PLAYDIR)
endif
PREVAPPDIR= ..
FIRMWAREDIR = ../../firmware
COMMON = $(FIRMWAREDIR)/common
SIMCOMMON = ../common
# build some sources from these dirs
DRIVERS = $(FIRMWAREDIR)/drivers
COMMON = $(FIRMWAREDIR)/common
# include here:
EXPORT = $(FIRMWAREDIR)/export
TOOLSDIR = ../../tools
DOCSDIR = ../../docs
CC = gcc
RM = rm -f
DEBUG = -g
# where to put all output files
OBJDIR = .
ifndef OBJDIR
no_configure:
@echo "Don't run make here. Run the tools/configure script from your own build"
@echo "directory, then run make there."
@echo
@echo "More help on how to build rockbox can be found here:"
@echo "http://rockbox.haxx.se/docs/how_to_compile.html"
endif
TARGET = $(OBJDIR)/rockboxui
LANGUAGE = english
DEFINES = -DHAVE_CONFIG_H -DGETTIMEOFDAY_TWO_ARGS -DSIMULATOR \
$(KEYPAD) $(DISPLAY) $(EXTRA_DEFINES) $(RTC) $(RADIO)
TARGET = $(OBJDIR)/rockboxui
DEFINES = -DHAVE_CONFIG_H -DGETTIMEOFDAY_TWO_ARGS -DSIMULATOR \
$(KEYPAD) $(DISPLAY) -DAPPSVERSION=\"$(VERSION)\" $(EXTRA_DEFINES) \
$(RTC) $(RADIO)
# Use this for simulator-only files
INCLUDES = -I. -I$(DRIVERS) -I$(FIRMWAREDIR)/export -I$(APPDIR) \
-I$(MACHINEDIR) -I$(SIMCOMMON) -I$(OBJDIR)
INCLUDES = -I. -I$(EXPORT) -I$(APPDIR) -I$(MACHINEDIR) -I$(SIMCOMMON) -I$(OBJDIR) -I$(PLUGINDIR)/lib
# The true Rockbox Applications should use this include path:
APPINCLUDES = $(INCLUDES)
SRCDIRS = . $(DRIVERS) $(FIRMWAREDIR)/export $(APPDIR) $(MACHINEDIR)
# The true Rockbox Applications should use this include path:
@ -63,6 +77,10 @@ APPINCLUDES = $(INCLUDES)
LIBS = -lpthread
CFLAGS = $(DEBUG) $(DEFINES) $(INCLUDES) -W -Wall
APPCFLAGS = $(DEBUG) $(DEFINES) $(APPINCLUDES) -W -Wall
UNAME := $(shell uname|sed -e "s/CYGWIN.*/CYGWIN/")
ifeq ($(UNAME),Linux)
LDFLAGS = -lX11 -lm -lXt -lXmu -lnsl -ldl
@ -90,17 +108,6 @@ endif
endif
endif
CFLAGS = $(DEBUG) $(DEFINES) $(INCLUDES) -W -Wall
APPCFLAGS = $(DEBUG) $(DEFINES) -DAPPSVERSION=\"$(VERSION)\" $(APPINCLUDES) -W -Wall
ifeq ($(DISPLAY),-DHAVE_LCD_BITMAP)
LCDSRSC = lcd-recorder.c sysfont.c font.c
else
LCDSRSC = lcd-playersim.c lcd-player.c font-player.c lcd-player-charset.c
endif
COMMONSRCS = io.c
ifeq ($(HAVE_MPEG_PLAY),1)
SOUNDSRC = mpegplay.c oss_sound.c
LDFLAGS += $(SOUND_LDFLAGS)
@ -109,122 +116,61 @@ else
SOUNDSRC =
endif
FIRMSRCS = $(LCDSRSC) id3.c debug.c usb.c mpeg.c mp3_playback.c power.c\
powermgmt.c panic.c mp3data.c sprintf.c buffer.c timefuncs.c
ifeq ($(DISPLAY),-DHAVE_LCD_BITMAP)
LCDSRSC = lcd-recorder.c sysfont.c font.c
else
LCDSRSC = lcd-playersim.c lcd-player.c lcd-player-charset.c font-player.c
endif
COMMONSRCS = io.c stubs.c lcd-common.c sim_icons.c fmradio.c
APPS = main.c tree.c menu.c credits.c main_menu.c language.c\
playlist.c wps.c wps-display.c settings.c status.c icons.c\
screens.c peakmeter.c sleeptimer.c keyboard.c onplay.c\
misc.c plugin.c playlist_viewer.c bookmark.c filetypes.c
FIRMSRCS = $(LCDSRSC) id3.c mp3data.c usb.c mpeg.c mp3_playback.c \
powermgmt.c power.c sprintf.c buffer.c strtok.c random.c \
timefuncs.c panic.c debug.c
MENUS = settings_menu.c sound_menu.c playlist_menu.c
APPS = main.c tree.c menu.c credits.c main_menu.c icons.c language.c \
playlist.c wps.c wps-display.c settings.c status.c \
screens.c sleeptimer.c keyboard.c onplay.c\
misc.c plugin.c playlist_viewer.c bookmark.c filetypes.c \
settings_menu.c sound_menu.c playlist_menu.c
ifeq ($(DISPLAY),-DHAVE_LCD_BITMAP)
APPS += bmp.c widgets.c radio.c
APPS += peakmeter.c bmp.c widgets.c radio.c
endif
SRCS = screenhack.c uibasic.c resources.c visual.c lcd-x11.c stubs.c \
button-x11.c thread.c sim_icons.c $(APPS) $(MENUS) $(FIRMSRCS) \
$(COMMONSRCS) $(SOUNDSRC) lcd-common.c fmradio.c
ROCKSRC := $(wildcard $(APPDIR)/plugins/*.c)
ROCKS := $(ROCKSRC:$(APPDIR)/plugins/%.c=$(OBJDIR)/%.rock)
SRCS = screenhack.c uibasic.c resources.c visual.c lcd-x11.c \
button-x11.c thread.c $(APPS) $(MENUS) $(FIRMSRCS) \
$(COMMONSRCS) $(SOUNDSRC)
OBJS := $(OBJDIR)/lang.o $(SRCS:%.c=$(OBJDIR)/%.o)
all: $(TOOLSDIR)/convbdf $(TARGET) $(EXTRA_TARGETS) $(ROCKS)
ROCKS := $(patsubst $(PLUGINDIR)/%.c,$(OBJDIR)/%.rock,$(wildcard $(PLUGINDIR)/*.c))
PLUGINLIBOBJS := $(patsubst $(PLUGINDIR)/lib/%.c,$(OBJDIR)/%.o,$(wildcard $(PLUGINDIR)/lib/*.c))
all: $(TOOLSDIR)/convbdf $(TARGET) $(ROCKS)
$(ROCKS): $(OBJDIR)/libplugin.a
$(TOOLSDIR)/convbdf:
$(MAKE) -C $(TOOLSDIR)
$(OBJDIR)/libplugin.a:
$(MAKE) -C $(PLUGINDIR)/lib DEBUG=$(DEBUG) OBJDIR=$(OBJDIR) VERSION=$(VERSION) EXTRA_DEFINES="$(EXTRA_DEFINES)" SIMULATOR=1
clean:
$(RM) $(OBJS) *~ core $(TARGET) $(CLIENTS) $(OBJDIR)/lang.[cho] \
$(OBJDIR)/build.lang $(OBJDIR)/*.o $(OBJDIR)/sysfont.c \
$(ROCKS) $(OBJDIR)/credits.raw
$(OBJDIR)/build.lang $(OBJDIR)/*.o $(OBJDIR)/sysfont.c \
$(ROCKS) $(OBJDIR)/credits.raw
$(RM) -r $(DEPS)
$(RM) -f $(OBJDIR)/libplugin.a $(OBJDIR)/rockbox.zip
$(OBJDIR)/%.rock: $(APPDIR)/plugins/%.c $(APPDIR)/plugin.h
$(CC) $(APPCFLAGS) -DPLUGIN -L$(OBJDIR) -lplugin -shared $< -o $@
distclean: clean
$(RM) config.cache
################## Specific dependencies ##################
$(OBJDIR)/credits.raw: $(DOCSDIR)/CREDITS
perl $(APPDIR)/credits.pl < $< > $@
$(OBJDIR)/uisw32-res.o: uisw32.rc
$(WINDRES) -i $< -o $@
$(OBJDIR)/credits.o: $(APPDIR)/credits.c $(APPDIR)/credits.h $(OBJDIR)/credits.raw
$(CC) $(APPCFLAGS) -c $< -o $@
$(OBJDIR)/filetypes.o: $(APPDIR)/filetypes.c
$(CC) $(APPCFLAGS) -c $< -o $@
$(OBJDIR)/menu.o: $(APPDIR)/menu.c
$(CC) $(APPCFLAGS) -c $< -o $@
$(OBJDIR)/main_menu.o: $(APPDIR)/main_menu.c
$(CC) $(APPCFLAGS) -c $< -o $@
$(OBJDIR)/thread.o: ./thread.c
$(OBJDIR)/plugin.o: $(APPDIR)/plugin.c
$(CC) $(APPCFLAGS) -c $< -o $@
$(OBJDIR)/keyboard.o: $(MACHINEDIR)/keyboard.c
$(CC) $(APPCFLAGS) -c $< -o $@
$(OBJDIR)/language.o: $(APPDIR)/language.c
$(CC) $(APPCFLAGS) -c $< -o $@
$(OBJDIR)/sound_menu.o: $(APPDIR)/sound_menu.c
$(CC) $(APPCFLAGS) -c $< -o $@
$(OBJDIR)/settings_menu.o: $(APPDIR)/settings_menu.c
$(CC) $(APPCFLAGS) -c $< -o $@
$(OBJDIR)/playlist_menu.o: $(APPDIR)/playlist_menu.c
$(CC) $(APPCFLAGS) -c $< -o $@
$(OBJDIR)/icons.o: $(MACHINEDIR)/icons.c
$(CC) $(APPCFLAGS) -c $< -o $@
$(OBJDIR)/widgets.o: $(RECDIR)/widgets.c
$(CC) $(APPCFLAGS) -c $< -o $@
$(OBJDIR)/main.o: $(APPDIR)/main.c
$(CC) $(APPCFLAGS) -c $< -o $@
$(OBJDIR)/misc.o: $(APPDIR)/misc.c
$(CC) $(APPCFLAGS) -c $< -o $@
$(OBJDIR)/wps.o: $(APPDIR)/wps.c
$(CC) $(APPCFLAGS) -c $< -o $@
$(OBJDIR)/sleeptimer.o: $(APPDIR)/sleeptimer.c
$(CC) $(APPCFLAGS) -c $< -o $@
$(OBJDIR)/wps-display.o: $(APPDIR)/wps-display.c
$(CC) $(APPCFLAGS) -c $< -o $@
$(OBJDIR)/bmp.o: $(RECDIR)/bmp.c
$(CC) $(APPCFLAGS) -c $< -o $@
$(OBJDIR)/tree.o: $(APPDIR)/tree.c
$(CC) $(APPCFLAGS) -c $< -o $@
$(OBJDIR)/onplay.o: $(APPDIR)/onplay.c
$(CC) $(APPCFLAGS) -c $< -o $@
$(OBJDIR)/playlist.o: $(APPDIR)/playlist.c
$(CC) $(APPCFLAGS) -c $< -o $@
$(OBJDIR)/playlist_viewer.o: $(APPDIR)/playlist_viewer.c
$(CC) $(APPCFLAGS) -c $< -o $@
$(OBJDIR)/bookmark.o: $(APPDIR)/bookmark.c
$(CC) $(APPCFLAGS) -c $< -o $@
$(OBJDIR)/build.lang: $(APPDIR)/lang/$(LANGUAGE).lang
perl $(TOOLSDIR)/uplang $(APPDIR)/lang/english.lang $< > $@
@ -232,105 +178,59 @@ $(OBJDIR)/lang.o: $(OBJDIR)/build.lang
perl -s $(TOOLSDIR)/genlang -p=$(OBJDIR)/lang $<
$(CC) $(CFLAGS) -c $(OBJDIR)/lang.c -o $@
$(OBJDIR)/lcd-recorder.o: $(DRIVERS)/lcd-recorder.c
$(CC) $(CFLAGS) -DHAVE_LCD_BITMAP -c $< -o $@
$(OBJDIR)/sysfont.o: $(FIRMWAREDIR)/fonts/clR6x8.bdf
$(TOOLSDIR)/convbdf -c -o $(OBJDIR)/sysfont.c $<
$(CC) $(APPCFLAGS) -c $(OBJDIR)/sysfont.c -o $@
$(OBJDIR)/font.o: $(FIRMWAREDIR)/font.c
################## Plugins ##################
$(OBJDIR)/libplugin.a: $(PLUGINLIBOBJS)
$(AR) ruv $@ $+
$(OBJDIR)/%.o: $(PLUGINDIR)/lib/%.c
$(CC) $(CFLAGS) -DPLUGIN -c $< -o $@
$(OBJDIR)/%.rock: $(APPDIR)/plugins/%.c $(APPDIR)/plugin.h
$(CC) $(APPCFLAGS) -DPLUGIN -L$(OBJDIR) -lplugin -shared $< -o $@
################## Patterns for building objects ##################
$(OBJDIR)/%.o: ../x11/%.c
echo x11
$(CC) $(CFLAGS) -c $< -o $@
$(OBJDIR)/%.o: $(SIMCOMMON)/%.c
echo simcommon
$(CC) $(APPCFLAGS) -c $< -o $@
$(OBJDIR)/settings.o: $(APPDIR)/settings.c
$(OBJDIR)/%.o: $(MACHINEDIR)/%.c
$(CC) $(APPCFLAGS) -c $< -o $@
$(OBJDIR)/status.o: $(APPDIR)/status.c
$(OBJDIR)/%.o: $(DRIVERS)/%.c
$(CC) $(APPCFLAGS) -c $< -o $@
$(OBJDIR)/screens.o: $(APPDIR)/screens.c
$(OBJDIR)/%.o: $(FIRMWAREDIR)/%.c
echo firmware $<
$(CC) $(APPCFLAGS) -c $< -o $@
$(OBJDIR)/peakmeter.o: $(RECDIR)/peakmeter.c
$(OBJDIR)/%.o: $(COMMON)/%.c
$(CC) $(APPCFLAGS) -c $< -o $@
$(OBJDIR)/id3.o: $(FIRMWAREDIR)/id3.c
$(OBJDIR)/%.o: $(APPDIR)/%.c
$(CC) $(APPCFLAGS) -c $< -o $@
$(OBJDIR)/mp3data.o: $(FIRMWAREDIR)/mp3data.c
$(CC) $(APPCFLAGS) -c $< -o $@
$(OBJDIR)/debug.o: $(FIRMWAREDIR)/debug.c
$(CC) $(CFLAGS) -c $< -o $@
################## Auto-dependencies ##################
DEPS:=$(OBJDIR)/.deps
$(OBJDIR)/panic.o: $(FIRMWAREDIR)/panic.c
$(CC) $(CFLAGS) -c $< -o $@
$(DEPS)/%.d: %.c
@$(SHELL) -c 'if [ ! -d $(DEPS) ]; then \
echo Creating the dependency directory: $(DEPS); \
mkdir -p $(DEPS); fi'
@echo "Updating Dependencies for $<"
@$(SHELL) -ec '$(CC) -MM $(CFLAGS) $< \
|sed '\''s|\($*\)\.o[ :]*|$(OBJDIR)/\1.o $(<:%.c=%.d) : |g'\'' > $@; \
[ -s $@ ] || rm -f $@'
$(OBJDIR)/mpeg.o: $(FIRMWAREDIR)/mpeg.c
$(CC) $(CFLAGS) -c $< -o $@
$(OBJDIR)/mp3_playback.o: $(FIRMWAREDIR)/mp3_playback.c
$(CC) $(CFLAGS) -c $< -o $@
$(OBJDIR)/sprintf.o: $(COMMON)/sprintf.c
$(CC) $(CFLAGS) -c $< -o $@
$(OBJDIR)/lcd-common.o: $(SIMCOMMON)/lcd-common.c
$(CC) $(CFLAGS) -c $< -o $@
$(OBJDIR)/buffer.o: $(FIRMWAREDIR)/buffer.c
$(CC) $(CFLAGS) -c $< -o $@
$(OBJDIR)/ctype.o: $(COMMON)/ctype.c
$(CC) $(CFLAGS) $(APPINCLUDES) -c $< -o $@
$(OBJDIR)/timefuncs.o: $(COMMON)/timefuncs.c
$(CC) $(CFLAGS) $(APPINCLUDES) -c $< -o $@
$(OBJDIR)/stubs.o: $(SIMCOMMON)/stubs.c
$(CC) $(APPCFLAGS) -c $< -o $@
$(OBJDIR)/sim_icons.o: $(SIMCOMMON)/sim_icons.c
$(CC) $(CFLAGS) -c $< -o $@
$(OBJDIR)/io.o: $(SIMCOMMON)/io.c
$(CC) $(CFLAGS) -c $< -o $@
$(OBJDIR)/usb.o: $(FIRMWAREDIR)/usb.c
$(CC) $(CFLAGS) -c $< -o $@
$(OBJDIR)/powermgmt.o: $(FIRMWAREDIR)/powermgmt.c
$(CC) $(CFLAGS) -c $< -o $@
$(OBJDIR)/unicode.o: $(FIRMWAREDIR)/unicode.c
$(CC) $(CFLAGS) -c $< -o $@
$(OBJDIR)/ajf.o: $(FIRMWAREDIR)/ajf.c
$(CC) $(CFLAGS) -c $< -o $@
$(OBJDIR)/power.o: $(DRIVERS)/power.c
$(CC) $(CFLAGS) -c $< -o $@
$(OBJDIR)/lcd-player-charset.o: $(DRIVERS)/lcd-player-charset.c
$(CC) $(CFLAGS) -c $< -o $@
$(OBJDIR)/lcd-playersim.o: $(SIMCOMMON)/lcd-playersim.c
$(CC) $(CFLAGS) -c $< -o $@
$(OBJDIR)/fmradio.o: $(SIMCOMMON)/fmradio.c
$(CC) $(CFLAGS) -c $< -o $@
$(OBJDIR)/font-player.o: $(SIMCOMMON)/font-player.c
$(CC) $(CFLAGS) -c $< -o $@
$(OBJDIR)/lcd-player.o: $(DRIVERS)/lcd-player.c
$(CC) $(CFLAGS) -c $< -o $@
$(OBJDIR)/radio.o: $(RECDIR)/radio.c
$(CC) $(APPCFLAGS) -c $< -o $@
$(OBJDIR)/mpegplay.o: $(SIMCOMMON)/mpegplay.c
$(CC) $(CFLAGS) -c $< -o $@
-include $(SRCS:%.c=$(DEPS)/%.d)
# these ones are simulator-specific
@ -345,19 +245,6 @@ $(TARGET): $(OBJS) $(OBJDIR)/libplugin.a
$(CC) -g -o $(TARGET) $(LIBDIRS) $(LDFLAGS) $(OBJS) $(LIBS)
endif
DEPS:=$(OBJDIR)/.deps
$(DEPS)/%.d: %.c
@$(SHELL) -c 'if [ ! -d $(DEPS) ]; then \
echo Creating the dependency directory: $(DEPS); \
mkdir -p $(DEPS); fi'
@echo "Updating Dependencies for $<"
@$(SHELL) -ec '$(CC) -MM $(CFLAGS) $< \
|sed '\''s|\($*\)\.o[ :]*|$(OBJDIR)/\1.o $(<:%.c=%.d) : |g'\'' > $@; \
[ -s $@ ] || rm -f $@'
-include $(SRCS:%.c=$(DEPS)/%.d)
tags:
@$(SHELL) -c 'for d in $(SRCDIRS); do { etags -o $(OBJDIR)/TAGS -a $$d/*.[ch]; }; done'