Skip to content

Instantly share code, notes, and snippets.

@essen
Created May 21, 2015 19:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save essen/5e7893d8233add3a5574 to your computer and use it in GitHub Desktop.
Save essen/5e7893d8233add3a5574 to your computer and use it in GitHub Desktop.
Example Makefile generated by erlang.mk when autopatching rebar projects
ERL_CFLAGS = -fPIC -I /usr/lib/erlang/erts-6.4/include -I /usr/lib/erlang/lib/erl_interface-3.7.20/include
ERL_LDFLAGS = -L /usr/lib/erlang/lib/erl_interface-3.7.20/lib -lerl_interface -lei
EPCAP_CFLAGS= -DHAVE_PCAP_CREATE
EXE_LDFLAGS = -lpcap $(ERL_LDFLAGS)
EXE_CFLAGS = $(EPCAP_CFLAGS)
EXE_CFLAGS = $(EPCAP_CFLAGS) -DEPCAP_RLIMIT_NOFILES=1
all:: ../priv/epcap
%.o: %.c
$(CC) -c -o $@ $< $(CFLAGS) $(ERL_CFLAGS) $(DRV_CFLAGS) $(EXE_CFLAGS)
%.o: %.C
$(CXX) -c -o $@ $< $(CXXFLAGS) $(ERL_CFLAGS) $(DRV_CFLAGS) $(EXE_CFLAGS)
%.o: %.cc
$(CXX) -c -o $@ $< $(CXXFLAGS) $(ERL_CFLAGS) $(DRV_CFLAGS) $(EXE_CFLAGS)
%.o: %.cpp
$(CXX) -c -o $@ $< $(CXXFLAGS) $(ERL_CFLAGS) $(DRV_CFLAGS) $(EXE_CFLAGS)
../priv/epcap: $(foreach ext,.c .C .cc .cpp,$(patsubst %$(ext),%.o,$(filter %$(ext),$(wildcard epcap.c epcap_priv.c))))
$(CC) -o $@ $? $(LDFLAGS) $(ERL_LDFLAGS) $(DRV_LDFLAGS) $(EXE_LDFLAGS)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment