Skip to content

Instantly share code, notes, and snippets.

@lucindo
Created September 17, 2010 21:53
Show Gist options
  • Save lucindo/585021 to your computer and use it in GitHub Desktop.
Save lucindo/585021 to your computer and use it in GitHub Desktop.
CXX = g++
CPPFLAGS = -Wall -ansi -O2
LDFLAGS = -lACE
bin = server client
cpps := $(wildcard *.cpp)
objects := $(foreach file, $(cpps), $(basename $(file)).o)
link_objects := $(filter-out $(foreach b, $(bin), $b.o), $(objects))
all: obj binaries
obj: $(objects)
$(objects): %.o: %.cpp %.h
$(CXX) $(CPPFLAGS) -c $< -o $@
binaries: $(bin)
$(bin):
$(CXX) $(CPPFLAGS) $(LDFLAGS) -o $@ [email protected] $(link_objects)
.PHONY: clean cleanbin realclean
realclean: cleanbin clean
cleanbin:
-rm -f $(bin)
clean:
-rm -f *~ $(objects)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment