1#!/usr/bin/make -f 2 3#define variables 4COMMON_INCLUDE_DIR = ../../ 5UTIL_INCLUDE_DIR = ../ 6 7UTIL_SRC = $(wildcard ./src/*.c) 8UTIL_OBJ = $(UTIL_SRC:.c=.o) 9UTIL_LIB = ./src/libutil.a 10 11#set additional compiler flag 12CFLAGS += -D_CRT_SECURE_NO_WARNINGS 13 14#target part 15$(UTIL_OBJ): %.o: %.c 16 $(CC) $(CFLAGS) -I$(COMMON_INCLUDE_DIR) \ 17 -I$(UTIL_INCLUDE_DIR) \ 18 -c $^ -o $@ 19 20$(UTIL_LIB): $(UTIL_OBJ) 21 $(AR) rc $(UTIL_LIB) $(UTIL_OBJ) 22 $(RANLIB) $(UTIL_LIB) 23 24build: all 25 26all: $(UTIL_LIB) 27 28install: 29 30clean: 31 rm -f $(UTIL_OBJ) $(UTIL_LIB) 32 33