aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorcathook <cat.hook31894@gmail.com>2013-11-26 02:24:01 +0800
committercathook <cat.hook31894@gmail.com>2013-11-26 02:24:01 +0800
commit701b12748329e9df7d038e3bd9faae09f972b7bd (patch)
treedadec83983b0194cab182cd5e6cd1e3defca9a36
parent083c0fcc16f50af27b5933a4ffda8bdefbd94592 (diff)
downloadctl-701b12748329e9df7d038e3bd9faae09f972b7bd.tar.gz
ctl-701b12748329e9df7d038e3bd9faae09f972b7bd.tar.zst
ctl-701b12748329e9df7d038e3bd9faae09f972b7bd.zip
update Makefile & README
-rw-r--r--Makefile37
-rw-r--r--README10
2 files changed, 22 insertions, 25 deletions
diff --git a/Makefile b/Makefile
index 375806f..245ac35 100644
--- a/Makefile
+++ b/Makefile
@@ -1,18 +1,20 @@
####################### path name ##########################
-LIB = lib
-OBJ = obj
+PWD = $(shell pwd)
+
+LIB = $(PWD)/lib
+OBJ = $(PWD)/obj
-INC = $(shell pwd)/include
-SRC = src
+INC = $(PWD)/include
+SRC = $(PWD)/src
-TST = test
+EMP = $(PWD)
################ compiler information: gcc #################
-GCC_OPT := -I$(INC) -L$(LIB) -O2
+GCC_OPT := -I$(INC) -L$(LIB) -g
AR_OPT := cvr
-TEST_CC := gcc $(GCC_OPT) -o
+EXAMPLE_CC := gcc $(GCC_OPT) -o
OBJ_CC := gcc $(GCC_OPT) -c
SLIB_CC := ar $(AR_OPT)
@@ -26,12 +28,12 @@ OBJFIL := $(foreach n,$(OBJECT),$(OBJ)/$(n).o)
TARGET := $(LIB)/libctl.a
-TSTFIL := $(TST)/test.c
-TSTOUT := $(TST)/test
+EMPFIL := $(EMP)/example.c
+EMPOUT := $(EMP)/example
######################## setting ###########################
.SUFFIXES:
-.PHONY: all clean test
+.PHONY: all clean example
.PRECIOUS:
.SECONDARY:
@@ -45,20 +47,15 @@ $(TARGET): $(OBJFIL)
$(OBJFIL): $(OBJ)/%.o: $(SRC)/%.c $(INC)/%.h
@echo 'make object file .......... $@'
- @cd $(OBJ) && $(OBJ_CC) ../$<
+ @cd $(OBJ) && $(OBJ_CC) $<
-test: $(TSTOUT)_slib $(TSTOUT)_objs
+example: $(EMPOUT);
-$(TSTOUT)_slib: $(TSTFIL) $(TARGET)
+$(EMPOUT): $(EMPFIL) $(TARGET)
@echo 'make test program for ...... $^'
- @$(TEST_CC) $@ $^
+ @$(EXAMPLE_CC) $@ $^
-$(TSTOUT)_objs: $(TSTFIL) $(OBJFIL)
- @echo 'make test program for ...... $^'
- @$(TEST_CC) $@ $^
-
clean:
-rm -f $(LIB)/*
-rm -f $(OBJ)/*
- -rm -f $(TST)/*.slib
- -rm -f $(TST)/*.oooo
+ -rm -f $(EMPOUT)
diff --git a/README b/README
index 9f7b5d1..0988fc4 100644
--- a/README
+++ b/README
@@ -5,11 +5,11 @@ ctl -- C Template Library
Compile:
Type "make" and it will create "lib/libctl.a", "obj/$.o" where $
means all the objects.
- By the way, you can type "make test" to compile a test file
- which name is "test/test.c", and the results are "test/test_slib"
- and "test/test_dlib". Both of them are executive file. To run
- one of them, you will be shown a simple example about how to use
- the objects and functions in this project -- "C Template Library".
+ By the way, you can type "make example" to compile a example
+ file which name is "example.c", and the results are "example",
+ which is an executive file. To run it, you will be shown a simple
+ example about how to use the objects and functions in this project
+ -- "C Template Library".
Target/goal:
-utility: