v8erl / Makefile

include Makedefs

#Libs to build
LIBS = v8erl
LIB_TARGETS = $(addsuffix .$(LIB_EXT),$(addprefix lib/lib,$(LIBS)))

#Beams to build
ERL_FILES = $(wildcard $(ERL_DIR)/*.erl)
BEAM_FILES = $(addsuffix .beam,$(notdir $(basename $(ERL_FILES))))
BEAM_TARGETS = $(addprefix $(EBIN_DIR)/,$(BEAM_FILES))

APPS = $(wildcard $(ERL_DIR)/*.app)
APP_TARGETS = $(addprefix $(EBIN_DIR)/,$(notdir $(APPS)))

#Compile flags
CXXFLAGS  = -I./include $(V8_INC) $(ERL_INC) -g -Wall

default: all

	install -d $(LIB_DIR)
	install -d $(EBIN_DIR)


$(SRC_DIR)/%.o: $(SRC_DIR)/%.cc
	$(CPP) -c $(CXXFLAGS) -o $@ $<

lib/libv8erl.so: CXXFLAGS += -fPIC
lib/libv8erl.so: $(SRC_DIR)/driver.o $(SRC_DIR)/js2erl.o
	$(CPP) $(LDFLAGS) $^ -o $@

lib/libv8erl.dylib: CXXFLAGS += -fPIC
lib/libv8erl.dylib: $(SRC_DIR)/driver.o $(SRC_DIR)/js2erl.o
	$(CPP) $(LDFLAGS) $^ -o $@

$(EBIN_DIR)/%.beam: $(ERL_DIR)/%.erl
	erlc -W -o $(EBIN_DIR)/ $<

$(EBIN_DIR)/%.app: $(ERL_DIR)/%.app
	cp $< $@

	rm -f src/*.o
	rm -rf $(LIB_DIR)
	rm -rf $(EBIN_DIR)

.PHONY: clean erl
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.