Browse Source

continued integrating simulator

feature/2015
tixiv 16 years ago
parent
commit
b66067f50e
  1. 43
      Makefile
  2. 2
      borg_hw/Makefile
  3. 7
      defaults.mk
  4. 39
      rules.mk

43
Makefile

@ -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; \

2
borg_hw/Makefile

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

7
defaults.mk

@ -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):

39
rules.mk

@ -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

Loading…
Cancel
Save