# For package building, you will need to pass RELEASE=1 to make
RELEASE ?= 0
+DESTDIR = /usr/local
+PREFIX = ${DESTDIR}
+
.PHONY: doc
all: build-simavr build-tests build-examples build-parts
build-parts: build-examples
$(MAKE) -C examples/parts RELEASE=$(RELEASE)
-install: build-parts
- $(MAKE) -C simavr install RELEASE=$(RELEASE)
+install: install-simavr install-parts
+
+install-simavr:
+ $(MAKE) -C simavr install RELEASE=$(RELEASE) DESTDIR=$(DESTDIR) PREFIX=$(PREFIX)
+
+install-parts:
+ $(MAKE) -C examples/parts install RELEASE=$(RELEASE) DESTDIR=$(DESTDIR) PREFIX=$(PREFIX)
doc:
$(MAKE) -C doc RELEASE=$(RELEASE)
LDFLAGS += -lws2_32
endif
+# for clock_gettime on RHEL 6.9
+ifneq ("$(wildcard /usr/lib/librt.so)","")
+LDFLAGS += -lrt
+endif
+
ifeq (${shell uname}, Linux)
ifeq ($(RELEASE),1)
# allow the shared library to be found in the build directory
# only for linking, the install time location is used at runtime
-LFLAGS += -Wl,-rpath-link,${LIBDIR}
+LFLAGS += -Wl,-rpath-link,${LIBDIR} -Wl,-rpath,${PREFIX}/lib
else
# allow the shared library to be found in the build directory
LFLAGS += -Wl,-rpath,${LIBDIR}
${target}: ${OBJ}/${target}.so
endif
+install: obj ${target}
+ $(MKDIR) $(DESTDIR)/include/simavr/parts
+ $(INSTALL) -m644 *.h $(DESTDIR)/include/simavr/parts/
+ $(INSTALL) ${OBJ}/libsimavrparts.a $(DESTDIR)/lib/
+ sed -e "s|PREFIX|${PREFIX}|g" -e "s|VERSION|${SIMAVR_VERSION}|g" \
+ simavrparts.pc >$(DESTDIR)/lib/pkgconfig/simavrparts.pc
+ifeq (${shell uname}, Linux)
+ $(INSTALL) ${OBJ}/libsimavrparts.so.1 $(DESTDIR)/lib/
+ ln -sf libsimavrparts.so.1 $(DESTDIR)/lib/libsimavrparts.so
+endif
+
clean: clean-${OBJ}
rm -rf *.hex *.a *.axf *.vcd .*.swo .*.swp .*.swm .*.swn *.so *.o
--- /dev/null
+prefix=PREFIX
+exec_prefix=${prefix}
+includedir=${prefix}/include/
+libdir=${exec_prefix}/lib
+
+Name: simavr
+Description: Virtual parts library for simavr
+Version: VERSION
+Cflags: -I${includedir}/simavr/parts
+Libs: -L${libdir} -lsimavrparts -lsimavr
rm -rf ${target} *.a *.so *.exe
rm -f sim_core_*.h
-DESTDIR = /usr/local
-PREFIX = ${DESTDIR}
-
install : all
$(MKDIR) $(DESTDIR)/include/simavr/avr
- $(MKDIR) $(DESTDIR)/include/simavr/parts
$(INSTALL) -m644 sim/*.h $(DESTDIR)/include/simavr/
$(INSTALL) -m644 sim_core_*.h $(DESTDIR)/include/simavr/
$(INSTALL) -m644 sim/avr/*.h $(DESTDIR)/include/simavr/avr/
- $(INSTALL) -m644 ../examples/parts/*.h $(DESTDIR)/include/simavr/parts/
$(MKDIR) $(DESTDIR)/lib
$(INSTALL) ${OBJ}/libsimavr.a $(DESTDIR)/lib/
- $(INSTALL) ../examples/parts/${OBJ}/libsimavrparts.a $(DESTDIR)/lib/
$(MKDIR) $(DESTDIR)/lib/pkgconfig/
sed -e "s|PREFIX|${PREFIX}|g" -e "s|VERSION|${SIMAVR_VERSION}|g" \
simavr-avr.pc >$(DESTDIR)/lib/pkgconfig/simavr-avr.pc
sed -e "s|PREFIX|${PREFIX}|g" -e "s|VERSION|${SIMAVR_VERSION}|g" \
simavr.pc >$(DESTDIR)/lib/pkgconfig/simavr.pc
- sed -e "s|PREFIX|${PREFIX}|g" -e "s|VERSION|${SIMAVR_VERSION}|g" \
- simavrparts.pc >$(DESTDIR)/lib/pkgconfig/simavrparts.pc
ifeq (${shell uname}, Linux)
$(INSTALL) ${OBJ}/libsimavr.so.1 $(DESTDIR)/lib/
- $(INSTALL) ../examples/parts/${OBJ}/libsimavrparts.so.1 $(DESTDIR)/lib/
ln -sf libsimavr.so.1 $(DESTDIR)/lib/libsimavr.so
- ln -sf libsimavrparts.so.1 $(DESTDIR)/lib/libsimavrparts.so
endif
$(MKDIR) $(DESTDIR)/bin
$(INSTALL) ${OBJ}/${target}.elf $(DESTDIR)/bin/simavr
avr_t * avr = p->io.avr;
float resulting_clock = 0.0f; // used only for trace
- float tov_cycles_exact;
+ float tov_cycles_exact = 0;
uint8_t as2 = p->ext_clock_flags & AVR_TIMER_EXTCLK_FLAG_AS2;
uint8_t use_ext_clock = as2 || (p->ext_clock_flags & AVR_TIMER_EXTCLK_FLAG_TN);
+++ /dev/null
-prefix=PREFIX
-exec_prefix=${prefix}
-includedir=${prefix}/include/
-libdir=${exec_prefix}/lib
-
-Name: simavr
-Description: Virtual parts library for simavr
-Version: VERSION
-Cflags: -I${includedir}/simavr/parts
-Libs: -L${libdir} -lsimavrparts -lsimavr