WengQiang's Blog

where there is a will, there is a way!

Divide and Conquer(Main Thoery)

if a>=1 and b > 1, T(n) = aT(n/b) + f(n)

  1. case 1 \[ f(n) = O(n^{\log_b{a-\epsilon}}) \longrightarrow T(n) = \Theta(n^{\log_ba}) \]

  2. case 2 \[ f(n) = \Theta(n^{\log_ba}) \longrightarrow T(n) = \Theta(n^{\log_ba}\lg n) \]
    阅读全文 »

variable convention

variables that are internal to makefile are lowercase; variables that might be set from the command line are uppercased.

阅读全文 »

modules makefile(module.mk)

1
2
3
4
5
6
7
8
9
10
   local_dir  := lib/codec
local_lib := $(local_dir)/libcodec.a
local_src := $(addprefix $(local_dir)/,codec.c)
local_objs := $(subst .c,.o,$(local_src))

libraries += $(local_lib)
sources += $(local_src)

$(local_lib): $(local_objs)
$(AR) $(ARFLAGS) $@ $^
阅读全文 »

makefile to include commom.mk

1
2
3
4
 library := libcodec.a
sources := $(wildcard *.c)

include ../../common.mk
阅读全文 »

set makefile dependency

1
2
3
4
5
6
7
8
9
10
11
12
13
14
VPATH    = src include
CPPFLAGS = -I include
SOURCES = count_words.c \
lexer.c \
counter.c
count_words: counter.o lexer.o -lfl
count_words.o: counter.h
counter.o: counter.h lexer.h
lexer.o: lexer.h
include $(subst .c,.d,$(SOURCES))
%.d: %.c
$(CC) -M $(CPPFLAGS) $< > $@.$$$$; \
sed 's,\($*\)\.o[ :]*,\1.o $@ : ,g' < $@.$$$$ > $@; \
rm -f $@.$$$$
阅读全文 »
0%