# $TARGET_NORC = Do not include standard resource file (no,yes) (optional)
# $TARGET_LIBPATH = Destination path for import libraries (optional)
# $TARGET_INSTALLDIR = Destination path when installed (optional)
+# $TARGET_PCH = Filename of header to use to generate a PCH if supported by the compiler (optional)
# $WINE_MODE = Compile using WINE headers (no,yes) (optional)
# $WINE_RC = Name of .rc file for WINE modules (optional)
endif
endif
+ifeq ($(TARGET_TYPE),proglib)
+ ifeq ($(TARGET_APPTYPE),windows)
+ MK_DEFENTRY := _WinMainCRTStartup
+ MK_SDKLIBS := ntdll.a kernel32.a gdi32.a user32.a
+ TARGET_LFLAGS += -Wl,--subsystem,windows
+ endif
+
+ ifeq ($(TARGET_APPTYPE),native)
+ MK_DEFENTRY := _NtProcessStartup@4
+ MK_SDKLIBS := ntdll.a
+ TARGET_LFLAGS += -Wl,--subsystem,native -nostartfiles
+ endif
+
+ ifeq ($(TARGET_APPTYPE),console)
+ MK_DEFENTRY := _mainCRTStartup
+ MK_SDKLIBS :=
+ TARGET_LFLAGS += -Wl,--subsystem,console
+ endif
+endif
+
MK_RESOURCE := $(MK_RES_BASE).coff
$(MK_FULLRES): $(PATH_TO_TOP)/include/reactos/buildno.h $(TARGET_PATH)/$(MK_RES_BASE).rc
+ifeq ($(MK_DEPENDS),yes)
+depends:
+else
+depends:
+endif
+
ifeq ($(MK_IMPLIB),yes)
$(MK_IMPLIBPATH)/$(MK_BASENAME).a: $(MK_DEFNAME)
$(DLLTOOL) --dllname $(MK_FULLNAME) \
MK_CLEANFILES := $(filter %.o,$(MK_OBJECTS))
clean:
- - $(RM) *.o $(MK_BASENAME).sym $(MK_BASENAME).a $(TARGET_PATH)/$(MK_RES_BASE).coff \
+ - $(RM) *.o depend.d *.pch $(MK_BASENAME).sym $(MK_BASENAME).a $(TARGET_PATH)/$(MK_RES_BASE).coff \
$(MK_FULLNAME) $(MK_NOSTRIPNAME) $(MK_CLEANFILES) \
junk.tmp base.tmp temp.exp \
$(TARGET_CLEAN)
$(CP) $(MK_FULLNAME) $(DIST_DIR)/$(MK_DISTDIR)/$(MK_FULLNAME)
$(CP) $(MK_BASENAME).sym $(DIST_DIR)/symbols/$(MK_BASENAME).sym
-
endif # MK_IMPLIBONLY
-.phony: all implib clean install dist
+.phony: all depends implib clean install dist depends
+
+
+# Precompiled header support
+# When using PCHs, use dependency tracking to keep the .pch files up-to-date.
+
+MK_PCHNAME =
+ifeq ($(ROS_USE_PCH),yes)
+ifneq ($(TARGET_PCH),)
+MK_PCHNAME = $(TARGET_PCH).pch
+
+# GCC generates wrong dependencies for header files.
+MK_PCHFAKE = $(TARGET_PCH:.h=.o)
+$(MK_PCHFAKE):
+ - $(RTOUCH) $(MK_PCHFAKE)
+
+$(MK_PCHNAME): depend.d
+ - $(RTOUCH) $(MK_PCHNAME)
+ - $(CC) $(TARGET_CFLAGS) $(TARGET_PCH)
+
+depend.d: $(MK_PCHFAKE)
+ - $(RTOUCH) depend.d
+ - $(CC) $(TARGET_CFLAGS) $(TARGET_PCH) -M -MF depend.d
+
+include depend.d
+
+endif # TARGET_PCH
+endif # ROS_USE_PCH
-%.o: %.c
+%.o: %.c $(MK_PCHNAME)
$(CC) $(TARGET_CFLAGS) -c $< -o $@
%.o: %.cc
$(CC) $(TARGET_CPPFLAGS) -c $< -o $@