Skip to content

Instantly share code, notes, and snippets.

@libcrack
Created May 30, 2016 15:46
Show Gist options
  • Select an option

  • Save libcrack/df95b2b9a211b61040697d2139f6bd35 to your computer and use it in GitHub Desktop.

Select an option

Save libcrack/df95b2b9a211b61040697d2139f6bd35 to your computer and use it in GitHub Desktop.
GNU/Linux Makefile base template
CC := gcc
BIN := pcap
LDLIBS := -lpcap
LDFLAGS :=
CFLAGS := -Wall -Wno-parentheses -fomit-frame-pointer
CPPFLAGS :=
DEBUG := $(CFLAGS) -O0 -ggdb -fvar-tracking-assignments -fvar-tracking -fno-builtin
all: $(BIN)
debug:
CFLAGS="$(DEBUG)" make
%.o: %.c
$(CC) $(CFLAGS) $(CPPFLAGS) $(TARGET_ARCH) -c -o $@ $<
%: %.o
$(CC) $(LDFLAGS) $(TARGET_ARCH) $^ $(LOADLIBES) $(LDLIBS) -o $@
clean:
rm -f *~ *.o $(BIN)
help:
echo "make all|debug|clean|help"
.PHONY: all clean debug help
.SILENT: all clean debug help
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment