Makefile 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. # lco Makefile
  2. # Copyright (C) 2018 Ariadne Devos
  3. #
  4. # This program is free software: you can redistribute it and/or modify
  5. # it under the terms of the GNU General Public License as published by
  6. # the Free Software Foundation, either version 3 of the License, or
  7. # (at your option) any later version.
  8. #
  9. # This program is distributed in the hope that it will be useful,
  10. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. # GNU General Public License for more details.
  13. #
  14. # You should have received a copy of the GNU General Public License
  15. # along with this program. If not, see <http://www.gnu.org/licenses/>.
  16. CC := gcc
  17. ARCH := x86-64
  18. CFLAGS := -g3 -O3
  19. OBJECTS := lco.o lco-$(ARCH).o
  20. test: tests/fibonacci-check
  21. lco.o: lco.c lco.h
  22. $(CC) $(CFLAGS) -o lco.o -c lco.c
  23. lco-$(ARCH).o: lco-$(ARCH).S
  24. $(CC) -o lco-$(ARCH).o -c lco-$(ARCH).S
  25. tests/%-bin.o: tests/%-test.c lco.h
  26. $(CC) $(CFLAGS) -o $@ -c $<
  27. tests/%-bin: tests/%-bin.o $(OBJECTS)
  28. $(CC) $(CFLAGS) -o $@ $^
  29. tests/%-out: tests/%-bin
  30. $< > $@.tmp && mv $@.tmp $@
  31. tests/%-check: tests/%-out tests/%-data
  32. cmp ./tests/fibonacci-out tests/fibonacci-data && touch "$@"