添加elf的测试文件...

This commit is contained in:
gatieme
2016-06-06 14:35:49 +08:00
parent 22e8254796
commit f11c0539cf
2 changed files with 22 additions and 14 deletions
@@ -1,31 +1,39 @@
ROOT=../../../
PLATFORM=$(shell $(ROOT)/systype.sh)
include $(ROOT)/Make.defines.$(PLATFORM)
target=testelf
target=testelf_normal testelf_dynamic testelf_static
MAIN_OBJS=testelf.o
SUBS_OBJS=add.o sub.o
DYNA_FILE=libtestelf.so
STAT_FILE=libtestelf.a
all:target
all:$(target)
%.o : %.c
$(CC) -c $^ -o $@ $(CFLAGS) $(DEFINES)
$(CC) -c $^ -o $@
clean :
rm *.o
rm $(target)
rm -rf $(MAIN_OBJS) $(SUBS_OBJS)
rm -rf $(DYNA_FILE) $(STAT_FILE)
rm -rf $(target)
# Complie the execute
testelf:$(MAIN-OBJS)
gcc $^ -o $(target) -ltestelf
testelf_normal:$(MAIN_OBJS) $(SUBS_OBJS)
gcc $^ -o $@
testelf_dynamic:$(MAIN_OBJS) $(DYNA_FILE)
gcc $^ -o $@ -L./ -ltestelf
testelf_static:$(MAIN_OBJS) $(STAT_FILE)
gcc testelf.o -o $@ -static -L./ -ltestelf
# Complie the Dynamic Link Library libtestelf.so
libtestelf.so:
gcc -shared $^ -o $@
libtestelf.so:$(SUBS_OBJS)
gcc -fPCI -shared $^ -o $@
# Complie the Static Link Library libtestelf.so
libtestelf.a:
ar -rc libtestelf.a $(OBJS)
libtestelf.a:$(SUBS_OBJS)
ar -r $@ $^
Binary file not shown.