Skip to content

Instantly share code, notes, and snippets.

@nodtem66
Created February 12, 2015 10:23
Show Gist options
  • Save nodtem66/81c7d0da3010c156ce7e to your computer and use it in GitHub Desktop.
Save nodtem66/81c7d0da3010c156ce7e to your computer and use it in GitHub Desktop.
Simple Makefile
CC=gcc
LDFLAGS=-lusb-1.0
CFLAGS=-c -Wall
SRC=test_iso.c
OBJ=$(SRC:.c=.o)
EXEC=iso
.PHONY: all clean
.SECONDARY: main-build
all: pre-build main-build
pre-build:
post-build:
rm -f $(OBJ)
main-build: target
target : $(OBJ)
$(CC) $(LDFLAGS) $(OBJ) -o $(EXEC)
@$(MAKE) --no-print-directory post-build
.cpp.o:
$(CC) $(CFLAGS) $< -o $@
.c.o:
$(CC) $(CFLAGS) $< -o $@
clean:
rm -f $(OBJ) $(EXEC)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment