GnuMake

Aus Info-Theke
Zur Navigation springen Zur Suche springen

Beispiel: Beachte: Einrückung mit TAB, nicht mit Blanks!

# makefile for dirtool

BIN = dirtool
SRC = main.cpp $(wildcard base/*.cpp) $(wildcard os/*.cpp) $(wildcard string/*.cpp)
SRC_TEST = $(wildcard cunit/*.cpp)
SRC_CUR = $(SRC) $(SRC_TEST)
INC = $(patsubst %.cpp,%.hpp,$(SRC))
OBJS = $(patsubst %.cpp,%.o,$(SRC_CUR))

INCS = -I/usr/include -I.
LIB_FILES = 
LIB_DIRS = -L/usr/lib

GCC = g++
LNK = g++

LNK_FLAGS = -g
GCC_FLAGS = -c -g

.PHONY : all

clean :
	rm -f $(BIN) $(OBJS)

all : $(SRC_CUR) $(BIN) 

$(BIN) : $(OBJS)
	$(LNK) -o $(BIN) $(LNK_FLAGS) $(OBJS) $(LIB_DIRS) $(LIB_FILES)

.cpp.o:
	$(GCC) $(GCC_FLAGS) $(INCS) $< -o $@