aboutsummaryrefslogtreecommitdiffstats
path: root/bfd/test/makefile
blob: 3512579911cf5af1abd83f1036753bedff3cbaea (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
##################################VARS#################################
CC=clang
CC_FLAGS=-fpic -O0
LD_FLAGS= -l bfd
TARGET=test
##################################RULES################################
.DEFAULT:all

.PHONY:all clean help

all:$(TARGET) $(TARGET).so $(TARGET).asm

.c.o:
	$(CC) $(CC_FLAGS) -c $< -o $@

$(TARGET): $(TARGET).o
	$(CC) $^ $(LD_FLAGS) -o $@

$(TARGET).asm: $(TARGET).o
	objdump -r -d -M intel -S $(TARGET).o > $(TARGET).asm

$(TARGET).so: $(TARGET).o
	$(CC) $^ $(LD_FLAGS) -shared -o $@

clean:
	rm -f *.o *~ $(TARGET) $(TARGET).so $(TARGET).asm

help:
	@echo 'all builds so and exe. all is the default.'
	@echo 'clean runs clean.'
	@echo 'help runs help.'