mirror of
https://github.com/gatieme/LDD-LinuxDeviceDrivers.git
synced 2026-08-20 03:33:20 +08:00
添加elf的测试文件...
This commit is contained in:
@@ -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 $@ $^
|
||||
|
||||
BIN
Binary file not shown.
Reference in New Issue
Block a user