Skip to content

Instantly share code, notes, and snippets.

@naohaq
Created March 26, 2015 14:02
Show Gist options
  • Save naohaq/7b561471101509306db9 to your computer and use it in GitHub Desktop.
Save naohaq/7b561471101509306db9 to your computer and use it in GitHub Desktop.
#!/usr/bin/make -f
CFLAGS = -O3
.PHONY: all clean
all: main
main: main.c hoge.o
cc $(CFLAGS) -o $@ $^
main.c:
@echo '#include <stdint.h>' > $@
@echo '#include <stdio.h>' >> $@
@echo 'extern uint32_t hoge;' >> $@
@echo 'main() { printf("%08x\\n",hoge); }' >> $@
hoge.o: hoge.c
hoge.c:
@echo 'int hoge(int x) { return x+3; }' > $@
clean:
rm -f hoge.c hoge.o main.c main
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment