Skip to content

Instantly share code, notes, and snippets.

@lucindo
Created September 15, 2011 17:03
Show Gist options
  • Save lucindo/1219817 to your computer and use it in GitHub Desktop.
Save lucindo/1219817 to your computer and use it in GitHub Desktop.
# Simple Objective-C Makefile
bin = prog
CFLAGS = -Wno-import -Wall -O2
LDFLAGS = -lobjc -lm
src := $(wildcard *.m)
objects := $(foreach file, $(src), $(basename $(file)).o)
all: $(objects) $(bin)
$(objects): %.o: %.m %.h
gcc $(CFLAGS) -c $< -o $@
$(bin):
gcc $(CFLAGS) -o $@ $(objects) $(LDFLAGS)
.PHONY: clean
clean:
-rm -rf $(bin) $(objects) *~
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment