INCLUDE_DIR=include
PRIVATE_INCLUDE_DIR=$(INCLUDE_DIR)/private
AO_INCLUDE_DIR=libatomic_ops/src

OBJNamesGC=allchblk.o alloc.o backgraph.o blacklst.o checksums.o darwin_stop_world.o dbg_mlc.o dyn_load.o finalize.o gcj_mlc.o gc_dlopen.o headers.o mach_dep.o malloc.o mallocx.o mark.o mark_rts.o misc.o new_hblk.o obj_map.o os_dep.o pcr_interface.o pthread_start.o pthread_stop_world.o pthread_support.o ptr_chck.o real_malloc.o reclaim.o specific.o stubborn.o thread_local_alloc.o typd_mlc.o win32_threads.o
OBJNamesGCCPP=gc_cpp.o

all: gc72

gc72:
	export PKG_LIBS="$(PKG_LIBS) -I$(AO_INCLUDE_DIR) -I$(INCLUDE_DIR) -I$(PRIVATE_INCLUDE_DIR)"; \
	export PKG_CFLAGS="$(PKG_CFLAGS) -DALL_INTERIOR_POINTERS -DGC_DLL -DGC_THREADS -D_CRT_SECURE_NO_DEPRECATE -I$(AO_INCLUDE_DIR) -I$(INCLUDE_DIR) -I$(PRIVATE_INCLUDE_DIR)"; \
	export PKG_CXXFLAGS="$(PKG_CXXFLAGS) -DALL_INTERIOR_POINTERS -DALL_INTERIOR_POINTERS -DGC_DLL -DGC_THREADS -D_CRT_SECURE_NO_DEPRECATE -I$(AO_INCLUDE_DIR) -I$(INCLUDE_DIR) -I$(PRIVATE_INCLUDE_DIR)"; \
	${R_HOME}/bin${R_ARCH_BIN}/R.exe CMD SHLIB -o gc72.dll *.c; \
	${R_HOME}/bin${R_ARCH_BIN}/R.exe CMD SHLIB -o gccpp72.dll -L. -lgc72 *.cpp; \
	ar rcs libGC.a $(OBJNamesGC); \
	ar rcs libGCcpp.a $(OBJNamesGCCPP); \
	cp libGC*.a ../