1
2# This makefile creates the JWasm Win32 binary with either MinGW or Cygwin.
3#  'mingw32-make -f GccWin.mak'    will use MinGW (no MSys needed!).
4#  'make -f GccWin.mak CYGWIN=1'   will use Cygwin.
5#
6# As for MinGW: you don't need MSYS - just run mingw32-make.exe. However,
7# the MinGW 'bin' subdirectory has to be in your path.
8
9name = jwasm
10
11ifndef CYGWIN
12CYGWIN=0
13endif
14
15ifndef DEBUG
16DEBUG=0
17endif
18
19inc_dirs  = -Isrc/H
20
21#cflags stuff
22
23ifeq ($(DEBUG),1)
24
25extra_c_flags = -DDEBUG_OUT -g
26lflagsd=
27ifeq ($(CYGWIN),1)
28OUTD=build/CygwinD
29else
30OUTD=build/MinGWD
31endif
32
33else
34
35extra_c_flags = -DNDEBUG -O2 -fomit-frame-pointer
36lflagsd=-s
37ifeq ($(CYGWIN),1)
38OUTD=build/CygwinR
39else
40OUTD=build/MinGWR
41endif
42
43endif
44
45c_flags = -D__NT__ $(extra_c_flags)
46
47CC=gcc.exe -c $(inc_dirs) $(c_flags)
48LINK=gcc.exe
49
50$(OUTD)/%.o: src/%.c
51	$(CC) -o $(OUTD)/$*.o $<
52
53include gccmod.inc
54
55TARGET1=$(OUTD)/$(name).exe
56
57ALL: $(OUTD) $(TARGET1)
58
59$(OUTD):
60	mkdir $(OUTD)
61
62$(OUTD)/$(name).exe : $(OUTD)/main.o $(proj_obj)
63	$(LINK) $(OUTD)/main.o $(proj_obj) $(lflagsd) -o $(OUTD)/$(name).exe -Wl,-Map,$(OUTD)/$(name).map
64
65$(OUTD)/msgtext.o: src/msgtext.c src/H/msgdef.h
66	$(CC) -o $(OUTD)/msgtext.o src/msgtext.c
67
68$(OUTD)/reswords.o: src/reswords.c src/H/instruct.h src/H/special.h src/H/directve.h
69	$(CC) -o $(OUTD)/reswords.o src/reswords.c
70
71######
72
73clean:
74	@rm $(OUTD)/*.exe
75	@rm $(OUTD)/*.o
76	@rm $(OUTD)/*.map
77