forked from alexandrebelloni/whoosh
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
40 lines (27 loc) · 740 Bytes
/
Makefile
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
34
35
36
37
38
39
40
# Makefile
PACKAGE:=whoosh
CC=$(CROSS_COMPILE)gcc
LD=$(CROSS_COMPILE)ld
OBJCOPY=$(CROSS_COMPILE)objcopy
CFLAGS:=-g -Os -nostartfiles -nostdlib
LDFLAGS:= -g -Ttext 0 -X -Map whoosh.map
SRCS:= script.lds main.c
OBJS:=$(SRCS:.c=.o)
all: $(PACKAGE).bin $(PACKAGE).bin-swapped
$(PACKAGE).bin: $(PACKAGE)
$(OBJCOPY) -O binary -R .bss -R .comment $< $@
$(PACKAGE).bin-swapped: $(PACKAGE).bin
cat $< | ./wordswap > $@
$(PACKAGE): $(OBJS)
$(LD) $(LDFLAGS) $(OBJS) -o $@
%.o: %.c
$(CC) -c $(CFLAGS) $< -o $@
%.s: %.c
$(CC) -S $(CFLAGS) $< -o $@
%_config:
@cp configs/$(@:_config=).h config.h
.PHONY: clean distclean
clean:
@-rm -rf *.o $(PACKAGE) $(PACKAGE).bin $(PACKAGE).bin-swapped *.map out
distclean: clean
@-rm -f config.h