From bef788a946b5325edf6231034e3ac3e17a4b66b2 Mon Sep 17 00:00:00 2001 From: tixiv Date: Wed, 3 Dec 2008 06:10:03 +0000 Subject: [PATCH] need to commit changes again after renaming for some reason. svn broken? --- Makefile | 71 +++++++++++++++++---------------------------- README.txt | 9 ++++-- defaults.mk | 1 - depend.mk | 11 ++++--- random/Makefile | 10 +++++++ rules.mk | 26 ++++++++++++----- scrolltext/Makefile | 2 +- 7 files changed, 70 insertions(+), 60 deletions(-) create mode 100644 random/Makefile diff --git a/Makefile b/Makefile index 1413272..f28b336 100644 --- a/Makefile +++ b/Makefile @@ -20,6 +20,8 @@ all: compile-$(TARGET) @${TOPDIR}/scripts/size $(TARGET) @echo "===============================" +simulator: autoconf.h .config .subdirs + $(MAKE) -f Makefile.simulator ############################################################################## # generic fluff @@ -31,10 +33,11 @@ include defaults.mk # .subdirs: autoconf.h - $(RM) -f $@ - echo "SUBDIRS += borg_hw" >> $@ - echo "SUBDIRS += animations" >> $@ - (for subdir in `grep -e "^#define .*_SUPPORT" autoconf.h \ + @ echo "checking in which subdirs to build" + @ $(RM) -f $@ + @ echo "SUBDIRS += borg_hw" >> $@ + @ echo "SUBDIRS += animations" >> $@ + @ (for subdir in `grep -e "^#define .*_SUPPORT" autoconf.h \ | sed -e "s/^#define //" -e "s/_SUPPORT.*//" \ | tr "[A-Z]\\n" "[a-z] " `; do \ test -d $$subdir && echo "SUBDIRS += $$subdir" ; \ @@ -45,8 +48,8 @@ ifneq ($(MAKECMDGOALS),clean) ifneq ($(MAKECMDGOALS),mrproper) ifneq ($(MAKECMDGOALS),menuconfig) -include $(TOPDIR)/.subdirs -include $(TOPDIR)/.config +-include $(TOPDIR)/.subdirs +-include $(TOPDIR)/.config endif # MAKECMDGOALS!=menuconfig endif # MAKECMDGOALS!=mrproper @@ -57,42 +60,30 @@ endif # no_deps!=t .PHONY: compile-subdirs compile-subdirs: - for dir in $(SUBDIRS); do make -C $$dir lib$$dir.a || exit 5; done + @ for dir in $(SUBDIRS); do make -C $$dir objects_avr || exit 5; done .PHONY: compile-$(TARGET) compile-$(TARGET): compile-subdirs $(TARGET).hex $(TARGET).bin $(TARGET).lst -OBJECTS += $(patsubst %.c,%.o,${SRC}) -LINKLIBS = $(foreach subdir,$(SUBDIRS),$(subdir)/lib$(subdir).a) +OBJECTS += $(patsubst %.c,./obj_avr/%.o,${SRC}) +SUBDIROBJECTS = $(foreach subdir,$(SUBDIRS),$(foreach object,$(shell cat $(subdir)/obj_avr/.objects),$(subdir)/$(object))) -# FIXME how can we omit specifying every file to be linked twice? -# This is currently necessary because of interdependencies between -# the libraries, which aren't denoted in these however. -$(TARGET): $(OBJECTS) $(LINKLIBS) - $(CC) $(LDFLAGS) -o $@ $(OBJECTS) \ - $(foreach subdir,$(SUBDIRS),-L$(subdir) -l$(subdir)) \ - $(foreach subdir,$(SUBDIRS),-l$(subdir)) \ - $(foreach subdir,$(SUBDIRS),-l$(subdir)) +$(TARGET): $(OBJECTS) $(SUBDIROBJECTS) + $(CC) $(LDFLAGS) -o $@ $(OBJECTS) $(SUBDIROBJECTS) ############################################################################## +./obj_avr/%.o: %.c + @ if [ ! -d obj_avr ]; then mkdir obj_avr ; fi + @ echo "compiling $<" + @ $(CC) -o $@ $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) -c $< + %.hex: % $(OBJCOPY) -O ihex -R .eeprom $< $@ -ifeq ($(HTTPD_INLINE_FILES_SUPPORT),y) -INLINE_FILES := $(wildcard httpd/embed/*) -else -INLINE_FILES := -endif - -%.bin: % $(INLINE_FILES) +%.bin: % $(OBJCOPY) -O binary -R .eeprom $< $@ -ifeq ($(HTTPD_INLINE_FILES_SUPPORT),y) - $(MAKE) -C httpd httpd-concat - httpd/do-embed $(INLINE_FILES) - $(OBJCOPY) -O ihex -I binary $(TARGET).bin $(TARGET).hex -endif %.eep.hex: % $(OBJCOPY) --set-section-flags=.eeprom="alloc,load" --change-section-lma .eeprom=0 -O ihex -j .eeprom $< $@ @@ -112,31 +103,23 @@ menuconfig: $(MAKE) -C scripts/lxdialog all $(CONFIG_SHELL) scripts/Menuconfig config.in test -e .config - @$(MAKE) no_deps=t what-now-msg - -what-now-msg: @echo "" @echo "Next, you can: " @echo " * 'make' to compile your borgware" - @for subdir in $(SUBDIRS); do \ - test -e "$$subdir/configure" -a -e "$$subdir/cfgpp" \ - && echo " * 'make $$subdir/menuconfig' to" \ - "further configure $$subdir"; done || true - @echo "" -.PHONY: what-now-msg + -%/menuconfig: - $(SH) "$(@D)/configure" - @$(MAKE) what-now-msg +#%/menuconfig: +# $(SH) "$(@D)/configure" +# @$(MAKE) what-now-msg ############################################################################## clean: $(MAKE) -f rules.mk no_deps=t clean-common - $(RM) $(TARGET) $(TARGET).bin $(TARGET).hex .subdirs - for subdir in `find . -type d`; do \ + $(RM) $(TARGET) $(TARGET).bin $(TARGET).hex $(TARGET).lst .subdirs + for subdir in `find . -type d` ; do \ test "x$$subdir" != "x." \ && test -e $$subdir/Makefile \ - && make no_deps=t -C $$subdir clean; done + && make no_deps=t -C $$subdir clean ; done ; true mrproper: $(MAKE) clean diff --git a/README.txt b/README.txt index 4f564ce..6fbcfc9 100644 --- a/README.txt +++ b/README.txt @@ -1,5 +1,8 @@ Hier liegt der Versuch, eine universelle Codebasis für 2d-borgs zu bauen, die -durch 'make menuconfig' konfigurierbar ist. Das ganze ist grade nochnicht -besonders weit, und funktioniert noch garnicht. Work is in progress... - +durch 'make menuconfig' konfigurierbar ist. +Zur Zeit ist es bereits möglich, gewisse Dinge in menuconfig einzustellen. +Einfach mal ansehen! Compiliert werden kann das Ganze auch scon. Es fehlt noch +Support für das Spiele-Auswahlmenü und die Spiele. +Außerdem wird grade versucht, das Ganze mit dem Borg-api-Simulator zu +integrieren. \ No newline at end of file diff --git a/defaults.mk b/defaults.mk index e564b9e..f7fe105 100644 --- a/defaults.mk +++ b/defaults.mk @@ -18,7 +18,6 @@ HOSTCC := gcc export HOSTCC # flags for the compiler -CPPFLAGS += -mmcu=$(MCU) CFLAGS ?= -Wall -W -Wno-unused-parameter -Wno-sign-compare CFLAGS += -g -Os -std=gnu99 -fgnu89-inline diff --git a/depend.mk b/depend.mk index 91b8f76..0208f79 100644 --- a/depend.mk +++ b/depend.mk @@ -10,7 +10,8 @@ ifneq ($(MAKECMDGOALS),mrproper) ifneq ($(MAKECMDGOALS),menuconfig) # For each .o file we need a .d file. --include $(subst .o,.d,$(filter %.o,$(OBJECTS))) /dev/null +#-include $(subst .o,.d,$(filter %.o,$(OBJECTS))) /dev/null +-include $(subst .o,.d,$(filter %.o,$(OBJECTS))) endif endif @@ -20,13 +21,15 @@ endif # Here is how to build those dependency files define make-deps +echo "checking dependencies for $<" +if [ ! -d obj_avr ]; then mkdir obj_avr ; fi set -e; $(CC) $(CFLAGS) $(CPPFLAGS) -M -MM $< | \ -sed > $@.new -e 's;$(*F)\.o:;$@ $*.o $*.E $*.s:;' \ +sed > $@.new -e 's;$(*F)\.o:;$@ obj_avr/$*.o obj_avr/$*.E $*.s:;' \ -e 's% [^ ]*/gcc-lib/[^ ]*\.h%%g' if test -s $@.new; then mv -f $@.new $@; else rm -f $@.new; fi endef # Here is how to make .d files from .c files -%.d: %.c $(TOPDIR)/pinning.c; $(make-deps) +obj_avr/%.d: %.c ; @ $(make-deps) -%.d: %.S ; $(make-deps) +obj_avr/%.d: %.S ; @ $(make-deps) diff --git a/random/Makefile b/random/Makefile new file mode 100644 index 0000000..015b7c3 --- /dev/null +++ b/random/Makefile @@ -0,0 +1,10 @@ +TARGET = objects_avr +TOPDIR = .. + +include $(TOPDIR)/defaults.mk + +SRC = prng.c persistentCounter.c +ASRC = noekeon_asm.S memxor.S + + +include $(TOPDIR)/rules.mk diff --git a/rules.mk b/rules.mk index 8062e1c..fa79f2b 100644 --- a/rules.mk +++ b/rules.mk @@ -1,21 +1,33 @@ -OBJECTS += $(patsubst %.c,%.o,${SRC}) -OBJECTS += $(patsubst %.S,%.o,${ASRC}) +OBJECTS += $(patsubst %.c,obj_avr/%.o,${SRC}) +OBJECTS += $(patsubst %.S,obj_avr/%.o,${ASRC}) -%.a: $(OBJECTS) - $(RM) $@ - $(AR) qcv $@ $^ +#./obj_avr/%.a: $(OBJECTS) +# $(AR) qcv $@ $^ # $(STRIP) --strip-unneeded $@ -%.o: %.S - $(CC) -o $@ $(CPPFLAGS) $(ASFLAGS) -c $< +./obj_avr/%.o: %.S + @ if [ ! -d obj_avr ]; then mkdir obj_avr ; fi + @ echo "assembling $<" + @ $(CC) -o $@ $(CPPFLAGS) $(ASFLAGS) -c $< + +./obj_avr/%.o: %.c + @ if [ ! -d obj_avr ]; then mkdir obj_avr ; fi + @ echo "compiling $<" + @ $(CC) -o $@ $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) -c $< clean-common: $(RM) $(TARGET) *.[odasE] *.d.new *~ + $(RM) -r ./obj_avr clean: clean-common all: make -C $(TOPDIR) all + +objects_avr: $(OBJECTS) + @ echo "writing object ineventory" + @ echo $(OBJECTS) > obj_avr/.objects + include $(TOPDIR)/depend.mk diff --git a/scrolltext/Makefile b/scrolltext/Makefile index 3c066c6..ecba0c9 100644 --- a/scrolltext/Makefile +++ b/scrolltext/Makefile @@ -1,4 +1,4 @@ -TARGET = libscrolltext.a +TARGET = objects TOPDIR = .. include $(TOPDIR)/defaults.mk