makefile 438B

12345678910111213141516171819202122
  1. CC=g++
  2. CCFLAGS=-O2 -g
  3. LDFLAGS=-lX11 -lXext -lrt
  4. SOURCES=main.cpp x.cpp options.cpp rectangle.cpp
  5. OBJECTS=$(SOURCES:.cpp=.o)
  6. EXECUTABLE=slop
  7. BINDIR="/usr/bin"
  8. all: $(SOURCES) $(EXECUTABLE)
  9. $(EXECUTABLE): $(OBJECTS)
  10. $(CC) $(OBJECTS) -o $@ $(LDFLAGS)
  11. $(OBJECTS): %.o: %.cpp
  12. $(CC) $(CCFLAGS) -o $@ -c $<
  13. clean:
  14. rm -rf $(OBJECTS) $(EXECUTABLE)
  15. install: all
  16. mkdir -p $(DESTDIR)$(BINDIR)
  17. cp $(CURDIR)/$(EXECUTABLE) $(DESTDIR)$(BINDIR)