continued integrating simulator

This commit is contained in:
tixiv 2008-12-03 13:22:20 +00:00
parent bef788a946
commit b66067f50e
4 changed files with 68 additions and 23 deletions

View File

@ -1,4 +1,5 @@
TARGET := image
TARGET := image
TARGET_SIM := borgsim
TOPDIR = .
SRC = \
@ -13,16 +14,6 @@ SERIAL = /dev/ttyUSB0
export TOPDIR
##############################################################################
all: compile-$(TARGET)
@echo "==============================="
@echo "$(TARGET) compiled for: $(MCU)"
@echo "size is: "
@${TOPDIR}/scripts/size $(TARGET)
@echo "==============================="
simulator: autoconf.h .config .subdirs
$(MAKE) -f Makefile.simulator
##############################################################################
# generic fluff
include defaults.mk
@ -57,13 +48,20 @@ endif # MAKECMDGOALS!=clean
endif # no_deps!=t
##############################################################################
all: compile-$(TARGET)
@echo "==============================="
@echo "$(TARGET) compiled for: $(MCU)"
@echo "size is: "
@${TOPDIR}/scripts/size $(TARGET)
@echo "==============================="
.PHONY: compile-subdirs
compile-subdirs:
.PHONY: compile-subdirs_avr
compile-subdirs_avr:
@ 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
compile-$(TARGET): compile-subdirs_avr $(TARGET).hex $(TARGET).bin $(TARGET).lst
OBJECTS += $(patsubst %.c,./obj_avr/%.o,${SRC})
SUBDIROBJECTS = $(foreach subdir,$(SUBDIRS),$(foreach object,$(shell cat $(subdir)/obj_avr/.objects),$(subdir)/$(object)))
@ -73,7 +71,7 @@ $(TARGET): $(OBJECTS) $(SUBDIROBJECTS)
##############################################################################
#generic rules for AVR-Build
./obj_avr/%.o: %.c
@ if [ ! -d obj_avr ]; then mkdir obj_avr ; fi
@ echo "compiling $<"
@ -94,6 +92,21 @@ $(TARGET): $(OBJECTS) $(SUBDIROBJECTS)
%-size: %.hex
$(SIZE) $<
##############################################################################
#Rules for simulator build
.PHONY: compile-subdirs_sim
compile-subdirs_sim:
@ for dir in $(SUBDIRS); do make -C $$dir objects_sim || exit 5; done
@ make -C ./simulator/ objects_sim || exit 5;
simulator: autoconf.h .config .subdirs compile-subdirs_sim $(TARGET_SIM)
SUBDIROBJECTS_SIM = $(foreach subdir,$(SUBDIRS),$(foreach object,$(shell cat $(subdir)/obj_sim/.objects),$(subdir)/$(object)))
$(TARGET_SIM): $(SUBDIROBJECTS_SIM)
$(HOSTCC) $(LDFLAGS_SIM) $(LIBS_SIM) -o $@ $(SUBDIROBJECTS_SIM)
##############################################################################
CONFIG_SHELL := $(shell if [ -x "$$BASH" ]; then echo $$BASH; \
else if [ -x /bin/bash ]; then echo /bin/bash; \

View File

@ -1,6 +1,8 @@
TARGET = libborg_hw.a
TOPDIR = ..
SRC_SIM :=
include $(TOPDIR)/defaults.mk

View File

@ -25,6 +25,13 @@ CFLAGS += -g -Os -std=gnu99 -fgnu89-inline
LDFLAGS += -mmcu=$(MCU)
#############################################################################
#Settings for Simulator build
CFLAGS_SIM = -g -Wall -pedantic -std=c99 -O2
LDFLAGS_SIM = -Wl
LIBS_SIM = LIBS = -lglut -lpthread -lGL -lGLU
##############################################################################
# the default target
$(TARGET):

View File

@ -1,11 +1,11 @@
##############################################################################
# rules for buildung AVR objects
OBJECTS += $(patsubst %.c,obj_avr/%.o,${SRC})
OBJECTS += $(patsubst %.S,obj_avr/%.o,${ASRC})
#./obj_avr/%.a: $(OBJECTS)
# $(AR) qcv $@ $^
# $(STRIP) --strip-unneeded $@
./obj_avr/%.o: %.S
@ if [ ! -d obj_avr ]; then mkdir obj_avr ; fi
@ echo "assembling $<"
@ -16,18 +16,41 @@ OBJECTS += $(patsubst %.S,obj_avr/%.o,${ASRC})
@ echo "compiling $<"
@ $(CC) -o $@ $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) -c $<
objects_avr: $(OBJECTS)
@ echo "writing object ineventory"
@ echo $(OBJECTS) > obj_avr/.objects
##############################################################################
# rules for buildung simulator objects
SRC_SIM = $(SRC)
OBJECTS_SIM += $(patsubst %.c,obj_sim/%.o,${SRC_SIM})
./obj_sim/%.o: %.c
@ if [ ! -d obj_sim ]; then mkdir obj_sim ; fi
@ echo "compiling $<"
@ $(HOSTCC) -o $@ $(CFLAGS_SIM) -c $<
objects_sim: $(OBJECTS_SIM)
@ echo "writing object ineventory"
@ echo $(OBJECTS) > obj_sim/.objects
clean-common:
$(RM) $(TARGET) *.[odasE] *.d.new *~
$(RM) -r ./obj_avr
$(RM) -r ./obj_sim
clean: clean-common
all:
make -C $(TOPDIR) all
objects_avr: $(OBJECTS)
@ echo "writing object ineventory"
@ echo $(OBJECTS) > obj_avr/.objects
include $(TOPDIR)/depend.mk