osx/Makefile
author Markus Bröker<broeker.markus@googlemail.com>
Fri, 20 Oct 2017 06:41:27 +0200
changeset 168 dfb60716880c
child 171 c6e0af68825a
permissions -rw-r--r--
Broken OSX Demo added

      CC = gcc -g -ggdb
      LD = ld
	ARCH = -arch i386
  CFLAGS = -Wall -O2 -Iinclude
 LDFLAGS = $(ARCH)
    NASM = /usr/local/bin/nasm -f macho -Iinclude/

  TARGETS = helloASM
  #TARGETS+= helloC

OBJECTS  = hello.o main.o
ENTRYPOINT = entryPoint

.SUFFIXES: .c .asm

.c.o:
	@echo Compiling $< ...
	@$(CC) -c $(CFLAGS) $(ARCH) -o $@ $<

.asm.o:
	@echo Assembling $< ...
	@$(NASM) $< -o $@

all: $(TARGETS)

helloC: $(OBJECTS)
	@echo Linking $(OBJECTS) ...
	$(CC) $(LDFLAGS) $(OBJECTS) -e $(ENTRYPOINT) -o $@

helloASM: hello.o
	@echo Linking $(OBJECTS) ...
	$(LD) -static -e $(ENTRYPOINT) $< -o $@

.PHONY: clean uninstall

clean:
	$(RM) *.o *~ $(TARGETS)