aboutsummaryrefslogtreecommitdiff
path: root/makefile.after
blob: 8c3738c09007b8c5b470477426d5e4585e91c8fd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
OBJS+=$(CSRCS:%.c=$(OBJDIR)$/%$(OBJEXT))
OBJS:=$(OBJS:%.cc=$(OBJDIR)$/%$(OBJEXT))

RESOBJS:=$(RESOURCES:%.rc=$(OBJDIR)$/%.res)

MANIFESTFILE:=$(MHMAKECONF)\runtime.manifest

ifdef SUBDIRS
load_makefile $(SUBDIRS:%=%\makefile MAKESERVER=$(MAKESERVER) DEBUG=$(DEBUG);)
all: $(SUBDIRS:%=%\all)
endif


### Static library stuff ###
ifdef LIBRARY
LIBRARY_DIR := $(LIBRARY:%=$(OBJDIR)\%.lib)
PDB := $(LIBRARY_DIR:%.lib=%.pdb)

all: $(LIBRARY_DIR)

$(LIBRARY_DIR) : $(OBJS)
	$(AR) /OUT:$(relpath $@) $(OBJS)

endif # End static library stuff

### WINAPP stuff ###
ifdef WINAPP
EXE := $(WINAPP:%=$(OBJDIR)\%.exe)
PDB := $(EXE:%.exe=%.pdb)

#LINKFLAGS += /SUBSYSTEM:WINDOWS

all: $(EXE)

$(EXE) :  $(OBJS) $(INCLUDELIBFILES) $(RESOBJS) $(MANIFESTFILE)
	$(LINK) $(LINKFLAGS) /MANIFEST:NO /OUT:$(relpath $@) $(INCLUDELIBFILES) $(SYSTEMLIBS) $(LINKLIBS) $(OBJS) $(RESOBJS)
	mt -nologo -manifest $(MANIFESTFILE) -outputresource:$(relpath $@);\#1

endif  # End WINAPP stuff

ifeq ($(DEBUG),1)
COMMONCFLAGS += $(DEFINES:%=-D%) $(INCLUDES:%=-I"%") -Fo"$(relpath $@)" -Fd"$(PDB)" "$<"
else
COMMONCFLAGS += $(DEFINES:%=-D%) $(INCLUDES:%=-I"%") -Fo"$(relpath $@)" "$<"
PDB=   # There is no PDB file generated in a release build
endif

.PHONY: all cleanall clean clean$(OBJDIRPREFIX)

### Implicit rules ###
CREATEDIR=if not isdir $@ mkdir /s $@

$(OBJDIR) :
	$(CREATEDIR)

ifneq ($(OBJDIRPREFIX),)
clean: clean$(OBJDIRPREFIX)
endif

clean$(OBJDIRPREFIX):
	del -e $(OBJDIR)

$(OBJDIR)\%$(OBJEXT) : %.c
	$(CC) $(CCFLAGS) $(COMMONCFLAGS)

$(OBJDIR)\%$(OBJEXT) : %.cc
	$(CC) $(CCFLAGS) /EHsc $(COMMONCFLAGS)

$(OBJDIR)\%.res : %.rc
	$(RC) $(RCFLAGS) $(RCDEFINES:%=-d "%") $(RCINCLUDES:%=-i "%") -Fo"$(relpath $@)" "$<"

BDFTOPCF= $(MHMAKECONF)\bdftopcf\$(OBJDIR)\bdftopcf.exe
load_makefile $(MHMAKECONF)\bdftopcf\makefile MAKESERVER=0 DEBUG=$(DEBUG)

$(DESTDIR)\%.pcf.gz: %.bdf
	@del -e $@
	$(BDFTOPCF) -t $< | gzip > $@

$(DESTDIR)\%.enc.gz: %.enc
	gzip -c < $< > $@