Categories
c

makefile example

linux下 make file example

CC=gcc
all: helloworld.o
	$(CC) helloworld.o -o helloworld

helloworld.o:
	$(CC) -c helloworld.c -o helloworld.o

clean:
	rm helloworld helloworld.o

execute:
	./helloworld

linux 下交叉编译 windows 64 位应用

CC=x86_64-w64-mingw32-gcc
all: helloworld.o
	$(CC) helloworld.o -o helloworld.exe 

helloworld.o:
	$(CC) -c helloworld.c -o helloworld.o

clean:
	rm helloworld.exe helloworld.o

execute:
	wine ./helloworld.exe

Leave a Reply