1 #
   2 # Copyright (c) 2012 Joyent, Inc.  All rights reserved.
   3 #
   4 
   5 all: $(MODULE_DIR)/$(MODULE).node
   6 
   7 $(ERRNO_C): $(GENERRNO_JS) $(ERRNO_JSON)
   8         $(GENERRNO) -c -o $@ $(ERRNO_JSON)
   9 
  10 $(ERRNO_H): $(GENERRNO_JS) $(ERRNO_JSON)
  11         $(GENERRNO) -h -o $@ $(ERRNO_JSON)
  12 
  13 $(OBJS): $(ERRNO_H)
  14 
  15 $(MODULE_DIR)/$(MODULE).node: $(OBJS) $(MAPFILE)
  16         $(CXX) $(LDFLAGS) -o $@ $(OBJS) $(LIBS)
  17         $(CTFMERGE.node)
  18 
  19 %.o: %.c
  20         $(CC) $(CPPFLAGS) $(CFLAGS) -c -o $@ $<
  21         $(CTFCONVERT) -l $(CTF_LABEL) $@
  22 
  23 %.o: %.cc
  24         $(CXX) $(CXXPPFLAGS) $(CXXFLAGS) -c -o $@ $<
  25 
  26 %.o: $(V8PLUS)/%.c
  27         $(CC) $(CPPFLAGS) $(CFLAGS) -c -o $@ $<
  28         $(CTFCONVERT.o)
  29 
  30 %.o: $(V8PLUS)/%.cc
  31         $(CXX) $(CXXPPFLAGS) $(CXXFLAGS) -c -o $@ $<
  32 
  33 $(MAPFILE): $(PREFIX_NODE)/bin/node
  34         /usr/bin/nm -ghnp $< | \
  35             (printf "\$$mapfile_version 2\n\nSYMBOL_SCOPE {\n\tglobal:\n"; \
  36             awk '$$2 != "U" { print "\t\t" $$3 "\t{ FLAGS = EXTERN };" }'; \
  37             printf "\t\tinit;\n\tlocal:\n\t\t*;\n};") > $@
  38 
  39 .PHONY: clean
  40 
  41 clean:
  42         -rm -f $(OBJS) $(ERRNO_C) $(ERRNO_H)
  43 
  44 clobber: clean
  45         -rm -f $(MODULE_DIR)/$(MODULE).node $(MAPFILE)