2
0
mirror of https://gitlab.com/ita1024/waf.git synced 2024-11-25 11:19:52 +01:00
waf/docs/slides/presentation/snippets/make-2/Makefile
2011-09-10 11:13:51 +02:00

38 lines
844 B
Makefile

LIBZ_INCLUDES = /usr/include
LIBA_DIR = liba
LIBA_INCLUDES = $(LIBA_DIR)
LIBA_LIBS = -lz
LIBA_OBJS = $(LIBA_DIR)/a.o
LIBB_DIR = libb
LIBB_OBJS = $(LIBB_DIR)/b.o
LIBB_INCLUDES = $(LIBB_DIR) $(LIBA_INCLUDES)
LIBB_DEPOBJS = $(LIBA_OBJS)
LIBB_LIBS = $(LIBA_LIBS) $(LIBA_OBJS)
PROGRAM_OBJS = prog.o
PROGRAM_INCLUDES = $(LIBB_INCLUDES)
PROGRAM_DEPOBJS = $(LIBB_DEPOBJS) $(LIBB_OBJS)
PROGRAM_LIBS = $(LIBA_LIBS) $(LIBB_LIBS)
PROGRAM = program
all: $(PROGRAM)
$(LIBA_OBJS): $(LIBA_DIR)/a.c $(LIBA_DIR)/a.h
$(CC) -o $@ -c $< $(CFLAGS)
$(LIBB_OBJS): $(LIBB_DIR)/b.cpp $(LIBB_DIR)/b.h $(LIBB_DEPOBJS)
$(CXX) -o $@ -c $< $(CFLAGS)
$(PROGRAM_OBJS): program.c
$(CC) -o $@ -c $< $(CFLAGS) $(foreach incdir, $(LIBB_INCLUDES), -I $(incdir))
$(PROGRAM): $(PROGRAM_OBJS) $(PROGRAM_DEPOBJS)
$(CXX) -o $@ $+ $(LDFLAGS) $(LIBB_LIBS)
clean:
echo TODO