| 1 | TARGET = exo3 |
| 2 | LIBS = |
| 3 | CC = gcc |
| 4 | # Enforce C11 ISO standard for now |
| 5 | CFLAGS = -std=c11 -g -Wall |
| 6 | LDFLAGS = -g -Wall |
| 7 | |
| 8 | .PHONY: default all clean |
| 9 | |
| 10 | default: $(TARGET) |
| 11 | all: default |
| 12 | |
| 13 | OBJECTS = $(patsubst %.c, %.o, $(wildcard *.c)) |
| 14 | HEADERS = $(wildcard *.h) |
| 15 | |
| 16 | %.o: %.c $(HEADERS) |
| 17 | $(CC) $(CFLAGS) -c $< -o $@ |
| 18 | |
| 19 | .PRECIOUS: $(TARGET) $(OBJECTS) |
| 20 | |
| 21 | $(TARGET): $(OBJECTS) |
| 22 | $(CC) $(OBJECTS) $(LDFLAGS) $(LIBS) -o $@ |
| 23 | |
| 24 | clean: |
| 25 | -rm -f $(TARGET) $(OBJECTS) |
| 26 | |
| 27 | disassemble: $(TARGET) |
| 28 | objdump -d $< | less |
| 29 | |
| 30 | symbols: $(TARGET) |
| 31 | objdump -t $< | sort | less |